Gas Fees Explained

Gas Limit

Gas limit refers to the maximum amount of gas you are willing to consume on a transaction. More complicated transactions involving smart contracts require more computational work, so they require a higher gas limit than a simple payment. A standard ETH transfer requires a gas limit of 21,000 units of gas.

For example, if you put a gas limit of 50,000 for a simple ETH transfer, the EVM would consume 21,000, and you would get back the remaining 29,000. However, if you specify too little gas, for example, a gas limit of 20,000 for a simple ETH transfer, the EVM will consume your 20,000 gas units attempting to fulfill the transaction, but it will not complete. The EVM then reverts any changes, but since the validator has already done 20k gas units worth of work, that gas is consumed.

Max Fee

Max Priority Fee

Max Transaction Fee

If you are buying 21,000 units of gas, and you set a max fee to limit the maximum amount you will pay, then the validator will pocket the difference from the base fee, up to the max priority fee set. So, if I want to buy 21,000 units of gas, and I set a max fee of 50 Gwei and a max priority fee of 5 Gwei, then if the base fee at the time of the transaction is:

  • 47 Gwei then the validator will earn the 3 Gwei.

    • But if 3 Gwei isn't a high enough fee compared with other transactions then I'll be left out.

  • 45 Gwei then the validator will earn the maximum 5 Gwei.

    • Again, only if 5 is enough of a tip to beat other people in the same block.

  • 40 Gwei then the validator will still only earn a maximum of 5 Gwei as that's the limit I set and any difference will be returned to the senders wallet.

    • This returned amount will be a messy number.

Last updated