Introduction
Hi, I'm cardene, a software engineer and technical writer focused on blockchain and AI.
I've also authored Japanese technical books on specification-driven development with LLMs and decentralized application (DApp) development.
I also build and publish a variety of tools, libraries, and open-source projects.
This article examines EIP-7971, a proposal to substantially reduce the gas costs of transient storage operations, TLOAD and TSTORE, while imposing a transaction-wide hard slot limit to mitigate denial-of-service (DoS) attacks.
The following explanation is based on the original proposal as discussed in the article published on March 22, 2026. The proposed parameters are not presented as activated network rules.
I also cover a range of other EIPs, BIPs, SLIPs, CAIPs, ENSIPs, RFCs, and ACPs.
Overview
EIP-7971 proposes reducing the gas costs of transient storage, introduced by EIP-1153, while imposing a hard limit on the number of distinct slots allocated across an entire transaction. Transient storage exists only during transaction execution.
For more on EIP-1153, see the following article.
[EIP-1153] Understanding Transient Storage in the EVM
Unlike persistent storage, transient storage requires neither disk writes nor state root updates.
Nevertheless, under the existing pricing discussed in the proposal, its operations cost 100 gas, the same price as a warm persistent-storage read.
EIP-7971 proposes correcting this pricing mismatch by reducing TLOAD to 5 gas and the base cost of TSTORE to 12 gas.
Lower gas costs increase the risk of memory-exhaustion DoS attacks through the allocation of large numbers of slots. To address this, the proposal limits the number of distinct slots used across a transaction to 131,072. Under the article's memory accounting assumptions, this caps the corresponding storage footprint at approximately 8 MB.
Motivation
The cost of reentrancy protection
Reentrancy, in which a contract's function is called again during an external call, is one of the most familiar smart contract vulnerability patterns.
Transient storage can be used to implement a reentrancy lock, but acquiring the lock (TSTORE), checking it (TLOAD), and releasing it (TSTORE) costs at least 300 gas at 100 gas per operation.
Reentrancy attacks
A reentrancy attack involves calling back into a contract while that contract is executing an external call. If the external call occurs before the relevant balance is updated, a vulnerable contract may permit repeated withdrawals before its accounting reflects the first withdrawal.
This overhead has been an obstacle to language-level support for enabling reentrancy protection by default in all contracts.
Under EIP-7971, the base cost of TSTORE would be 12 gas and TLOAD would cost 5 gas. The combined base cost of the three lock operations would therefore fall to 29 gas (12 + 5 + 12), excluding any new-slot allocation charge.
This could make default reentrancy protection more practical for language compilers.
Why transient storage has seen limited adoption
Beyond reentrancy locks, transient storage supports several useful applications.
| Use case | Description |
|---|---|
| Temporary approvals | Set a temporary approval during a transfer and clear it after the callback completes. |
| Callback metadata | Store metadata intended for a callback function in transient storage. |
| Communication between call frames | Pass data between different message calls within the same transaction. |
However, the cost of 100 gas per operation can discourage these uses. The cost reductions proposed by EIP-7971 would make transient storage more attractive to developers.
Identical pricing despite the absence of disk I/O
The warm-access pricing associated with persistent storage (SLOAD/SSTORE) reflects costs such as storage access and cache management; the full cost of an SSTORE also depends on the storage transition.
Transient storage, by contrast, contains in-memory data discarded at the end of the transaction, without disk writes or state root updates.
Charging the same access price despite different resource requirements creates a mismatch between pricing and the underlying operations.
How the proposal addresses these problems
EIP-7971 combines low fixed operation prices with a hard slot limit. It reduces gas costs to better reflect the underlying work while limiting slot allocations to mitigate DoS attacks. The goal is to make transient storage both inexpensive and resource-bounded.
Specification
Parameter definitions
The proposal introduces the following parameters.
| Parameter | Value | Description |
|---|---|---|
GAS_TLOAD |
5 | Gas cost of TLOAD, which only reads from memory. |
GAS_TSTORE |
12 | Base gas cost of TSTORE, including memory writes and journaling for reverts. |
GAS_TSTORE_ALLOCATE |
24 | Additional charge for allocating a new slot, which costs more than writing to an existing slot. |
MAX_TRANSIENT_SLOTS |
131,072 | Maximum number of distinct slots available across the transaction. |
Changes to gas costs
The gas cost of TLOAD (opcode 0x5c) falls from 100 gas to 5 gas, while the base gas cost of TSTORE (opcode 0x5d) falls from 100 gas to 12 gas.
The first write to a new slot incurs both the base cost (12 gas) and the allocation cost (24 gas), for a total of 36 gas. Subsequent writes to the same allocated slot incur only the base cost of 12 gas.
The following figure compares the existing gas costs with the proposed EIP-7971 pricing.

| Operation | Existing cost | EIP-7971 cost |
|---|---|---|
TLOAD (read) |
100 gas | 5 gas |
TSTORE (write to an existing slot) |
100 gas | 12 gas |
TSTORE (write to a new slot) |
100 gas | 36 gas (12 + 24) |
Transaction-wide slot limit
A slot counter shared across the entire transaction is central to EIP-7971. The following flow illustrates its operation. The original diagram retains its Japanese labels.
flowchart TD
A[トランザクション開始] --> B["transient_slots_used = 0\nに初期化"]
B --> C[TSTORE実行]
C --> D{"このスロットは\n初回書き込み?"}
D -- はい --> E["transient_slots_used++"]
E --> F{"131,072を\n超えた?"}
F -- はい --> G[トランザクション異常停止]
F -- いいえ --> H[書き込み実行]
D -- いいえ --> H
H --> I[トランザクション終了]
I --> J["カウンターを0にリセット"]
At the beginning of the transaction, the transient_slots_used counter is initialized to zero.
Whenever TSTORE executes, the implementation determines whether the slot is being allocated for the first time in the transaction's current execution state.
For a new slot, the counter is incremented. If it exceeds 131,072, execution halts exceptionally.
At the end of the transaction, the counter is reset to zero and all transient storage contents are discarded.
The counter is shared across the transaction because per-contract limits would make resource consumption harder to reason about: the total would depend on the shape of the call stack. A single transaction-wide counter allows clients to reserve the required transient storage capacity at the beginning of execution.
Slot identity is determined by the tuple (contract_address, storage_key).
The same key used by different contracts counts as a separate slot for each contract.
Repeated writes to an already allocated slot do not increment the counter again.
The counter is shared across all message calls within the transaction. Slots used by one contract therefore affect the remaining capacity available to other contracts called during that transaction.
Behavior on revert
If a contract call reverts, the slots allocated within that call are released. A subsequent write to the same slot after the revert therefore increments the counter again.
Rationale
Why use fixed pricing and a hard limit?
The reasons for choosing low fixed prices combined with a hard limit become clearer when compared with alternative designs.
| Design approach | Advantages | Disadvantages |
|---|---|---|
| Fixed pricing and hard limit (this proposal) | Predictable upper bound on resource consumption; low costs for common use cases. | Execution fails if the slot limit is exceeded. |
| Per-contract limit | Each contract has an independent limit. | Resource consumption becomes harder to predict because it depends on the call stack. |
| Superlinear pricing | Costs naturally rise with extensive resource use. | May penalize ordinary use cases. |
| No limit | Simplest implementation. | Changes in gas limits or prices can expose the system to memory-based DoS attacks. |
A hard limit makes the resource bound predictable even if other protocol parameters, such as the gas limit, change. Client implementations can reserve capacity for transient storage at transaction start, avoiding some memory allocation overhead during execution.
Rationale for gas prices
The proposed gas prices reflect the work required by each operation.
GAS_TLOAD(5 gas) Only reads from memory, without disk I/O or journaling. It is lighter than a warm persistent-storage access, so a lower cost is appropriate.GAS_TSTORE(12 gas) In addition to writing to memory, it requires journaling to restore the previous value on revert. Because the operation involves more work than a read, its price is higher thanTLOAD.GAS_TSTORE_ALLOCATE(24 gas) Allocating a new slot requires more work than writing to an existing one. The additional charge reflects the allocation of new memory.
Benchmarks not finalized
The gas prices discussed in this proposal were not yet finalized at the time of the original article. Benchmarks for transient storage operations were under development, and the final values were expected to depend on the measurements. Since warm storage reads from cache were considered to have performance characteristics similar to transient storage reads, the final pricing also needed to be aligned with EIP-8038.
Comparing memory consumption
The effect of the slot limit can be illustrated numerically. The following figure compares memory consumption under the existing pricing and under EIP-7971.

| Item | Existing pricing (100 gas per operation) | EIP-7971 |
|---|---|---|
| Slots allocatable with 60M gas | 600,000 | 131,072 (hard limit) |
| Memory per slot | 64 bytes | 64 bytes |
| Maximum estimated memory consumption | Approximately 38.4 MB | Approximately 8 MB |
| Reduction | - | 79% reduction |
Under the existing pricing, the simplified calculation attributes approximately 38.4 MB of memory to slots allocated using a 60M gas budget. Under EIP-7971, the hard limit caps that estimated slot footprint at approximately 8 MB regardless of the gas budget. This improves resistance to memory-based DoS attacks. Actual client memory consumption also depends on implementation overhead.
Reference implementation
Implementation example
The following Python-style pseudocode illustrates transaction-wide transient storage slot accounting.
GAS_TLOAD = 5
GAS_TSTORE = 12
GAS_TSTORE_ALLOCATE = 24
MAX_TRANSIENT_SLOTS = 131072
class TransactionContext:
def __init__(self):
self.transient_storage = {} # (address, key) -> value
self.unique_slots = set() # set of (address, key) tuples
self.transient_slots_used = 0
def tload(self, address, key):
# ガスを課金
self.charge_gas(GAS_TLOAD)
# 値を返す(未設定ならゼロ)
return self.transient_storage.get((address, key), 0)
def tstore(self, address, key, value):
# 基本ガスを課金
self.charge_gas(GAS_TSTORE)
# 新規スロットかチェック
slot_id = (address, key)
if slot_id not in self.unique_slots:
# 新規割り当てコストを追加課金
self.charge_gas(GAS_TSTORE_ALLOCATE)
self.unique_slots.add(slot_id)
# スロット上限チェック
if len(self.unique_slots) > MAX_TRANSIENT_SLOTS:
raise ExceptionalHalt("Transient storage limit exceeded")
# 値を保存
self.transient_storage[slot_id] = valueIn this example, each invocation of tstore checks the unique_slots set to determine whether a slot is newly allocated.
A new allocation incurs the additional GAS_TSTORE_ALLOCATE charge, and exceeding the slot limit causes an exceptional halt.
The tload operation reads a value from memory without affecting the slot counter.
The original pseudocode illustrates basic allocation accounting; it does not implement all call-frame journaling and revert behavior described above.
Compatibility
The proposal is intended to preserve the ordinary behavior of existing TLOAD and TSTORE operations while changing gas prices.
Existing contracts that do not depend on the old gas pricing generally need no modification, although hard-coded gas assumptions may require updates.
Reducing gas prices should not itself cause existing transactions to run out of gas. The new slot cap is a separate constraint and can affect executions that exceed it.
Security
DoS mitigation through a memory limit
Setting MAX_TRANSIENT_SLOTS to 131,072 limits the estimated memory allocated for slots per transaction to approximately 8 MB (131,072 × 64 bytes).
At 100 gas per operation, the simplified 60M gas example permits up to 600,000 slots (approximately 38.4 MB). EIP-7971 therefore reduces the estimated maximum slot footprint by roughly 79%.
Reducing gas costs alone could increase DoS risk. The hard limit establishes a resource bound independent of the operation prices. Future protocol changes, such as raising the gas limit, would not automatically increase this slot allocation bound.
References
Conclusion
This article covered EIP-7971, which proposes reducing transient storage gas costs and introducing a hard slot limit.
For reentrancy protection, the two-operation base-cost comparison is 200 gas versus 17 gas, while the full three-operation example above is 300 gas versus 29 gas, before any allocation charges. These reductions could make default reentrancy guards more practical for the Solidity compiler. At the same time, the hard slot limit mitigates memory-based DoS risks. Combining lower operation costs with predictable resource limits is the defining feature of the proposal.
If you have questions, feel free to reach out via Twitter DM.
I also publish on the following platforms.




