Overview
Storage instructions provide persistent and transient data access for smart contracts. The EVM supports two distinct storage scopes: Persistent Storage (SLOAD/SSTORE)- Contract state maintained across transactions
- Account-specific storage per contract instance
- Complex gas metering with refunds (EIP-2200, EIP-2929, EIP-3529)
- Cold/warm access tracking for gas optimization
- Transaction-scoped temporary storage (Cancun, EIP-1153)
- Cleared at end of transaction, not persisted
- Fixed 100 gas cost (no refunds, no access tracking)
- Common for reentrancy guards and local state
Instructions
Storage Model
Persistent Storage
Each contract account has a key-value store mapping 256-bit keys to 256-bit values:- Committed to blockchain state
- Persisted across transactions and blocks
- Accessible to all transactions and external callers
- Refundable when clearing slots (EIP-3529)
Transient Storage
Similar structure but transaction-scoped and cleared automatically:- Reentrancy protection (guard flags)
- Call context passing (inter-contract communication)
- Temporary work variables
- Avoiding expensive storage refunds
Gas Costs
SLOAD (Persistent Read)
Cold/warm tracking per transaction. First access to a slot: cold (2100). Subsequent accesses: warm (100).
SSTORE (Persistent Write)
Complex metering based on current/original values and access history:
EIP-2200 Rules (Istanbul+):
- Sentry: SSTORE requires >= 2300 gas remaining
- Gas varies by current vs original value
- Refunds only 4800 per cleared slot (EIP-3529 reduced from 15000)
TLOAD/TSTORE (Transient)
Fixed 100 gas each, no gas refunds, no access tracking.Common Patterns
Persistent Storage Patterns
State management:Transient Storage Patterns
Reentrancy guard:See Also
- SLOAD (0x54) - Persistent storage read
- SSTORE (0x55) - Persistent storage write
- TLOAD (0x5c) - Transient storage read
- TSTORE (0x5d) - Transient storage write
- EIP-2929: Gas-cost increases for state access opcodes
- EIP-2200: Structured Definitions for Net Gas Metering
- EIP-3529: Reduction in refunds
- EIP-1153: Transient storage opcodes

