Understanding Ethereum Gas
"Gas" is the fuel of the Ethereum network. Every computation requires energy, and you pay miners/validators for that energy in ETH. The fee is determined by two factors: Complexity (Gas Limit) and Demand (Gas Price).
Gas Limit vs Gas Price
- Gas Limit (Units): The amount of work.
- Simple Transfer = 21,000 units. (Fixed)
- Swap on Uniswap = ~180,000 units. (Complex)
- NFT Mint = ~250,000+ units. (Very Complex)
- Gas Price (Gwei): The cost per unit. This fluctuates wildly based on network congestion. During a popular NFT mint, it can spike from 20 Gwei to 500 Gwei.
What is Gwei?
Gwei (Gigavei) is a denomination of Ether. 1 Gwei = 0.000000001 ETH. Because fees are small fractions of ETH, Gwei is easier to read.
EIP-1559: The Burn Mechanism
Since the London Upgrade (EIP-1559), fees are split into:
- Base Fee: Automatically set by the network. This ETH is Burned (destroyed), making ETH deflationary.
- Priority Fee (Tip): Optional tip to the miner to speed up your transaction.
Why did my transaction fail?
If you set the **Gas Limit** too low, the transaction runs out of fuel and fails. You lose the fee you paid! Never lower the Gas Limit suggested by your wallet. You can lower the Gas Price (Gwei) if you are willing to wait, but touching the Limit is dangerous.
Layer 2 Solutions
Fees on mainnet are high ($2-$50). Layer 2 networks like Arbitrum, Optimism, and Polygon process transactions off-chain and batch them, lowering fees to fractions of a cent ($0.01).
Layer 2 Scaling (Rollups)
To solve high fees, Ethereum uses Layer 2 networks. These process thousands of transactions off-chain and only post a "summary" to the main chain.
- Optimistic Rollups (Arbitrum, Optimism): Assume transactions are valid by default. 7-day withdrawal period.
- ZK Rollups (zkSync, Starknet): Use Zero-Knowledge math to prove validity instantly. Considered the "End Game" for scaling.
Gas fees on L2s are typically 90-99% lower than Mainnet.
The "Gas Limit" Trap
Beginners often try to save money by lowering the Gas Limit. DO NOT DO THIS. Gas Limit is the *amount of work* required. If you lower it, the transaction will run out of fuel halfway. The EVM will revert changes, but miners keep your fee.
FAQs
- Does the failed fee get refunded?
- No. The network still did the work up to the point of failure. Miners must be paid for that computation.
- When is gas cheapest?
- Usually weekends (Sunday) or US night hours/Asian early mornings when global network usage is lowest.
- Who gets the fees?
- Since EIP-1559, the Base Fee is burned (removed from supply). Only the Priority Fee (Tip) goes to the Validator/Miner.