Overview
Opcode:0xfa
Introduced: Byzantium (EIP-214)
STATICCALL executes code from another account with state modification restrictions enforced. Any attempt to modify state (SSTORE, CREATE, CALL with value, SELFDESTRUCT, LOG, etc.) reverts the entire call. This enables secure read-only operations and implements Solidity’s view and pure function semantics.
Specification
Stack Input:Behavior
STATICCALL performs a read-only external call with state protection:- Pop 6 stack arguments (no value parameter)
- Calculate gas cost:
- Base: 700 gas (Tangerine Whistle+)
- Cold access: +2,600 gas for first access (Berlin+)
- Memory expansion for input and output regions
- Read calldata from memory
- Forward gas: Up to 63/64 of remaining gas (EIP-150)
- Execute in callee context with static flag:
- msg.sender = caller address
- msg.value = 0 (always zero!)
- Storage = callee’s storage (READ-ONLY)
- Code = callee’s code
- is_static = true (inherited by child calls)
- Enforce read-only restrictions:
- SSTORE reverts (storage modification)
- CREATE/CREATE2 revert (contract creation)
- CALL with value > 0 reverts (ETH transfer)
- SELFDESTRUCT reverts (account deletion)
- LOG0-LOG4 revert (event emission)
- Copy returndata to memory
- Set return_data buffer
- Push success flag
- Refund unused gas
- No value transfer (msg.value always 0)
- State modifications forbidden (enforced recursively)
- Safe for untrusted code execution
- Foundation for view/pure functions
Examples
Basic Static Call
View Function Call
Multi-token Reader
Safe Untrusted Call
Price Oracle Reader
Gas Cost
Total cost: 700 + cold_access + memory_expansion + forwarded_gasBase Cost: 700 gas (Tangerine Whistle+)
Pre-Tangerine Whistle: STATICCALL didn’t exist (introduced Byzantium).No Value Transfer Cost
STATICCALL never transfers value:Cold Access: +2,600 gas (Berlin+)
EIP-2929 (Berlin+): First access to target address:Memory Expansion
Same as CALL - charges for both input and output regions:Gas Forwarding (EIP-150)
63/64 rule applies:Example Calculation
Common Usage
Safe Contract Query
View Function Multicall
Contract Existence Check
Security
State Modification Prevention
STATICCALL enforces read-only semantics:- SSTORE (storage write)
- CREATE/CREATE2 (contract creation)
- CALL with value > 0 (ETH transfer)
- SELFDESTRUCT (account deletion)
- LOG0-LOG4 (event emission)
Read-Only Guarantee
STATICCALL guarantees no state changes:Gas Limit Attacks
Callee still controls gas consumption:Returndata Bomb
Large returndata can cause OOG when copying:Reentrancy (Still Possible!)
Read-only reentrancy is possible:Implementation
- TypeScript
References
- Yellow Paper - Section 9.4.4 (STATICCALL)
- EIP-214 - STATICCALL opcode and static mode
- EIP-150 - Gas cost changes (63/64 rule)
- EIP-2929 - Access list gas costs
- evm.codes - STATICCALL - Interactive reference
- Solidity Docs - View and pure functions

