There is the sad history of the unfaithfulness of the Israelites to their God, and the history of God's dealings with this stiffnecked people, a treatment of them in which God was always strictly righteous. Because Israel had so often failed to hear the Word of God, Moses addresses his words to the heavens and the earth. And then the faithful servant of God points Israel and us to the everlasting truth that we may never forget. Righteousness is a legal term.
Righteousness involves perfect conformity to some standard or law.
That is true in respect to man, but that is no less true when we consider the righteousness of God. The righteousness of God means that He conforms perfectly to a certain standard. Both the Hebrew and the Greek terms express the idea of being straight. So we must conceive of a certain standard, a perfectly straight line. God is righteous in that He conforms very exactly to an ethical yardstick.