Overview
Opcode:0x38
Introduced: Frontier (EVM genesis)
CODESIZE pushes the byte length of the currently executing code onto the stack.
Specification
Stack Input:Behavior
Returns the size of the currently executing bytecode, including deployed code and constructor code.Examples
Basic Usage
Code Copying
Gas Cost
Cost: 2 gas (GasQuickStep)Common Usage
Constructor Detection
During contract construction, CODESIZE includes constructor code. After deployment, only runtime code.Implementation
- TypeScript
References
- Yellow Paper - Section 9.1
- EVM Codes - CODESIZE

