---
eip: 1153
label: EIP-1153
title: Transient storage opcodes
status: Final
type: Standards Track
category: Core
created: 2018-06-15
requires: 2200, 3529
official: https://eips.ethereum.org/EIPS/eip-1153
source: https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1153.md
canonical: https://eips.huatuo.xyz/eip-1153/
lang: en
tldr: Adds TLOAD and TSTORE, a storage-like key/value space that is wiped at the end of every transaction, making reentrancy locks and in-transaction callbacks cheap.
tags: [evm, opcodes, storage, gas, cancun]
---

# EIP-1153: Transient storage opcodes

> Add opcodes for manipulating state that behaves almost identically to storage but is discarded after every transaction

**TL;DR:** Adds TLOAD and TSTORE, a storage-like key/value space that is wiped at the end of every transaction, making reentrancy locks and in-transaction callbacks cheap.

## What problem does it solve?

A single transaction can run through many nested calls, and the same contract can be re-entered several times. Those call frames often need to share a bit of state: "am I already inside this function?" for a reentrancy lock, "how much does the caller owe me so far?" for a flash-swap style callback.

Before this EIP the only shared place was regular storage (`SSTORE`/`SLOAD`). That is expensive, and since [EIP-3529](/eip-3529/) refunds for clearing a slot are capped at 20 % of the transaction's gas, so the "set then reset" pattern rarely gets its money back. Passing values through calldata does not work when an untrusted contract sits in the middle of the call chain.

## How it works

Two new opcodes:

| Opcode | Byte | Stack | Gas |
| --- | --- | --- | --- |
| `TLOAD` | `0x5c` | `key → value` | 100 (like a warm `SLOAD`) |
| `TSTORE` | `0x5d` | `key, value →` | 100 (like a warm `SSTORE` of a dirty slot) |

- Addressing is the same as storage: each contract has its own map of 32-byte keys to 32-byte values.
- **Everything is discarded at the end of the transaction.** Nothing ever touches disk, so there are no cold/warm surprises and no refunds.
- It is private to the contract, like storage. Under `DELEGATECALL`/`CALLCODE` the caller's transient storage is used; under `CALL`/`STATICCALL` the callee's.
- If a call frame reverts, its transient writes (including those of inner calls) are reverted too.
- `TSTORE` inside a `STATICCALL` throws; `TLOAD` is allowed.
- Unlike `SSTORE`, `TSTORE` does not have the [EIP-2200](/eip-2200/) rule that fails when only the 2,300-gas stipend is left.

Use cases listed in the spec include reentrancy locks, single-transaction ERC-20 approvals, "till" patterns that check balances are settled at the end of a callback, and passing metadata to proxies without calldata.

## Sample code

A reentrancy guard using transient storage (Solidity inline assembly, 0.8.24 or later):

```solidity
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;

abstract contract TransientReentrancyGuard {
    // Any fixed slot works; it is cleared automatically after the tx.
    bytes32 private constant LOCK = keccak256("example.reentrancy.lock");

    modifier nonReentrant() {
        bytes32 slot = LOCK;
        assembly {
            if tload(slot) { revert(0, 0) }
            tstore(slot, 1)
        }
        _;
        assembly {
            tstore(slot, 0) // reset so later calls in the same tx work
        }
    }
}

contract Vault is TransientReentrancyGuard {
    mapping(address => uint256) public balance;

    function withdraw(uint256 amount) external nonReentrant {
        balance[msg.sender] -= amount;
        (bool ok, ) = msg.sender.call{value: amount}("");
        require(ok);
    }
}
```

## Things to know

- **Final** and live on Ethereum Mainnet since the Cancun upgrade (Dencun), together with other EVM changes such as `MCOPY` ([EIP-5656](/eip-5656/)).
- "Transient" means per **transaction**, not per call. Values survive across calls within the same transaction, so reset slots you rely on (e.g. a lock) instead of assuming they start at zero on the next call.
- Do not use it as a substitute for memory: memory is cleared when a call returns, transient storage is not, which can cause surprising behaviour on reentrancy.
- Newer Solidity versions also offer a `transient` keyword for state variables; check your compiler version and EVM target before relying on it.
- [EIP-7609](/eip-7609/) proposed lowering the cost of these opcodes further, but it is Stagnant.


---

This is an unofficial plain-language summary. Read the full specification: https://eips.ethereum.org/EIPS/eip-1153
