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:0x5c
Introduced: Cancun (EIP-1153)
TLOAD reads from transient storage—a per-transaction key-value store that is automatically cleared when the transaction ends. Unlike persistent storage (SLOAD), transient storage:
- Costs only 100 gas (fixed, no cold/warm metering)
- Is not persisted to blockchain state
- Cannot be accessed by external calls
- Clears automatically at end of transaction
- Reentrancy guards (check/set flags with minimal gas)
- Inter-contract communication within same transaction
- Temporary state without expensive storage costs
Specification
Stack Input:Behavior
TLOAD retrieves the current value from transient storage:- Pop key from stack (256-bit unsigned integer)
- Query host for transient storage value at contract address + key
- Return value from host (0 if never written or cleared by transaction end)
- Push result to stack
- Consume 100 gas (fixed cost, no gas refunds)
- Increment PC
Transient Storage Scope
Transient storage is scoped to:- Per contract: Each contract has separate transient storage
- Per transaction: Automatically cleared when transaction completes
- Not persisted: Does not affect blockchain state
- Not callable: Cannot be read via
eth_getStorageAtoreth_call
Uninitialized Values
Transient storage slots never written return 0:Transaction Boundary
Transient storage is cleared at the end of each transaction:Examples
Basic Transient Read
Reentrancy Guard Pattern
Multiple Values
Transaction Boundary
Inter-Call Communication
Insufficient Gas
Gas Cost
Fixed Cost: 100 gas (always)| Operation | Cost | Notes |
|---|---|---|
| TLOAD | 100 | Fixed, no refunds |
| SLOAD warm | 100 | Same cost but persists |
| SLOAD cold | 2100 | 21x more expensive |
| MLOAD | 3 | 33x cheaper but only in memory |
Edge Cases
Uninitialized Slot
Max Uint256 Key
Hardfork Unavailable
Stack Boundaries
Common Usage
Reentrancy Guard
Callback Data Passing
Temporary Counters
Delegation Pattern
Implementation
- TypeScript
Testing
Test Coverage
Security
Safe in All Contexts
TLOAD is read-only and safe in static calls, constant functions, and any execution context:Reentrancy Guard Effectiveness
Transient storage reentrancy guards are effective because:- State is local to transaction: Attacker cannot bypass guard across transactions
- Atomic updates: Lock + operation + unlock are atomic per call frame
- Automatic cleanup: Guard cleared even if transaction reverts partway
Isolation Between Contracts
Transient storage is isolated per contract address:No Persistence Risk
Unlike persistent storage, transient storage cannot leave dangling state:Benchmarks
Cost comparison:| Operation | Cost | Use Case |
|---|---|---|
| TLOAD | 100 gas | Transaction-scoped reads |
| TSTORE | 100 gas | Transaction-scoped writes |
| SLOAD warm | 100 gas | Persistent reads (persistent) |
| SLOAD cold | 2100 gas | First access (expensive) |
| MLOAD | 3 gas | Memory (local scope) |
| MSTORE | 3 gas | Memory (local scope) |

