Gas Fee
A gas fee is the cost paid to execute transactions or smart contracts on blockchains like Ethereum, measured in computational work units.
Key Takeaways
- A gas fee is the cost users pay to execute operations on Ethereum and similar blockchains, calculated as gas units used multiplied by the price per gas unit (denominated in gwei, a subunit of ETH).
- Since EIP-1559, Ethereum splits gas fees into a burned base fee and a priority tip paid to validators: the base fee adjusts algorithmically based on block utilization, while Layer 2 rollups reduce costs by 90-99%.
- Bitcoin uses a fundamentally different fee model based on transaction data size in virtual bytes rather than computational complexity, avoiding gas mechanics entirely through its simpler UTXO model.
What Is a Gas Fee?
A gas fee is the cost required to perform any operation on the Ethereum blockchain, from sending ETH to executing complex smart contract logic. Every computation on the Ethereum Virtual Machine (EVM) consumes a measurable amount of "gas," and users must pay for that gas to have their transactions processed by validators.
The concept borrows from the real-world analogy of fuel: just as a car needs gasoline to run, Ethereum needs gas to execute code. More complex operations (deploying a contract, swapping tokens on a DEX) consume more gas than simple ones (transferring ETH). The gas fee mechanism prevents spam and infinite loops by ensuring every computation has a cost, while also compensating validators for the resources they expend.
Gas is measured in small units of ETH called gwei (short for giga-wei), where 1 gwei equals 0.000000001 ETH (10⁻⁹). A standard ETH transfer always costs exactly 21,000 gas units, but the price per gas unit fluctuates based on network demand.
How It Works
The total cost of an Ethereum transaction follows a straightforward formula:
Total Fee = Gas Units Used x Gas Price (in gwei)
Example: ETH transfer
Gas units: 21,000 (fixed for simple transfers)
Base fee: 10 gwei
Tip: 2 gwei
Total: 21,000 x (10 + 2) = 252,000 gwei = 0.000252 ETHEach EVM opcode has a fixed gas cost defined in the Ethereum Yellow Paper. An ADD operation costs 3 gas, a SSTORE (writing to storage) costs 20,000 gas, and a CREATE (deploying a contract) costs 32,000 gas. The total gas consumed by a transaction is the sum of all opcodes executed during processing.
Users set two parameters when submitting a transaction: a max fee per gas (the absolute ceiling they will pay) and a max priority fee (the tip for validators). Any difference between the max fee and the actual cost is refunded.
EIP-1559: Base Fee and Priority Fee
Introduced in August 2021 via the London hard fork, EIP-1559 fundamentally changed how Ethereum prices gas. Before EIP-1559, users submitted blind bids in a first-price auction, leading to overpayment and unpredictable fees. The new mechanism splits the fee into two components:
- Base fee: set algorithmically by the protocol, not by users. The base fee targets 50% block utilization (15 million gas). If a block exceeds the target, the base fee increases by up to 12.5% for the next block. If utilization falls below the target, it decreases by up to 12.5%. The base fee is entirely burned (destroyed), removing ETH from circulation.
- Priority fee (tip): an optional payment directly to the validator who includes the transaction. During normal conditions, 1-2 gwei is sufficient. During high congestion, tips can spike to 50+ gwei as users compete for block space.
This design makes fees more predictable: instead of guessing what other users will bid, wallets can read the current base fee and add a small tip. The burning mechanism also creates deflationary pressure on ETH supply during periods of heavy network usage.
Gas Costs by Operation
Different operations consume vastly different amounts of gas depending on their computational complexity:
| Operation | Gas Units | Approx. Cost (at 1 gwei) |
|---|---|---|
| ETH transfer | 21,000 | ~$0.05 |
| ERC-20 token transfer | 50,000-65,000 | ~$0.12-0.15 |
| Uniswap swap | 100,000-185,000 | ~$0.25-0.45 |
| NFT mint | 100,000-300,000 | ~$0.25-0.75 |
| Contract deployment | 1,000,000+ | ~$2.50+ |
These costs scale linearly with the gas price: at 10 gwei, multiply each cost by 10. During peak congestion in May 2021, average gas prices exceeded 400 gwei, making a simple Uniswap swap cost over $100.
How Bitcoin Fees Differ
Bitcoin uses a fundamentally different fee model. Instead of pricing computation, Bitcoin fees are based on transaction data size measured in virtual bytes (vBytes):
Bitcoin Fee = Transaction Size (vBytes) x Fee Rate (sat/vB)
Example: Standard P2WPKH transfer
Size: ~140 vBytes
Fee rate: 10 sat/vB
Total: 1,400 sats ≈ $1.40 (at $100k BTC)Because Bitcoin's UTXO model handles simple value transfers rather than arbitrary computation, there is no concept of "gas" or variable execution costs. A transaction sending 0.001 BTC costs the same in fees as one sending 1,000 BTC, assuming identical input and output structures. What matters is the number of inputs and outputs (which determine data size), not the amount transferred. For a deeper comparison of how these models affect fee markets, see the Bitcoin fee market dynamics research article.
Layer 2s and Gas Reduction
High gas fees on Ethereum mainnet drove the development of rollup-based Layer 2 networks that execute transactions off-chain and post compressed data back to Ethereum. These L2s reduce transaction costs by 90-99% compared to mainnet.
The March 2024 Dencun upgrade (EIP-4844) further reduced L2 costs by introducing "blob" transactions: a new data type purpose-built for rollup data that has its own fee market separate from regular gas. Each blob holds 128 KiB of data and is stored on the consensus layer for approximately 18 days before being pruned. L2 data posting costs dropped by roughly 60% immediately after Dencun, with some rollups seeing fees fall to fractions of a cent.
The Pectra upgrade in May 2025 doubled the blob target from 3 to 6 per block and increased the maximum from 6 to 9, further driving down L2 data costs to near zero. By early 2026, a typical transaction on optimistic rollups like Arbitrum or Base costs $0.003-0.01, while ZK rollups like zkSync Era cost $0.008-0.015.
Bitcoin-native Layer 2 solutions like Spark take a different approach entirely: rather than paying gas fees for computation, Spark uses a UTXO-based model inherited from Bitcoin, avoiding the gas complexity and MEV risks that come with account-model blockchains.
Use Cases
Gas fees serve several critical functions within the Ethereum ecosystem:
- Spam prevention: by attaching a cost to every computation, gas fees make it economically infeasible to flood the network with junk transactions or infinite loops.
- Validator compensation: priority fees incentivize validators to include transactions in their blocks, funding the network's security through proof of stake.
- Resource allocation: when block space is scarce, gas prices rise and users who value inclusion most (arbitrage bots, liquidators, urgent transfers) outbid others, creating a market for block space.
- Supply management: through EIP-1559's burn mechanism, gas fees create deflationary pressure on ETH supply. Since August 2021, approximately 4.6 million ETH has been burned.
Why It Matters
Gas fees are the primary user experience bottleneck for Ethereum-based applications. During periods of high demand, fees can make small transactions uneconomical: paying $50 in gas to swap $100 of tokens defeats the purpose. This dynamic has pushed DeFi activity to Layer 2s and alternative chains, reshaped application design (batching operations, lazy execution), and driven innovations like account abstraction that allow contracts to sponsor gas on behalf of users.
For developers choosing which blockchain to build on, the gas model is a fundamental design consideration. The UTXO model vs. account model comparison directly influences fee structures, MEV exposure, and scalability tradeoffs. Bitcoin-based systems like Spark sidestep gas complexity entirely, offering predictable, size-based fees through the UTXO model.
Risks and Considerations
Fee Volatility
Gas prices can spike dramatically within minutes during high-demand events: NFT drops, token launches, DeFi liquidation cascades, or memecoin frenzies. In May 2021, average gas prices exceeded 400 gwei, making even simple transactions cost $50+. Users who set gas limits too low during spikes will see their transactions stuck in the mempool for hours or days.
Failed Transactions Still Cost Gas
If a transaction runs out of gas or encounters a revert during execution, the user still pays for the gas consumed up to the failure point. This means interacting with buggy contracts or setting gas limits too low results in lost fees with nothing to show for it. A failed Uniswap swap might consume 50,000+ gas units before reverting.
MEV and Priority Fee Games
The gas fee mechanism creates opportunities for maximal extractable value (MEV): validators and searchers can reorder, insert, or censor transactions within a block for profit. Sandwich attacks, where a bot places transactions before and after a user's swap, exploit gas price dynamics to extract value. Users end up paying more than necessary while receiving worse execution prices.
Complexity for New Users
Understanding gas limits, base fees, priority tips, and max fees per gas creates a steep learning curve for newcomers. Setting parameters incorrectly can result in overpaying, stuck transactions, or outright failure. This complexity stands in contrast to Bitcoin's simpler fee model, where fee estimation tools suggest a single sat/vB rate based on current mempool conditions.
This glossary entry is for informational purposes only and does not constitute financial or investment advice. Always do your own research before using any protocol or technology.