Overview
Opcode:0x39
Introduced: Frontier (EVM genesis)
CODECOPY copies a specified range of the currently executing code to memory.
Specification
Stack Input:Behavior
Copieslength bytes from executing code at offset to memory at destOffset. Zero-pads if code bounds exceeded.
Examples
Copy Runtime Code
CREATE2 Factory
Gas Cost
Base: 3 gas Memory expansion: Variable Copy cost: 3 gas per 32-byte wordImplementation
- TypeScript
References
- Yellow Paper - Section 9.1
- EVM Codes - CODECOPY

