---
eip: 7971
label: EIP-7971
title: Hard Limits for Transient Storage
status: Draft
type: Standards Track
category: Core
created: 2025-06-12
requires: 1153
official: https://eips.ethereum.org/EIPS/eip-7971
source: https://github.com/ethereum/EIPs/blob/master/EIPS/eip-7971.md
canonical: https://eips.huatuo.xyz/eip-7971/
lang: en
tldr: Makes TLOAD and TSTORE much cheaper by giving transient storage a hard per-transaction slot limit instead of pricing it like warm storage.
tags: [evm, gas, transient-storage, repricing, core]
---

# EIP-7971: Hard Limits for Transient Storage

> Decrease costs for TLOAD and TSTORE with a transaction-global limit

**TL;DR:** Makes TLOAD and TSTORE much cheaper by giving transient storage a hard per-transaction slot limit instead of pricing it like warm storage.

## What problem does it solve?

[EIP-1153](/eip-1153/) added transient storage: `TSTORE`/`TLOAD` slots that live only for the duration of a transaction. It is ideal for reentrancy locks, temporary approvals and passing data between call frames. But both opcodes cost 100 gas, the same as a warm `SLOAD`, even though transient storage never touches disk or the state root.

At that price, languages are reluctant to add reentrancy guards by default, and developers avoid transient storage for other legitimate uses. The main reason the price is not lower is denial-of-service risk: cheap writes could let one transaction allocate huge amounts of memory.

## How it works

EIP-7971 replaces the price-based protection with a **hard cap**:

| Parameter | Value | Meaning |
| --- | --- | --- |
| `GAS_TLOAD` | 5 | Cost of `TLOAD` (was 100) |
| `GAS_TSTORE` | 12 | Base cost of `TSTORE` (was 100) |
| `GAS_TSTORE_ALLOCATE` | 24 | Extra charge when a slot is written for the first time |
| `MAX_TRANSIENT_SLOTS` | 131072 | Max unique transient slots per transaction |

A counter tracks unique `(contract_address, key)` slots written across **all** contracts in the transaction. Writing the same slot again does not increase it. If the counter exceeds the limit, the transaction halts exceptionally.

The cap bounds transient memory to roughly 8 MB per transaction (131072 × 64 bytes), so clients can reserve it up front. The spec notes that under current 100-gas pricing a 60M gas transaction could allocate about 38.4 MB.

## Sample code

A reentrancy guard that becomes much cheaper under this EIP (Solidity 0.8.28+ supports `transient` state variables):

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

abstract contract TransientGuard {
    bool transient locked;

    modifier nonReentrant() {
        require(!locked, "reentrant");
        locked = true;   // TSTORE: 100 gas today, 12 (+24 first write) proposed
        _;
        locked = false;
    }
}
```

The client-side rule, from the reference implementation:

```python
def tstore(ctx, address, key, value):
    ctx.charge_gas(GAS_TSTORE)
    slot = (address, key)
    if slot not in ctx.unique_slots:
        ctx.charge_gas(GAS_TSTORE_ALLOCATE)
        ctx.unique_slots.add(slot)
        if len(ctx.unique_slots) > MAX_TRANSIENT_SLOTS:
            raise ExceptionalHalt("transient storage limit exceeded")
    ctx.transient_storage[slot] = value
```

## Things to know

- **Status: Draft.** The gas numbers are explicitly not final and await benchmarks; the authors say they should stay consistent with [EIP-8038](/eip-8038/).
- The Glamsterdam repricing directory, [EIP-8007](/eip-8007/), lists this EIP as declined for inclusion in that fork.
- A transaction that legitimately writes more than 131072 unique transient slots would fail under this rule; typical uses need only a handful.
- No other behaviour of transient storage changes: values are still cleared at the end of the transaction and reverted with their call frame.


---

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