John 1:17 For the law was given through Moses; grace and truth came through Jesus Christ.
Here the scripture says law was given through Moses.
And again from
Galatians 4:21-22 Tell me, you who desire to be under the law, do you not listen to the law? 22 For it is written that Abraham had two sons, one by a slave woman and one by a free woman.
it seems like the law existed before Moses at the time of Abraham.
So what is the law referring to in these two verses? Are they different? If different what are they? In scriptures is the old covenant and the law same?