4 By faith Abel offered to God a more excellent sacrifice than Cain, through which he obtained witness that he was righteous, God testifying of his gifts; and through it he being dead still speaks.
Beginning with Abel, Hebrews 11 gives a series of examples of those who accomplished something by faith. The original readers of Hebrews who wanted to go back to the Old Testament view of things now had instances of people who operated by faith; they could see what God was doing in the New Covenant.
4 By faith Abel
Abel was the second son of Adam. He was a shepherd (Ge 4:2). No one ever offered a sacrifice before Abel. He was the first to offer a sacrifice by faith. He had no precedent to follow.
offered to God a more excellent sacrifice than Cain,
Cain was the older brother of Abel. God rejected Cain’s offering but accepted Abel’s (Ge 4:3–5). Abel’s sacrifice was superior to Cain’s because he offered it by faith. Abel was a keeper of flocks but Cain was a tiller of the ground—one a shepherd and the other a farmer.
Cain killed Abel (Ge 4:8,9). He was no atheist for he brought a sacrifice to God, albeit it was unacceptable to God. The “way of Cain” (Jude 11) was to approach God by operation bootstraps; it was a system of works. See this study: https://versebyversecommentary.com/jude/jude-11a/
Abel’s sacrifice was better than Cain’s because it was a blood sacrifice. This is the kind of sacrifice that God requires. It is one thing to believe in God but another to believe God. Cain needed to believe God’s way of forgiveness. Abel’s sacrifice pointed to the sacrifice of Christ on the cross. Abel brought something dead to God, a blood sacrifice.
Cain ignored revelation; rather, he put trust in his own thinking or reason. He thought the work of his own hands would impress God. Abel believed what God said; he did not rest on his opinion. Cain’s self-induced religion caused the death of Abel.
through which [faith] he obtained witness that he was righteous,
Abel’s sacrifice met with God’s approval because it was a blood sacrifice and not a vegetable sacrifice like Cain’s. Abel was righteous because he believed God’s method of salvation. God viewed him as righteous not because he lived righteously but because God accredited him as righteous by faith. Jesus called Abel righteous (Mt 23:35; Lu 11:51). Abel was in right relation to God.
God testifying of his gifts;
The “gifts” here are the offerings of Abel’s sacrifice. God as witness to faith is the ultimate affirmation of one’s belief. God did not leave Abel in the dark about the acceptableness of his sacrifice. God had “regard” for Abel’s offering (Ge 4:4).
and through it [sacrifice]
The “it” here is Abel’s faith exhibited by offering an animal sacrifice (Ge 4:4).
he being dead still speaks.
Abel’s testimony of walking by faith continued to speak during the writing of the New Testament times long after he was dead (He 12:24).
We cannot come to God on our own terms.
We cannot come to God by our own device. It is possible to be religious but lost. We come by a more excellent sacrifice—the blood of the Lamb of God.
Faith is the foundation of worship. It is always a response to revelation. All faith requires an object (Ro 10:17). Faith rests in what God says or promises (He 11:3). God said something to Abel, and he believed it. A blood sacrifice was needed to pay for sin. Cain’s sacrifice was the work of his hands. Abel’s sacrifice was the life of another.
There are two representative groups on earth. Cain and Abel represent two representative groups on earth. One approaches God on his own terms and the other on God’s terms. Cain was of “that Wicked one” (1 Jn 3:12). You may want to look at this study https://versebyversecommentary.com/1-john/1-john-312/ and this one https://versebyversecommentary.com/1-john/1-john-312b/
As Abel’s sacrifice was superior to Cain’s, so the New Covenant sacrifice is superior to the Old Covenant symbols of sacrifice. The life of faith begins with blood sacrifice. It is by this means that we receive forgiveness for our sins. If anyone attempts to gain access to God by any way other than blood sacrifice, he will get the same response as Cain did—rejection.
There is no alternative to God’s way to heaven; it is by His provision or none at all. Those who think they have another way than God’s have gone the “way of Cain” (Jude 11; 1 Jn 3:12). These people are religious but lost, like Cain.