But He did not respect Cain and his offering. And Cain was very angry, and his countenance fell. Gen 4:5
The brothers brought a sacrifice to the Lord God. God accepted one and rejected the other.
That seems unfair. Both brought something connected with their livelihood.
Abel, being a shepherd, brought the firstborn of his flock.
Cain, being a farmer, brought an assortment of fruits and vegetables.
The whole story is not given but you can ascertain a few things.
First, the writer of Hebrews says, “By faith Abel offered to God a more excellent sacrifice than Cain.” Heb 11:4
No you know that faith is involved in the offering. You also know that Cain lacked faith in his presentation.
Rom 14:23 says whatever is not from faith is sin.
Cain’s attitude during the offering lacked faith and was sinful.
Cain became angry, sullen, downcast, and eventually killed his own brother.
This is the kind of attitude that kept him from presenting a sacrifice of faith to God.
If those traits showed up during and after the sacrifice, then those traits were present before the sacrifice.
God gave Cain a punishment. Cain complained the edict was too harsh. God marked Cain to warn others not to take his life.
Even in the midst of murder, God gives grace. God does not want to kill people. He desires to give life to everyone. Sin gives death (Rom 6:23) and God gives life.
John 10:10 – I have come that they may have life, and that they may have it more abundantly.