An interesting fact about Abraham being declared righteous by God Himself is that he was declared to be righteous by God because Abraham "believed God " - 15 years before he "offered up Isaac".
His faith was completed as a result of already being declared righteous by God. Knowing the truth about what God says about us releases true faith to grow and be manifested. There is a false way of trying to create works in order to create and maintain righteousness. This is eating from the tree of the knowledge of good and evil.
True righteousness which comes only from God's work in Christ always comes when we believe what God says is true. There are "fruits of righteousness" as James talks about which shows up in helping our fellow man in need but they do not create righteousness.
Being righteous in Christ comes first because of His work on the cross and resurrection. Getting this backwards creates a religion of self-righteousness and actually denies the work of Christ Himself.
Preach and teach the good news that Christ alone is our righteousness and then the fruit of His life will be manifested in "deeds of righteousness" as He bears His fruit in and through us to a hurt and dying world that needs to see the love and grace that our loving Father has for them.
We will see corresponding action or works that glorify God.
Romans 4:1-4
Chapter 4
Abraham Justified by Faith
What then shall we say that Abraham our father has found according to the flesh? For if Abraham was justified by works, he has something to boast about, but not before God. For what does the Scripture say? “Abraham believed God, and it was accounted to him for righteousness.” Now to him who works, the wages are not counted as grace but as debt.
Genesis 15:6
And he believed in the Lord, and He accounted it to him for righteousness (Abram)
My thoughts are that Abram believed God so much so that he packed his bags, left Ur.
He placed his faith in God which was credited as righteousness.
He saw the promise of God even though it had not yet been given.
We find during his time he got it wrong a few times yet he still had faith in God.
If memory serves me on one occasion when he lied about his wife, to Abimilech and said she was his sister we find that Abimelech wanted to take her.
God then steps in
Genesis 20:3-8
But God came to Abimelech in a dream by night, and said to him, “Indeed you are a dead man because of the woman whom you have taken, for she is a man's wife.”
But Abimelech had not come near her; and he said, “Lord, will You slay a righteous nation also? Did he not say to me, “She is my sister’? And she, even she herself said, ‘He is my brother.’ In the integrity of my heart and innocence of my hands I have done this.”
And God said to him in a dream, “Yes, I know that you did this in the integrity of your heart. For I also withheld you from sinning against Me; therefore I did not let you touch her. Now therefore, restore the man's wife; for he is a prophet, and he will pray for you and you shall live. But if you do not restore her, know that you shall surely die, you and all who are yours.”
So Abimelech rose early in the morning, called all his servants, and told all these things in their hearing; and the men were very much afraid.
All this and more before offering up Isaac.
Now why did he offer up Issac?
Because he had faith and placed his faith in God.
When we place our faith in Jesus, a true saving faith then actions will follow, they will consist of wrong actions but also good actions.
As we grow in Jesus the negatives will decrease and the positives increase.
We decrease and Jesus increases in us.
Just my simple thoughts.