In this track: Gas and execution fees
intermediate · 3 MIN READ

What happens when gas runs out?

Execution cannot keep working after exhausting its permitted resources.

LET’S PICTURE IT

A machine with a metered work budget stops when the budget cannot cover its next operation.

SEE IT FOR YOURSELF
Calculate and split a manual execution feeStep 1 / 4
Calculate and split a manual execution feeGas used21,000A resource quantityGas used and gas limit are different quantitiesBase10 GweiEffective tip2 GweiTotal rate12 Gwei / gasAssumed total cap: 20 Gwei; no live prices are fetchedWork × rate21,000 × 12252,000 GweiExecution fee0.000252 ETHExact unit conversionThis calculation excludes blob and layer 2 data feesBase component0.00021 ETHBurned by protocolPriority component0.000042 ETHTo fee recipientComponents sum to the supplied 0.000252 ETH example

This example supplies twenty-one thousand gas used. It is a simple teaching input, not a live estimate of a contract call.

Animated local teaching model. No wallet, RPC or live blockchain data. Some labels and hashes are abbreviated for readability.

Resource accounting bounds execution

Gas prevents a transaction from demanding unlimited computation. An out-of-gas condition is an exceptional execution failure for the affected call context. The relevant state changes do not successfully persist through that failure.

Call boundaries still matter

A top-level failure and a failed nested call are different contexts. An outer contract can sometimes handle a failed inner call according to its logic. Do not infer the entire transaction’s outcome from one frame without a trace.

Increasing the limit fixes only some causes

A computation that needs more resources may succeed with an appropriate allowance, but missing permissions or a deliberately failing condition are not repaired merely by raising gas. The action and state must be understood.

Gas spent is still work

Failed execution can still consume gas and produce a fee. A wallet should distinguish an execution failure from a transaction rejected before inclusion. The revert decoder handles supplied error bytes, not every out-of-gas trace.

TURN UNDERSTANDING INTO PRACTICEOpen the Revert decoder →
QUICK CHECK · NO PRESSURE

Does raising a gas limit bypass a contract’s owner-only condition?

Your progress stays in this browser.
Keep exploring the original referenceSolidity documentation ↗

Original explanations by EtherTools. Examples are educational and source-linked; this site is independent of the Ethereum Foundation. Our approach.