Overview
Opcode:0x33
Introduced: Frontier (EVM genesis)
CALLER pushes the address of the immediate caller onto the stack. This is the address that directly invoked the current execution context, changing with each call in the call chain.
Specification
Stack Input:Behavior
CALLER provides the address that made the current call. Unlike ORIGIN which remains constant, CALLER changes with each contract call in the execution chain. Key characteristics:- Changes with each call (CALL, STATICCALL, DELEGATECALL)
- Can be either EOA or contract address
- Used for authentication and access control
- Safe for authorization checks
Examples
Basic Usage
Access Control
Call Chain Tracking
Gas Cost
Cost: 2 gas (GasQuickStep) Same cost as other environment access opcodes:- ADDRESS (0x30): 2 gas
- ORIGIN (0x32): 2 gas
- CALLVALUE (0x34): 2 gas
Common Usage
Ownership Pattern
Access Control Lists
Payment Tracking
Delegation Pattern
Security
CALLER vs ORIGIN
SAFE pattern - use msg.sender (CALLER):DELEGATECALL Context Preservation
Reentrancy Protection
Authorization Checks
Implementation
- TypeScript
Edge Cases
Contract as Caller
Stack Overflow
Out of Gas
Best Practices
✅ DO: Use for access control
✅ DO: Track caller identity
✅ DO: Validate caller
❌ DON’T: Confuse with tx.origin
References
- Yellow Paper - Section 9.3 (Execution Environment)
- EVM Codes - CALLER
- Solidity Docs - msg.sender
- SWC-115: Authorization through tx.origin - Why NOT to use ORIGIN

