Documentation Index
Fetch the complete documentation index at: https://voltaire.tevm.sh/llms.txt
Use this file to discover all available pages before exploring further.
Overview
Opcode:0x54
Introduced: Frontier (EVM genesis)
Updated: Berlin (EIP-2929, cold/warm tracking)
SLOAD reads a 256-bit value from an account’s persistent storage. The gas cost depends on whether the storage slot was previously accessed in the transaction (warm) or not (cold).
This operation is essential for reading contract state: balances, permissions, prices, and any data that must persist across transactions.
Specification
Stack Input:- 100 gas - Warm access (already accessed in transaction)
- 2100 gas - Cold access (first access, EIP-2929)
Behavior
SLOAD retrieves the current value stored at a key in the calling contract’s account storage:- Pop key from stack (256-bit unsigned integer)
- Query host for storage value at contract address + key
- Return value from host (0 if slot never written or cleared)
- Push result to stack
- Track access for cold/warm metering (EIP-2929)
- Increment PC
Cold vs Warm Access
First access in transaction (cold): 2100 gasUninitialized Slots
Slots never written return 0:Examples
Basic Storage Read
Cold Access Tracking
Mapping Access
Nested Structures
Gas Cost
Cost Matrix:| Access Type | Gas | EIP | Notes |
|---|---|---|---|
| Warm | 100 | EIP-2929 | Seen before in transaction |
| Cold | 2100 | EIP-2929 | First access in transaction |
| Pre-warmed | 100 | EIP-2930 | Via access list |
Edge Cases
Uninitialized Slot
Max Uint256 Value
Stack Boundaries
Insufficient Gas
Common Usage
State Variable Access
Mapping Lookups
Multi-Read Optimization
Access List Warm-up
Implementation
- TypeScript
Testing
Test Coverage
Security
State Immutability During Reads
SLOAD is read-only and safe in any context (even static calls). It cannot modify state, only query it:Reentrancy Vulnerability (When Used with State Changes)
SLOAD itself is safe, but reading and then writing creates reentrancy windows:Access List Validation
Ensure access lists match actual storage accessed:Gas Cost Variation
Cold/warm access affects gas accounting for batch operations:Benchmarks
Access cost comparison:- Warm SLOAD: 100 gas
- Cold SLOAD: 2100 gas (21x more expensive)
- MLOAD (memory): 3 gas (67x cheaper than warm)
- L1 cache: ~0.5ns vs ~100ns for cold storage
References
- EVM Codes - SLOAD (0x54)
- EIP-2929: Gas-cost increases for state access opcodes
- EIP-2930: Optional access lists
- Yellow Paper - Section 9.3 (Account Storage)
- Solidity Storage Layout

