Gas Fee
- Category
- Blockchain
- Level
- Professional
Simple definition
What you pay a blockchain to run your transaction. It depends on how much work the transaction asks for and how busy the network is, not on how much value you are sending.
Professional definition
On Ethereum, the gas a transaction consumes multiplied by the price paid per unit of gas. Under the current fee market that price is a protocol base fee, which adjusts with how full recent blocks were and is burned, plus a priority fee paid to the block proposer.
Technical definition
Gas meters computation, storage and data rather than elapsed time, so identical transfers cost the same while contract calls vary with execution path. The base fee moves by a bounded step each block toward a target gas usage, which smooths prices but cannot clear a sustained demand spike. A sender's gas limit caps spend and unused gas is returned, yet a transaction that reverts still pays for the work done. On rollups the dominant term is the cost of posting data to the base layer.
Academic definition
The price paid for consuming a blockchain's metered execution resources, determined jointly by the resource units a transaction consumes and a per-unit price set by protocol rule and prevailing congestion.
Mechanism
Two things are being priced at once: how much of the block a transaction occupies, and how much everyone else wants the same space. The protocol fixes the first with a published cost table and lets the second float, so the base fee rises automatically when blocks run full and decays when they do not. Users bid only on the priority component.
In practice
- Who uses it
- Anyone sending an on-chain transaction, wallet developers writing fee estimators, and contract authors optimising for execution cost.
- Why it matters
- It is the direct cost of using a chain, and on congested networks it can exceed the economic value of the action being taken.
- Limitations
- Estimators forecast the next blocks' base fee and can be wrong. Rollup fees include a base-layer data component the user cannot influence.
Common mistakes
- Expecting the fee to scale with the amount being sent.
- Assuming a failed transaction costs nothing.
- Setting a gas limit so low that the call reverts and the fee is still paid.
Examples
A plain transfer consumes 21,000 gas. With an illustrative base fee of 20 gwei and a priority fee of 2 gwei, the sender pays 21,000 times 22 gwei, which is 0.000462 ETH.
- gas used = 21,000 (Ethereum's fixed cost for a simple value transfer)
- base fee = 20 gwei per gas (illustrative)
- priority fee = 2 gwei per gas (illustrative)
- price per gas = 20 + 2 = 22 gwei
- fee = 21,000 x 22 = 462,000 gwei
- 462,000 gwei = 0.000462 ETH
Gas used is a protocol constant for this operation; the gwei prices are illustrative and move block to block.
Gas behaves like a metered taxi. You pay for distance covered, at a rate that rises in rush hour, and a journey that breaks down halfway is still charged for the distance already driven.
Mathematical foundation
Variables
| F | Total fee paid for the transaction | ETH |
| G_{used} | Gas units actually consumed by execution | gas |
| f_{base} | Protocol base fee per unit of gas; this portion is burned | gwei per gas |
| f_{prio} | Priority fee per unit of gas, paid to the block proposer | gwei per gas |
Procedure
Estimate the gas the call will consume, from the protocol's cost table or a simulation. Add the current base fee to the priority fee you are willing to pay. Multiply. Set a gas limit above the estimate: unused gas is refunded, but running out reverts the call and the work done is still charged.
Worked example
- G_used = 21,000
- f_base = 20 gwei per gas
- f_prio = 2 gwei per gas
- f_base + f_prio = 22 gwei per gas
- F = 21,000 x 22 = 462,000 gwei
- 462,000 gwei / 1,000,000,000 = 0.000462 ETH
Interpretation
The result is a cost of execution, independent of the value moved. It rises with the complexity of the call and with congestion, so the same action can cost very different amounts at different times.
Assumptions
- The formula describes Ethereum's current base-fee market. Before that reform the fee was gas used times a single gas price, all of it to the miner.
- Gas used is known exactly only after execution; before sending it is an estimate from the cost table or a simulation.
- The 21,000 gas figure applies to a plain value transfer only; contract calls depend on the code path taken.
- It prices execution, not value transferred, so it is regressive for small payments.
- On rollups a further component covers posting data to the base layer, and that term is outside the sender's control.
- Other chains meter resources differently, so the identity does not transfer unchanged.
Related terminology
Slippage
A gas fee is paid to the network for executing a transaction at all. Slippage is the difference between the price expected and the price received. A swap can succeed on gas and still lose on slippage.
Sources
Ethereum Foundation Developer Docs · block gas target, gas limit and base fee adjustment
https://ethereum.org/developers/docs/blocks/ URL verified
Ethereum Foundation · entries for gas, gwei, base fee and priority fee
https://ethereum.org/glossary/ URL verified
Editorial status
Written, not yet reviewed.
