Free 30-min Web3 Consultation
Book Consultation
Smart Contract Security Audits
View Audit Services
Custom DeFi Protocol Development
Explore DeFi
Full-Stack Web3 dApp Development
View App Services
Free 30-min Web3 Consultation
Book Consultation
Smart Contract Security Audits
View Audit Services
Custom DeFi Protocol Development
Explore DeFi
Full-Stack Web3 dApp Development
View App Services
Free 30-min Web3 Consultation
Book Consultation
Smart Contract Security Audits
View Audit Services
Custom DeFi Protocol Development
Explore DeFi
Full-Stack Web3 dApp Development
View App Services
Free 30-min Web3 Consultation
Book Consultation
Smart Contract Security Audits
View Audit Services
Custom DeFi Protocol Development
Explore DeFi
Full-Stack Web3 dApp Development
View App Services
LABS
Glossary

Transient Storage

Transient storage is a type of Ethereum Virtual Machine (EVM) storage designed for temporary data that only persists for the duration of a single transaction, offering significant gas savings compared to persistent storage.
Chainscore © 2026
definition
EVM OPCODE

What is Transient Storage?

Transient storage is a new, gas-efficient storage type in the Ethereum Virtual Machine (EVM) designed for temporary data that exists only for the duration of a single transaction.

Transient storage is a key feature introduced in Ethereum's Cancun-Deneb (Dencun) upgrade via EIP-1153. It provides a dedicated data area within the EVM, accessible via the new TLOAD and TSTORE opcodes, where smart contracts can write and read data that is automatically discarded after the transaction ends. Unlike persistent storage (accessed via SLOAD/SSTORE), which modifies the blockchain state permanently, transient storage offers a gas-efficient and revert-safe mechanism for temporary data, such as reentrancy locks or intermediate computation values that do not need to be stored long-term.

The primary technical advantage of transient storage is its gas cost model. Writes (TSTORE) and reads (TLOAD) have a fixed, low gas cost, unlike persistent storage which has complex costs for initial writes, refunds, and cold/warm access. This makes it ideal for patterns like reentrancy guards, where a contract must set a temporary flag for the duration of an external call. Using transient storage for this purpose is cheaper and simpler than using storage slots, as the flag is automatically cleared on transaction completion, regardless of whether the transaction reverts or succeeds.

A canonical use case is implementing a reentrancy lock. A contract can store a flag in transient storage at the start of a sensitive function using TSTORE. If a reentrant call is attempted, the function checks this flag with TLOAD and reverts. Since the data is scoped to the transaction, it cannot be accessed by other transactions, and there is no need for a separate operation to clear the flag, eliminating a potential source of bugs. This pattern is more efficient than the common nonReentrant modifier which uses persistent storage.

Transient storage is ephemeral and transaction-scoped. Data is not recorded in the Ethereum state trie and is not accessible to other transactions or blocks. This design makes it unsuitable for any data that must persist, such as token balances or governance settings. Its behavior is similar to memory (MLOAD/MSTORE) in its temporality but differs in key aspects: it is accessible across internal calls and call contexts within the same transaction, and its gas costs are constant, unlike memory which has expanding costs.

For developers, adopting transient storage involves using the new opcodes directly in assembly or through libraries like OpenZeppelin that provide abstractions. It is a foundational primitive for optimizing contract execution, particularly in complex DeFi protocols that perform multiple internal calls. By providing a dedicated location for temporary state, EIP-1153's transient storage reduces gas costs, simplifies contract logic for certain patterns, and enhances the overall security and efficiency of the EVM execution layer.

how-it-works
EVM MECHANISM

How Transient Storage Works

Transient storage is a new, temporary data location in the Ethereum Virtual Machine (EVM) designed for gas-efficient, single-transaction data handling.

Transient storage is a data location within the Ethereum Virtual Machine (EVM), introduced via EIP-1153, that provides temporary storage scoped to the duration of a single transaction. Unlike persistent storage in storage, data in transient storage (accessed via the tstore and tload opcodes) is automatically discarded after the transaction ends, whether it succeeds or reverts. This makes it ideal for passing intermediate data between internal calls within a transaction without incurring the high gas costs of sstore or the limitations of memory. Its primary design goals are gas efficiency and reversion safety, as its state changes are never persisted to the blockchain.

The mechanism operates through two new opcodes: tstore (transient store) writes a 256-bit word to a specified slot, and tload (transient load) reads from one. These slots are unique to the contract that creates them, preventing cross-contract interference. A key technical distinction from memory is that transient storage is mutable and shared across all nested internal calls and delegations within a transaction, acting like a global variable for that execution context. This is crucial for patterns like reentrancy locks or fee-on-transfer calculations, where a value must be accessible and modifiable by deeply nested logic without being lost on internal reverts.

From an implementation perspective, transient storage is held in the EVM's execution context, not in the world state. This means it does not affect the Merkle Patricia Trie or require costly state updates. Its gas cost is minimal and fixed, similar to memory expansion, contrasting sharply with sstore's complex pricing based on whether a slot is cold, warm, or dirty. This predictable, low-cost model enables new contract architectures, allowing developers to use storage-like semantics for temporary data without the associated financial overhead, fundamentally changing gas optimization strategies for complex transaction flows.

key-features
EIP-1153

Key Features of Transient Storage

Transient storage is a new storage type introduced by Ethereum Improvement Proposal 1153, designed for temporary, transaction-scoped data that is automatically cleared after execution.

01

Transaction-Scoped Lifetime

Data stored in the tstore operation persists only for the duration of a single transaction. It is automatically and gaslessly cleared at the end of the transaction's execution, regardless of success or failure. This eliminates the need for manual cleanup and associated gas costs, making it ideal for temporary data like reentrancy locks, intermediate computation results, or data passed between internal calls.

02

Gas Efficiency & Cost Savings

Transient storage provides significant gas savings compared to persistent storage (sstore). Writing (tstore) and reading (tload) cost only 100 gas each, mirroring warm storage access. The key savings come from zero-cost cleanup; deleting persistent storage via sstore to 0 costs gas, while tstore cleanup is free. This makes it optimal for data that is written and deleted within the same transaction.

03

Access Model & Addressability

Transient storage is accessed via two new EVM opcodes: TLOAD (0x5c) to read and TSTORE (0x5d) to write. It is a key-value store mapped per contract address, similar to storage slots. The data is private to the contract that writes it and is accessible across all internal calls, delegate calls, and static calls within the same transaction, but not to other externally called contracts.

04

Use Case: Reentrancy Guards

A primary use case is implementing efficient reentrancy locks. Instead of using a persistent storage variable (which costs gas to set and clear), a contract can use a transient storage flag.

  • Set flag: tstore(lock_slot, 1) at function entry.
  • Check flag: tload(lock_slot) to prevent reentrancy.
  • Automatic clear: The flag is auto-reset to 0 after the transaction, saving the ~5,000 gas for an sstore to clear it.
05

Use Case: Optimized Computations

Transient storage is ideal for caching intermediate results within complex, multi-call transactions. For example, in a DeFi swap involving multiple pools:

  • Calculate and store a best-path fee in transient storage during an initial assessment.
  • Subsequent internal calls can tload this value without recalculating.
  • The cached data is automatically discarded, avoiding the gas cost of writing and later clearing a persistent storage variable.
06

Comparison with Memory & Storage

  • vs. Memory (memory): Transient storage persists across internal calls; memory does not. It's for data shared between calls within a tx.
  • vs. Storage (storage): Storage is persistent across transactions and costs ~20,000 gas for a cold sstore and ~5,000 gas to clear. Transient storage is temporary and has no cleanup cost.
  • vs. Call Context: Data in transient storage is accessible in delegate calls, unlike call context variables like msg.sender.
etymology-history
ORIGINS

Etymology and History

The concept of transient storage in blockchain emerged as a direct solution to a specific, costly inefficiency in smart contract design, evolving from academic proposal to a core feature in a major network upgrade.

The term transient storage was formally introduced to the Ethereum ecosystem through Ethereum Improvement Proposal EIP-1153 by Vitalik Buterin and industry researchers. Its etymology is straightforward: transient denotes something temporary or impermanent, which precisely describes the storage type's lifecycle—it exists only for the duration of a single transaction. This contrasts with traditional contract storage (often called persistent storage or SSTORE/SLOAD space), where data is written permanently to the blockchain state, incurring significant gas costs.

The historical impetus for EIP-1153 was the prohibitive expense of certain common smart contract patterns. Operations like reentrancy locks, function parameters, and ephemeral data required the use of persistent storage, leading to high gas fees for writing and, crucially, for clearing the storage slot back to zero. Transient storage, implemented via new opcodes TSTORE and TLOAD, provided a gas-efficient scratchpad that automatically discards data after execution, eliminating refund mechanics and reducing attack surface related to gas token manipulations.

The proposal underwent extensive community review and testing for several years before being included in the Dencun network upgrade in March 2024. Its adoption marks a significant evolution in the Ethereum Virtual Machine (EVM), providing developers with a fundamental new primitive. The history of transient storage is a case study in protocol improvement driven by developer pain points, aiming to reduce costs and enable more complex, efficient smart contracts without altering the foundational security model of persistent state.

EIP-1153

Transient Storage vs. Other EVM Storage Types

A technical comparison of storage types in the Ethereum Virtual Machine, highlighting the operational characteristics and cost structures of each.

Feature / MetricTransient Storage (tstore/tload)Contract Storage (sstore/sload)Memory (mstore/mload)Calldata

Primary Use Case

Single-transaction ephemeral data

Persistent contract state

Short-term execution workspace

Immutable transaction input data

Persistence

Gas Cost (Write)

100 gas (static)

20,000 gas (cold) / 2,900 gas (warm)

3 gas (base) + expansion

0 gas (read-only input)

Gas Cost (Read)

100 gas (static)

2,100 gas (cold) / 100 gas (warm)

3 gas

3-68 gas (depends on offset)

Access Scope

Current execution context

Global contract state

Current function call

Current function call

Data Lifetime

Single transaction

Indefinite (on-chain)

Single function execution

Single transaction

Re-entrancy Safety

Automatically cleared on revert

Persists across re-entrant calls

Not applicable

Not applicable

EVM Opcodes

TLOAD, TSTORE

SLOAD, SSTORE

MLOAD, MSTORE, MSTORE8

CALLDATALOAD, CALLDATACOPY

primary-use-cases
TRANSIENT STORAGE

Primary Use Cases and Examples

Transient storage, introduced in Ethereum's Cancun-Deneb upgrade, provides a temporary, gas-efficient data location for a single transaction. Its primary applications are in complex contract interactions where data is needed only during execution.

01

Reentrancy Lock Flags

The canonical use case for transient storage is implementing reentrancy guards. A contract can store a lock flag in a transient storage slot that is automatically cleared after the transaction ends, regardless of success or failure. This eliminates the gas cost of manually resetting the flag in storage and prevents leftover state that could block future calls.

  • Gas Savings: No SSTORE needed to clear the 0->1->0 pattern.
  • Safety: Flag is auto-reset, removing a potential bug vector.
02

Single-Transaction Context Passing

Transient storage acts as a shared memory space for all contracts within a transaction's call chain. This is ideal for passing contextual data like:

  • Original msg.sender through a series of proxy or wrapper contracts.
  • Flash loan fees or specific parameters that only need to persist for the duration of the loan's execution.
  • Oracle data that is fetched once and shared across multiple internal calls, avoiding repeated storage reads.
03

Gas-Efficient AMM Swaps

Automated Market Makers (AMMs) can use transient storage to track intermediate state during complex multi-pool swaps (e.g., Uniswap V3). Data like the remaining input amount or the current fee tier can be held in tstore and tload operations, which are significantly cheaper than their persistent storage counterparts. This reduces the overall gas overhead for users performing multi-hop trades.

05

Comparison to Memory & Storage

Transient Storage sits between memory and storage in terms of persistence and cost:

  • Memory (MLOAD/MSTORE): Cheapest, but scoped to a single contract call frame. Cannot be accessed by other contracts in the call chain.
  • Transient Storage (TLOAD/TSTORE): Moderately priced, persists for the full transaction and is accessible across all call frames. Auto-cleared post-transaction.
  • Persistent Storage (SLOAD/SSTORE): Most expensive, persists forever on-chain. Requires payment for state growth.
06

MEV & Arbitrage Bots

Maximal Extractable Value (MEV) searchers and arbitrage bots benefit from transient storage for organizing complex, multi-contract bundle transactions. It allows them to:

  • Pass profitability calculations and routing paths between contracts.
  • Set temporary permissions or flags for specific actions within the bundle.
  • Reduce the gas footprint of their strategies, making marginally profitable opportunities viable.
ecosystem-usage
TRANSIENT STORAGE

Ecosystem Usage and Adoption

Transient storage, introduced via EIP-1153, is a new EVM storage type designed for temporary, single-transaction data. Its primary adoption driver is significant gas cost reduction for complex smart contract operations.

01

Gas Cost Reduction

The primary benefit of transient storage is gas efficiency. Unlike persistent storage (SSTORE), which incurs high costs for clearing slots, transient storage (TSTORE/TLOAD) is automatically cleared after a transaction, eliminating refund mechanisms and slashing gas costs for temporary data by up to 100x in specific patterns like reentrancy locks and function call contexts.

02

Reentrancy Guards

A canonical use case is implementing reentrancy protection. Instead of using a persistent storage flag (costly to reset), contracts can use a transient storage variable. This flag is automatically set to 1 on entry and cleared to 0 upon transaction completion, providing robust security with minimal gas overhead. This pattern is now recommended in the Solidity documentation.

03

Multi-Call & DelegateCall Contexts

Transient storage is ideal for passing data through a chain of internal calls or delegatecall proxies within a single transaction. It acts as a temporary, shared memory space that is:

  • Scoped to the transaction and current contract execution context.
  • Automatically cleaned, preventing storage bloat.
  • Gas-cheap for intermediate state in complex operations like meta-transactions or flash loans.
04

EIP-1153 & Network Adoption

EIP-1153 standardizes the TSTORE and TLOAD opcodes. Major networks have adopted it, creating a new standard for efficient contract design:

  • Ethereum Mainnet: Activated in the Pectra upgrade.
  • L2 Rollups: Widely available on Arbitrum, Optimism, Base, and zkSync Era.
  • Other EVMs: Supported by Polygon PoS, BSC, and Avalanche C-Chain. This broad support ensures developer portability and consistent gas savings.
05

Comparison to Memory & Storage

Transient storage (t_store) occupies a unique design space between memory and persistent storage:

  • vs. Memory (memory): Transient storage is accessible across nested internal calls and delegatecall, while memory is call-context limited.
  • vs. Storage (storage): Transient storage is wiped post-transaction with no gas cost for clearing, unlike persistent storage which requires an expensive SSTORE to zero out. It is a mutable, transaction-scoped data location.
06

Implementation in Solidity

Solidity ^0.8.24 introduced the t_store data location. Developers declare variables with t_store and use the TSTORE and TLOAD opcodes via assembly or future high-level syntax. Example use includes:

  • Flash loan fee parameters passed to a callback.
  • Auction bid data during a single transaction.
  • Optimistic approval flags for batched operations. The feature requires compiler support and network activation.
TRANSIENT STORAGE

Technical Deep Dive

Transient storage is a new opcode introduced in Ethereum's Cancun-Deneb upgrade (EIP-1153) that provides a temporary, scoped storage location for smart contracts, designed specifically for gas-efficient, single-transaction data handling.

Transient storage is a temporary, scoped data storage location for smart contracts, implemented via the TSTORE and TLOAD opcodes, where data persists only for the duration of a single transaction. It operates similarly to regular storage (SSTORE/SLOAD) but is automatically cleared after the transaction ends, regardless of success or failure. This mechanism is ideal for passing data between internal calls within a transaction, such as reentrancy locks, temporary calculations, or proxy contract contexts, without incurring the high gas costs of permanent storage writes or the complexities of memory management.

Key Mechanism:

  • Data is stored at a 256-bit key within a contract's address space.
  • It is accessible only to the contract that wrote it and its internal calls.
  • No refunds or gas costs are associated with clearing the data, as it happens automatically post-execution.
security-considerations
TRANSIENT STORAGE

Security Considerations and Best Practices

Transient storage, introduced via the TSTORE and TLOAD opcodes in EIP-1153, provides a gas-efficient, ephemeral data store for a single transaction. Its unique lifecycle creates distinct security patterns compared to persistent storage.

01

Reentrancy Protection

Transient storage is a powerful tool for reentrancy guards. A contract can set a flag in transient storage at the start of a sensitive function and clear it at the end. Because the data is automatically cleared after the transaction, it is immune to cross-function reentrancy attacks that exploit leftover state in persistent storage. This simplifies the classic "checks-effects-interactions" pattern.

  • Example: Setting tstore(REENTRANCY_GUARD_SLOT, 1) on entry and tstore(REENTRANCY_GUARD_SLOT, 0) on exit.
02

Avoiding State Pollution

A key security benefit is preventing state pollution from failed sub-calls. Intermediate values passed between internal functions or to external contracts during a complex transaction can be stored transiently. If a sub-call reverts, the transient storage is still cleared, ensuring no garbage data persists in the contract's permanent state, which could be exploited in future transactions.

03

Single-Transaction Context

The security model is defined by the single-transaction lifecycle. Data is only accessible within the scope of the originating external call and its entire internal call chain. This makes it ideal for:

  • Flash loan fee calculations that must be remembered across multiple operations but not persisted.
  • Multi-step governance operations where votes or approvals are tallied and executed atomically.
  • Delegatecall proxy contexts, where it avoids storage collisions between the proxy and implementation.
04

Not for Persistent Data

A critical security consideration is that transient storage must never be used for data that needs to persist beyond the current transaction. This includes:

  • User balances or ownership records.
  • Configuration settings or protocol parameters.
  • Any data that must be queryable off-chain via events or static calls. Mistaking it for persistent storage is a severe vulnerability that will lead to permanent data loss.
05

Gas Cost Implications

Transient storage operations (TSTORE, TLOAD) have a fixed, low gas cost, unlike the high and variable costs of SSTORE. This changes the economic calculus for attack vectors. While it reduces the cost of secure patterns (like reentrancy guards), auditors must also consider that cheap writes could enable new forms of gas-griefing attacks within a transaction's call depth, though the impact is limited to that transaction.

06

Audit & Testing Focus

Smart contract audits must now specifically review the use of tstore/tload. Key areas for auditors and developers to test:

  • Correct Lifecycle Assumption: Verify data is not expected to persist.
  • Slot Management: Ensure no unintended slot collisions between different internal functions.
  • Integration with Upgrades: In upgradeable proxies, confirm transient storage slots are managed consistently across versions.
  • Fuzzing Invariants: Include properties that state all transient storage slots must be zero at the start and end of a transaction in invariant tests.
TRANSIENT STORAGE

Common Misconceptions

Transient storage, introduced by EIP-1153, is a new storage location in the EVM. It is designed for temporary data that only needs to exist for the duration of a single transaction. This section clarifies frequent misunderstandings about its purpose, behavior, and interaction with other EVM components.

No, transient storage is a distinct storage location with different semantics and cost structure than memory. While both are temporary, transient storage (TSTORE/TLOAD) persists across all internal calls and reverts within a transaction, making it ideal for reentrancy locks and temporary state that must survive nested execution. Memory is call-context scoped and cheaper for simple computation but is wiped on internal calls. The primary cost advantage of transient storage is that it has no persistent storage gas overhead, unlike SSTORE, but it is not intended to replace memory for data that doesn't need cross-call persistence.

TRANSIENT STORAGE

Frequently Asked Questions (FAQ)

Common questions about EIP-1153's transient storage opcodes, `TLOAD` and `TSTORE`, which provide a gas-efficient, scoped alternative to contract storage.

Transient storage is a new storage location for smart contracts, introduced by EIP-1153, that exists only for the duration of a single transaction. It is accessed via the TLOAD and TSTORE opcodes and is automatically cleared after the transaction ends, providing a gas-efficient way to pass data between internal calls without the permanent cost and state bloat of standard storage (SLOAD/SSTORE). Its primary use case is for temporary, scoped data like reentrancy locks, function call contexts, and intermediate computation results that do not need to persist on-chain.

ENQUIRY

Get In Touch
today.

Our experts will offer a free quote and a 30min call to discuss your project.

NDA Protected
24h Response
Directly to Engineering Team
10+
Protocols Shipped
$20M+
TVL Overall
NDA Protected Directly to Engineering Team
Transient Storage: EVM Temporary Data Explained | ChainScore Glossary