The way the bible depicts righteousness in Romans refers back to the story of Abraham, He messed up, but he still trusted God and acted on his word, So because of his belief he was made pure, or righteous.