[Ethereum] Why does a miner still pay gas for a reverted transaction

gasminingremix

I ran a contract here, I got the message "Transaction mined but execution failed". :

[vm]from:0xca3…a733cto:Will.deceased() 0xbbf…732dbvalue:0
weidata:0x72f…af2d9logs:0hash:0xac5…6c5be status 0x0 Transaction
mined but execution failed transaction hash
0xac5e9ba96b61041582a22490d2947cc4d7f0f153255fb0ac273d931035c6c5be
from 0xca35b7d915458ef540ade6068dfe2f44e8fa733c to Will.deceased()
0xbbf289d846208c16edc8474705c748aff07732db gas 3000000 gas
transaction cost 56697 gas execution cost 35425 gas hash
0xac5e9ba96b61041582a22490d2947cc4d7f0f153255fb0ac273d931035c6c5be
input 0x72f…af2d9 decoded input {} decoded output {} logs []
value 0 wei transact to Will.deceased errored: VM error: revert.

Why is the miner still paid?

Best Answer

A reverted transaction generally means that the logic of the smart contract being used failed or there's not enough gas to complete the transaction. The transaction was still executed by the miner, and any gas used prior to the transaction being reverted needs to be paid for. Based on this, the reverted transaction is still mined and included into the block that is published, but the state (of contracts) is not changed as intended.

Related Topic