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: 0x37
Introduced: Frontier (EVM genesis)
CALLDATACOPY copies a specified range of call data bytes to memory. Out-of-bounds bytes are zero-padded.
Specification
Stack Input:
Stack Output:
Gas Cost: 3 + memory expansion + (length / 32) * 3 (rounded up)
Operation:
Behavior
Copies length bytes from calldata starting at offset to memory starting at destOffset. Zero-pads if calldata bounds exceeded.
Examples
Basic Copy
Proxy Pattern
Gas Cost
Base: 3 gas
Memory expansion: Variable
Copy cost: 3 gas per 32-byte word (rounded up)
Common Usage
Forwarding Calls
Security
Bounds Validation
Check offsets don’t overflow when adding length.
Implementation
References