This page is a placeholder. All examples on this page are currently AI-generated and are not correct. This documentation will be completed in the future with accurate, tested examples.
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:
Stack Output:
Gas Cost: 2 (GasQuickStep)
Operation:
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
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)
Comparison:
COINBASE: 2 gas
SELFBALANCE: 5 gas
BLOCKHASH: 20 gas
BALANCE (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)
Characteristics:
- Miner can set coinbase to any address
- Often set to mining pool contract
- Can change between blocks
Post-Merge (PoS)
Characteristics:
- Set by validator client configuration
- Typically validator’s withdrawal address
- More predictable than PoW mining pools
Security Considerations
Centralization Risk
Relying on block.coinbase for access control creates centralization:
Mitigation:
Use multi-signature or DAO governance instead of validator-gated logic.
Validator Collusion
Validators can coordinate to manipulate coinbase-dependent logic:
Attack:
- 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
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)
Gas efficiency:
- 2 gas per query
- ~500,000 queries per million gas
- One of the cheapest EVM operations
References