Why Does a Failed Ethereum Transaction Still Charge Gas?
A failed Ethereum transaction still consumes gas because validators performed computation before the contract reverted or exhausted its limit. State changes roll back, but completed work cannot be undone. The user pays for gas actually used; the unused portion of the limit is returned, except when execution consumes the full allowance in an out-of-gas failure.
A failed Ethereum transaction still consumes gas because validators performed computation before the contract reverted or exhausted its limit. State changes roll back, but completed work cannot be undone. The user pays for gas actually used; the unused portion of the limit is returned, except when execution consumes the full allowance in an out-of-gas failure.
What work does the sender pay for?
Every EVM instruction has a cost: reading and changing storage, verifying signatures, emitting events, and making external calls. Nodes repeat computation to agree on the result. Fees make mass execution of useless or unbounded programs expensive and protect scarce block space.
What exactly does a revert undo?
A revert restores contracts and balances to their pre-call state, but the outer transaction nonce and fee remain. Ethereum.org states that gas is paid whether a transaction succeeds or fails. If a contract reverts after partial logic, the user pays for the steps performed before stopping.
How does gas limit differ from the actual fee?
Gas limit is the maximum work units the sender permits. If execution ends earlier, unused capacity is not charged; final cost is gas used multiplied by effective price. With out-of-gas, execution reaches the limit, reverts, and normally consumes the entire amount provided.
What are the limits and risks?
A simulation can pass on old state while the real transaction fails after a price, allowance, or nonce change. Bad slippage, a closed mint, and front-running can also cause reverts. Before an expensive call, use a fresh simulation, understand the error, and set a sensible limit; adding gas does not repair contract logic.
What are the key takeaways?
- A revert undoes state but not computation already performed.
- Gas protects the network from spam and unbounded work.
- Unused gas limit is normally not charged.
- Out-of-gas can consume the full allocated limit.
- Simulation reduces risk but cannot guarantee execution in a future block.
Sources
- Ethereum gas
- EVM revert
- Transaction failure
This article is for information only and is not individual investment advice. Trading crypto carries the risk of losing your funds; results on historical data do not guarantee future results.
Check the strategy against your own data
ACARO is a terminal that executes a strategy on your own exchange account. Parameter search and backtesting on history are part of the subscription.
See pricing