Skip to main content
This page is a placeholder. All examples on this page are currently AI-generated and are not correct. This documentation will be completed in the future with accurate, tested examples.

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
Primary use cases:
  • Reentrancy guards (check/set flags with minimal gas)
  • Inter-contract communication within same transaction
  • Temporary state without expensive storage costs

Specification

Stack Input:
Stack Output:
Gas Cost: 100 (fixed, EIP-1153) Hardfork: Cancun+ (unavailable on earlier hardforks) Operation:

Behavior

TLOAD retrieves the current value from transient storage:
  1. Pop key from stack (256-bit unsigned integer)
  2. Query host for transient storage value at contract address + key
  3. Return value from host (0 if never written or cleared by transaction end)
  4. Push result to stack
  5. Consume 100 gas (fixed cost, no gas refunds)
  6. 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_getStorageAt or eth_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)
OperationCostNotes
TLOAD100Fixed, no refunds
SLOAD warm100Same cost but persists
SLOAD cold210021x more expensive
MLOAD333x cheaper but only in memory
Comparison:
TLOAD bridges the gap—costs same as warm SLOAD but doesn’t persist or refund.

Edge Cases

Uninitialized Slot

Max Uint256 Key

Hardfork Unavailable

Stack Boundaries

Common Usage

Reentrancy Guard

Gas savings: Using transient storage (200 gas total: 100 read + 100 write) vs persistent storage (20000+ gas).

Callback Data Passing

Temporary Counters

Delegation Pattern

Implementation

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:
  1. State is local to transaction: Attacker cannot bypass guard across transactions
  2. Atomic updates: Lock + operation + unlock are atomic per call frame
  3. 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:
OperationCostUse Case
TLOAD100 gasTransaction-scoped reads
TSTORE100 gasTransaction-scoped writes
SLOAD warm100 gasPersistent reads (persistent)
SLOAD cold2100 gasFirst access (expensive)
MLOAD3 gasMemory (local scope)
MSTORE3 gasMemory (local scope)
Practical gas savings (reentrancy guard):

References