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: 0x3b
Introduced: Frontier (EVM genesis)
EXTCODESIZE returns the size in bytes of the code stored at a given address.
Specification
Stack Input:
Stack Output:
Gas Cost: Variable (hardfork-dependent)
- Frontier: 20 gas
- Tangerine Whistle (EIP-150): 700 gas
- Berlin (EIP-2929): 2600 gas (cold) / 100 gas (warm)
Behavior
Returns the bytecode length of the account at the given address. Returns 0 for:
- EOAs (externally owned accounts)
- Non-existent accounts
- Contracts during construction (before constructor completes)
Examples
Basic Usage
Contract Detection
Constructor Bypass
Gas Cost
Historical evolution:
| Hardfork | Cold | Warm |
|---|
| Frontier | 20 | - |
| Tangerine Whistle | 700 | - |
| Berlin | 2600 | 100 |
Common Usage
Proxy Implementation Check
Security
Constructor Bypass
During construction, EXTCODESIZE returns 0:
Better Pattern
Use tx.origin check or whitelist:
Implementation
References