Foundations · Crypto Basics
Gas & Network Fees
A network fee is what a blockchain charges to process a transaction. On Ethereum-style chains it is measured in gas: the fee is the gas used multiplied by the price per unit of gas.
Why it matters
Every transaction on a public blockchain costs a fee, and the fee can change a great deal from one hour to the next. It affects what a transfer really costs, whether it goes through at all, and why a wallet holding only tokens can be unable to move them. Fees are also a common source of surprise: a transaction that fails still has to be paid for.
How it works
Block space is limited, and every node must repeat every computation. Fees ration that limited space and stop anyone from flooding the network with work for free.
On Ethereum and chains built like it, the work a transaction requires is measured in gas. Each operation the network performs has a gas cost. Moving ether costs a fixed 21,000 gas. Calling a smart contract costs more, because more steps are executed.
Gas measures quantity of work. It has a separate price, quoted in gwei. One gwei is one billionth of an ether (0.000000001 ETH).
Fee = gas used x price per unit of gasOn Ethereum the price per unit is the base fee plus the priority fee, both quoted in gwei.In plain words
A taxi fare is distance multiplied by the rate per kilometre. Gas is the distance: it depends on where you ask to go. The gas price is the rate: it depends on how busy the city is. The same trip costs more at rush hour.
The parts of an Ethereum fee
- You set limitsA gas limit, a maximum price and a tip.
- Base feeSet by the network for each block. Burned.
- Priority feeThe tip. Paid to the validator.
- RefundUnused gas and unused price headroom come back.
Since a change known as EIP-1559 took effect in August 2021, the price per unit of gas has two parts:
- Base fee. Set by the protocol for each block. When blocks are fuller than their target, it rises for the next block. When they are emptier, it falls. It can change by up to 12.5% from one block to the next. The base fee is burned: the ether is destroyed and nobody receives it.
- Priority fee. A tip chosen by the sender and paid to the validator who includes the transaction. A higher tip can mean earlier inclusion when many transactions are waiting.
The sender also sets two limits:
| Setting | What it controls |
|---|---|
| Gas limit | The most gas the transaction may use. Unused gas is not charged. |
| Maximum fee per gas | The highest total price per unit the sender accepts. Any difference above base fee plus tip is refunded. |
Wallets normally estimate all of these. The estimates are suggestions, and the final amounts are shown before signing.
Why fees rise and fall
The base fee is a price for scarce space. When many people want to transact at once, such as during a sharp market move or a popular token launch, blocks fill up and the base fee climbs block after block until demand eases.
Fees are normally charged in the native coin and priced in gas, so the cost in everyday money depends on two things at once: the gas price and the market price of the coin.
Going deeper
Failed transactions still cost. If a contract call fails halfway, or runs out of gas before finishing, its effects are undone but the validators have already done the work. The gas used up to that point is charged.
Other chains use the same idea with different units. Bitcoin has no gas. Its fee depends on the size of the transaction in data, as explained in fees and block space. Other networks have their own schedules, but they normally price scarce capacity in the native coin.
Layer 2 networks. A Layer 2 bundles many transactions and settles them to the base chain together, so the base-chain cost is shared. Fees there are usually lower, and they still vary with demand.
Network fees are not trading fees. A network fee is paid to the blockchain. An exchange’s trading fee is paid to the exchange. A swap on a decentralised exchange involves both.
Working out one feeHypothetical illustration
Hypothetical numbers. A plain ether transfer uses 21,000 gas. The base fee is 20 gwei and the sender adds a tip of 2 gwei.
- Price per unit: 20 + 2 = 22 gwei.
- Fee: 21,000 x 22 = 462,000 gwei = 0.000462 ETH.
- Burned: 21,000 x 20 = 420,000 gwei = 0.00042 ETH.
- To the validator: 21,000 x 2 = 42,000 gwei = 0.000042 ETH.
The two parts add up to 0.000462 ETH. A contract call that uses 150,000 gas at the same prices would cost 150,000 x 22 = 3,300,000 gwei = 0.0033 ETH, about seven times as much, because it asks for about seven times the work.
What it does NOT mean
- A fee is not a percentage of the amount sent. Moving 1 ether and moving 1,000 ether in a plain transfer use the same gas.
- A high fee does not make a transaction safer. It affects how quickly the transaction is likely to be included, not how secure it is afterwards.
- Gas is not a token you hold. It is a unit of measurement. The fee is normally paid in the chain’s native coin.
- The wallet’s estimate is not a quote. The actual fee is known only when the transaction is included.
Common misunderstandings
- Holding only tokens. A token transfer normally still needs the chain’s native coin to pay the fee.
- Setting the gas limit too low. The transaction runs out of gas, fails, and the gas already used is still charged.
- Confusing gas limit with gas price. One caps the quantity of work, the other is the price of each unit.
- Assuming fees are stable. The same action can cost many times more an hour later.
Risks and limits
- Fees can spike exactly when many people want to act at once, which is often during fast markets.
- A transaction with too low a price can stay pending for a long time. See transactions.
- Small transfers can cost more in fees than they are worth.
- Fee rules differ between chains and can be changed by network upgrades.
- Signing a transaction approves its full effect, not only its fee.
Key takeaway
Gas measures how much work a transaction asks the network to do, and the fee is that quantity multiplied by a price that rises and falls with demand. On Ethereum the base fee is burned and the tip goes to the validator.
Sources and further reading
- Ethereum gas and fees: technical overview (opens in a new tab), ethereum.org. Explains gas, the protocol-set base fee that is burned, the priority fee tip and the maximum fee
- Mastering Ethereum, Andreas M. Antonopoulos and Gavin Wood. Chapters on transactions and the Ethereum Virtual Machine