⛽ Gas Metering: Why Every Operation Costs Money
Learn why the EVM charges gas for computation and storage
Your Progress
0 / 5 completed⛽ Gas & Execution
Gas is the fuel for computation on Ethereum. Every EVM operation costs gas to prevent spam and infinite loops. You pay miners/validators for executing your code!
💡 Why Gas Exists
Prevent Spam
Without gas, attackers could spam network with infinite loops. Gas makes attacks expensive!
Incentivize Validators
Validators get paid in gas fees. This incentivizes them to include your transaction.
Fair Resource Allocation
Complex operations cost more. Simple transfers are cheap. Pay for what you use!
Deterministic Limits
Block gas limit (30M gas) caps computation per block. Prevents network overload.
🎮 Interactive: Gas Calculator
Adjust gas price and see how operation complexity affects cost
Simple Transfer
Basic ETH transfer between addresses
📊 Operation Gas Costs
| Operation | Opcode | Gas Cost |
|---|---|---|
| Addition | ADD | 3 |
| Multiplication | MUL | 5 |
| Read storage | SLOAD | 2,100 |
| Write storage (new) | SSTORE | 20,000 |
| Write storage (update) | SSTORE | 5,000 |
| Call contract | CALL | 700+ |
| Create contract | CREATE | 32,000+ |
| Log event | LOG0 | 375+ |
🔍 Gas Limit vs Gas Price
Gas Limit
Maximum gas you're willing to spend.
Gas Price
How much you pay per unit of gas (in Gwei).
💡 Gas Optimization Tips
⚠️ Out of Gas Errors
What happens when gas runs out: