Gas limit is not gas price

The gas limit caps the computation a transaction may consume. Base fee, priority fee, and maximum fee per gas describe the price side. Contract calls need different amounts of gas depending on code paths and state. A wallet estimate is a simulation-based reference, not a guarantee that execution conditions will remain unchanged.

Failure before inclusion

If the limit cannot cover the transaction's intrinsic requirement, a node can reject it before block inclusion. Ethereum.org uses a simple ETH transfer to illustrate that 21,000 gas is normally required, while a limit of 20,000 fails validation. In that situation no onchain gas is consumed, and an explorer may have no included transaction record.

Out of gas during execution

A transaction can pass initial checks but exhaust its gas while a contract is running. The EVM reverts the state changes from that execution, yet the supplied gas is consumed for work already performed. Check the receipt status, gas used, effective gas price, and error data. A failed transaction can therefore still have a real fee.

Estimate and diagnose

Unused gas is normally returned, but raising the limit cannot repair a contract revert, missing authorization, or expired condition. Re-estimate the call, inspect parameters and balances, and leave a reasonable buffer. If estimation repeatedly fails, investigate the revert reason. Recheck the nonce and fee fields before retrying to avoid unintended replacement or duplication.

Sources

  1. Ethereum Gas and Fees
  2. EIP-1559

Prepared with AI assistance. This guide explains protocol behavior for educational use.

This content is for learning and risk education only and does not constitute investment advice.

Editorial policy (Chinese)