Overview
Opcode:0x48
Introduced: London (EIP-3198, part of EIP-1559)
BASEFEE retrieves the base fee per gas for the current block. This is a core component of EIP-1559’s fee market mechanism, representing the minimum gas price that must be paid for transaction inclusion.
Specification
Stack Input:Behavior
BASEFEE pushes the base fee per gas onto the stack as a 256-bit unsigned integer in wei:- Block full: Base fee increases by 12.5%
- Block empty: Base fee decreases by 12.5%
- Block 50% full: Base fee stays constant
Examples
Basic Usage
Pre-London Error
Fee Calculations
Priority Fee Calculation
Gas Cost
Cost: 2 gas (GasQuickStep) BASEFEE is one of the cheapest operations, enabling efficient fee market interaction. Comparison:BASEFEE: 2 gasGASPRICE(0x3A): 2 gasGASLIMIT: 2 gasTIMESTAMP: 2 gas
Common Usage
Dynamic Fee Adjustment
Fee Threshold Guards
Congestion Detection
Gas Refund Calculations
Fee Market Analytics
Security Considerations
Base Fee Manipulation
Validators cannot directly manipulate base fee (algorithmic adjustment):Fee Volatility
Base fee can change significantly between blocks:Transaction Priority
Base fee doesn’t guarantee inclusion priority:Pre-London Compatibility
Contracts must handle pre-London networks:EIP-1559 Fee Mechanism
Fee Components
Base Fee Adjustment Algorithm
Implementation
- TypeScript
Edge Cases
Pre-London Execution
Zero Base Fee
Extreme Network Congestion
Initial London Block
Historical Context
Pre-London (Legacy)
Post-London (EIP-1559)
Benchmarks
Performance:- Hardfork check: O(1)
- Stack push: O(1)
- 2 gas per query
- ~500,000 queries per million gas
Related Instructions
- GASPRICE (0x3A) - Get effective gas price
- GAS (0x5A) - Get remaining gas
- GASLIMIT (0x45) - Get block gas limit
References
- EIP-1559 - Fee market change
- EIP-3198 - BASEFEE opcode
- Yellow Paper - Section 9.3
- EVM Codes - BASEFEE
- EIP-1559 Calculator

