Overview
Opcode:0x41
Introduced: Frontier (EVM genesis)
COINBASE retrieves the address of the block beneficiary - the account that receives the block reward and transaction fees for the current block. This is typically the miner’s address (pre-merge) or validator’s address (post-merge).
Specification
Stack Input:Behavior
COINBASE pushes the 20-byte beneficiary address onto the stack as a 256-bit unsigned integer. The address is right-aligned (lower-order bytes):Examples
Basic Usage
Extract Address from Stack
Compare with Current Address
Gas Cost
Cost: 2 gas (GasQuickStep) COINBASE is one of the cheapest operations, sharing the GasQuickStep tier with:TIMESTAMP(0x42)NUMBER(0x43)DIFFICULTY(0x44)GASLIMIT(0x45)CHAINID(0x46)
COINBASE: 2 gasSELFBALANCE: 5 gasBLOCKHASH: 20 gasBALANCE(cold): 2600 gas
Common Usage
Miner Tipping
Coinbase Verification
Flashbots/MEV Protection
Block Producer Allowlist
Historical Validator Tracking
Pre-Merge vs Post-Merge
Pre-Merge (PoW)
- Miner can set coinbase to any address
- Often set to mining pool contract
- Can change between blocks
Post-Merge (PoS)
- Set by validator client configuration
- Typically validator’s withdrawal address
- More predictable than PoW mining pools
Security Considerations
Centralization Risk
Relying onblock.coinbase for access control creates centralization:
Validator Collusion
Validators can coordinate to manipulate coinbase-dependent logic:- Multiple validators coordinate
- Take turns producing blocks
- Maximize collective score
MEV Considerations
block.coinbase enables MEV-aware contract designs:
Coinbase Replay Attacks
Be careful with coinbase-based authentication across chains:Implementation
- TypeScript
Edge Cases
Zero Address Coinbase
Maximum Address Value
Stack Overflow
Out of Gas
Benchmarks
Performance:- Address to u256 conversion: O(20) - iterate 20 bytes
- Stack push: O(1)
- 2 gas per query
- ~500,000 queries per million gas
- One of the cheapest EVM operations
Related Instructions
- ADDRESS (0x30) - Get executing contract address
- ORIGIN (0x32) - Get transaction origin
- CALLER (0x33) - Get caller address
- SELFBALANCE (0x47) - Get balance of current contract
References
- Yellow Paper - Section 9.3 (Block Information)
- EVM Codes - COINBASE
- Solidity Docs - block.coinbase
- Flashbots Docs - MEV

