{"eip":7609,"title":"Decrease base cost of TLOAD/TSTORE","description":"Improve the efficiency of TLOAD/TSTORE by decreasing the base cost and introducing a superlinear pricing model.","authors":["Charles Cooper (@charles-cooper)","James Prestwich (@prestwich)","brockelmore (@brockelmore)"],"status":"Stagnant","type":"Standards Track","category":"Core","created":"2024-02-01","requires":[1153],"discussionsTo":"https://ethereum-magicians.org/t/eip-7609-reduce-transient-storage-pricing/18435","repo":"EIPs","label":"EIP-7609","officialUrl":"https://eips.ethereum.org/EIPS/eip-7609","sourceUrl":"https://github.com/ethereum/EIPs/blob/master/EIPS/eip-7609.md","url":"https://eips.huatuo.xyz/eip-7609/","tldr":{"en":"A stalled proposal to make transient storage much cheaper (TLOAD 5 gas, TSTORE 8 gas plus a growing charge per new slot), so features like reentrancy locks become almost free while DoS stays expensive.","ja":"トランジェントストレージをはるかに安価にする（TLOAD は 5 ガス、TSTORE は 8 ガスに新しいスロットごとに増える追加料金）、停滞中の提案。再入防止ロックのような機能がほぼ無料になる一方、DoS のコストは高いままにする。","ko":"트랜지언트 스토리지를 훨씬 저렴하게 만들자는(TLOAD 5 gas, TSTORE 8 gas에 새 slot마다 늘어나는 추가 요금) 정체된 제안. 재진입 락 같은 기능은 거의 공짜가 되고 DoS는 여전히 비싸게 유지된다.","zh":"一项陷入停滞的提案，旨在大幅降低瞬态存储的成本（TLOAD 5 gas，TSTORE 8 gas 外加随新 slot 增长的费用），让重入锁之类的功能几乎免费，同时让 DoS 攻击依然昂贵。"},"tags":["gas","evm","transient-storage","repricing","stagnant"],"explainers":{"en":{"lang":"en","tldr":"A stalled proposal to make transient storage much cheaper (TLOAD 5 gas, TSTORE 8 gas plus a growing charge per new slot), so features like reentrancy locks become almost free while DoS stays expensive.","tags":["gas","evm","transient-storage","repricing","stagnant"],"related":[1153,2929],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/eip-7609/","markdown":"## What problem does it solve?\n\n[EIP-1153](/eip-1153/) added transient storage: `TSTORE` / `TLOAD` give contracts a key-value store that lives only for the current transaction. It is ideal for reentrancy locks and passing data between calls. It was priced at 100 gas per operation, the same as a warm storage access, partly for simplicity and partly to guard against two DoS concerns: allocating too much transient memory and the cost of rolling it back on revert.\n\nThe authors argue this is overpriced. Transient storage never touches the database, has no refunds, and needs allocation only once per contract per transaction. If the first few slots were very cheap, compilers could even enable reentrancy protection by default.\n\n## How it works\n\nThe proposal replaces the flat price with:\n\n- `TLOAD`: **5 gas** (similar CPU cost to `MUL` in benchmarks).\n- `TSTORE`: **8 gas**, plus an expansion cost when the key is new in that contract's transient storage. The expansion cost is 1 gas times the number of slots already allocated.\n\nSo writing the n-th new slot costs roughly `8 + (n - 1)` gas. This is cheaper than today for common cases (the spec estimates fewer than about 95 slots written per contract) and grows quadratically for anyone trying to allocate huge amounts.\n\nThe spec's security analysis, assuming a 30M gas block: a single contract could allocate about 7,739 slots (around 248 KB). Spreading allocation across many contracts reaches about 23,000 slots (around 736 KB) per transaction, which the authors note is less memory than the current schedule allows.\n\n## Sample code\n\nPricing from the spec:\n\n```python\nG_LOW = 5\nG_MID = 8\nSLOPE = 1\n\ndef gas_tload(_key):\n    return G_LOW\n\ndef gas_tstore(key, transient_mapping):\n    cost = G_MID\n    if key not in transient_mapping:\n        cost += SLOPE * transient_mapping.size()\n    return cost\n```\n\nThe use case it targets, a transient reentrancy guard (Solidity 0.8.24+):\n\n```solidity\n// SPDX-License-Identifier: MIT\npragma solidity ^0.8.24;\n\nabstract contract TransientReentrancyGuard {\n    bytes32 private constant SLOT = keccak256(\"reentrancy.guard\");\n\n    modifier nonReentrant() {\n        bytes32 slot = SLOT;\n        assembly {\n            if tload(slot) { revert(0, 0) }\n            tstore(slot, 1)\n        }\n        _;\n        assembly { tstore(slot, 0) }\n    }\n}\n```\n\nToday each `tload`/`tstore` costs 100 gas; under this proposal the same guard would cost about 5 + 8 + 8 gas.\n\n## Things to know\n\n- Status is **Stagnant**: it has not been scheduled for any upgrade, and mainnet transient storage still uses the EIP-1153 pricing.\n- The extra charge depends on how many slots the current contract has already written in this transaction, so gas for a `TSTORE` would vary with prior activity.\n- The DoS bounds in the spec are computed for a 30M gas limit and scale linearly with it.\n"},"ja":{"lang":"ja","tldr":"トランジェントストレージをはるかに安価にする（TLOAD は 5 ガス、TSTORE は 8 ガスに新しいスロットごとに増える追加料金）、停滞中の提案。再入防止ロックのような機能がほぼ無料になる一方、DoS のコストは高いままにする。","tags":["gas","evm","transient-storage","repricing","stagnant"],"related":[1153,2929],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ja/eip-7609/","markdown":"## 何を解決するのか\n\n[EIP-1153](/eip-1153/) はトランジェントストレージを追加しました。`TSTORE` / `TLOAD` により、コントラクトは現在のトランザクションの間だけ存在するキー・バリューストアを使えます。再入防止ロックや、呼び出し間のデータの受け渡しに最適です。価格は 1 操作あたり 100 ガスで、warm なストレージアクセスと同じでした。理由の一部は単純さのため、一部は 2 つの DoS の懸念、つまりトランジェントメモリの過剰な割り当てと、revert 時のロールバックのコストを防ぐためでした。\n\n作者たちは、これは割高だと主張します。トランジェントストレージはデータベースに一切触れず、リファンドもなく、割り当てもトランザクションごとにコントラクトにつき一度で済みます。最初の数スロットがとても安ければ、コンパイラが再入防止をデフォルトで有効にすることさえできます。\n\n## 仕組み\n\nこの提案は、固定価格を次のものに置き換えます。\n\n- `TLOAD`: **5 ガス**（ベンチマークでの CPU コストは `MUL` と同程度）。\n- `TSTORE`: **8 ガス**。そのコントラクトのトランジェントストレージにキーが新規に入る場合は、拡張コストが加わります。拡張コストは、1 ガスに、すでに割り当てられているスロット数を掛けたものです。\n\nつまり n 番目の新しいスロットを書き込むコストは、おおよそ `8 + (n - 1)` ガスです。一般的なケース（仕様では、コントラクトごとの書き込みスロット数が約 95 未満と見積もっています）では今より安くなり、大量に割り当てようとする場合は 2 次関数的に増えます。\n\n仕様のセキュリティ分析は、ブロックのガスを 3,000 万と仮定しています。1 つのコントラクトで割り当てられるのは約 7,739 スロット（約 248 KB）です。割り当てを多数のコントラクトに分散すると、トランザクションあたり約 23,000 スロット（約 736 KB）に達しますが、作者たちは、これは現行のスケジュールで可能な量より少ないメモリだと指摘しています。\n\n## サンプルコード\n\n仕様にある価格設定:\n\n```python\nG_LOW = 5\nG_MID = 8\nSLOPE = 1\n\ndef gas_tload(_key):\n    return G_LOW\n\ndef gas_tstore(key, transient_mapping):\n    cost = G_MID\n    if key not in transient_mapping:\n        cost += SLOPE * transient_mapping.size()\n    return cost\n```\n\nこの提案が想定するユースケース、トランジェントな再入防止ガード（Solidity 0.8.24 以降）:\n\n```solidity\n// SPDX-License-Identifier: MIT\npragma solidity ^0.8.24;\n\nabstract contract TransientReentrancyGuard {\n    bytes32 private constant SLOT = keccak256(\"reentrancy.guard\");\n\n    modifier nonReentrant() {\n        bytes32 slot = SLOT;\n        assembly {\n            if tload(slot) { revert(0, 0) }\n            tstore(slot, 1)\n        }\n        _;\n        assembly { tstore(slot, 0) }\n    }\n}\n```\n\n現在は `tload` / `tstore` が 1 回あたり 100 ガスかかりますが、この提案では同じガードのコストは約 5 + 8 + 8 ガスになります。\n\n## 知っておくべきこと\n\n- ステータスは **Stagnant** です。どのアップグレードにもスケジュールされておらず、メインネットのトランジェントストレージは今も EIP-1153 の価格設定を使っています。\n- 追加料金は、現在のコントラクトがこのトランザクションですでに書き込んだスロット数に依存するため、`TSTORE` のガスはそれまでの活動によって変わります。\n- 仕様の DoS の上限は 3,000 万ガスのリミットを前提に計算されており、それに比例して線形に増えます。\n"},"ko":{"lang":"ko","tldr":"트랜지언트 스토리지를 훨씬 저렴하게 만들자는(TLOAD 5 gas, TSTORE 8 gas에 새 slot마다 늘어나는 추가 요금) 정체된 제안. 재진입 락 같은 기능은 거의 공짜가 되고 DoS는 여전히 비싸게 유지된다.","tags":["gas","evm","transient-storage","repricing","stagnant"],"related":[1153,2929],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ko/eip-7609/","markdown":"## 어떤 문제를 해결하나요?\n\n[EIP-1153](/eip-1153/)은 트랜지언트 스토리지를 추가했습니다. `TSTORE` / `TLOAD`는 컨트랙트에 현재 트랜잭션 동안만 존재하는 키-값 저장소를 제공합니다. 재진입 락이나 호출 사이의 데이터 전달에 이상적입니다. 가격은 연산당 100 gas로, 웜(warm) 스토리지 접근과 같았는데, 일부는 단순함 때문이고 일부는 두 가지 DoS 우려, 즉 트랜지언트 메모리의 과도한 할당과 revert 시 롤백 비용을 막기 위해서였습니다.\n\n작성자들은 이것이 과하게 비싸다고 주장합니다. 트랜지언트 스토리지는 데이터베이스를 전혀 건드리지 않고, 환급도 없으며, 할당도 컨트랙트당 트랜잭션당 한 번만 필요합니다. 처음 몇 개의 slot이 아주 저렴하다면 컴파일러가 재진입 방어를 기본으로 켜는 것도 가능합니다.\n\n## 어떻게 동작하나요?\n\n이 제안은 고정 가격을 다음으로 대체합니다.\n\n- `TLOAD`: **5 gas**(벤치마크에서 CPU 비용이 `MUL`과 비슷).\n- `TSTORE`: **8 gas**, 그리고 해당 컨트랙트의 트랜지언트 스토리지에서 키가 새것이면 확장 비용이 추가됩니다. 확장 비용은 1 gas에 이미 할당된 slot 수를 곱한 값입니다.\n\n따라서 n번째 새 slot을 쓰는 비용은 대략 `8 + (n - 1)` gas입니다. 일반적인 경우(명세는 컨트랙트당 쓰는 slot이 약 95개 미만이라고 추정)에는 현재보다 저렴하고, 막대한 양을 할당하려는 쪽에게는 비용이 2차 함수적으로 늘어납니다.\n\n명세의 보안 분석은 블록 gas를 3,000만으로 가정합니다. 컨트랙트 하나가 할당할 수 있는 것은 약 7,739개 slot(약 248 KB)입니다. 여러 컨트랙트에 분산하면 트랜잭션당 약 23,000개 slot(약 736 KB)에 이르는데, 작성자들은 이것이 현행 요금표에서 가능한 것보다 적은 메모리라고 짚습니다.\n\n## 샘플 코드\n\n명세의 가격 책정:\n\n```python\nG_LOW = 5\nG_MID = 8\nSLOPE = 1\n\ndef gas_tload(_key):\n    return G_LOW\n\ndef gas_tstore(key, transient_mapping):\n    cost = G_MID\n    if key not in transient_mapping:\n        cost += SLOPE * transient_mapping.size()\n    return cost\n```\n\n이 제안이 겨냥하는 사용 사례인 트랜지언트 재진입 가드(Solidity 0.8.24+):\n\n```solidity\n// SPDX-License-Identifier: MIT\npragma solidity ^0.8.24;\n\nabstract contract TransientReentrancyGuard {\n    bytes32 private constant SLOT = keccak256(\"reentrancy.guard\");\n\n    modifier nonReentrant() {\n        bytes32 slot = SLOT;\n        assembly {\n            if tload(slot) { revert(0, 0) }\n            tstore(slot, 1)\n        }\n        _;\n        assembly { tstore(slot, 0) }\n    }\n}\n```\n\n현재는 `tload`/`tstore` 하나에 100 gas가 들지만, 이 제안에서는 같은 가드의 비용이 약 5 + 8 + 8 gas가 됩니다.\n\n## 알아둘 점\n\n- 상태는 **Stagnant**입니다. 어떤 업그레이드에도 일정이 잡혀 있지 않으며, 메인넷의 트랜지언트 스토리지는 여전히 EIP-1153 가격을 사용합니다.\n- 추가 요금은 현재 컨트랙트가 이 트랜잭션에서 이미 쓴 slot 수에 따라 달라지므로, `TSTORE`의 gas는 앞선 활동에 따라 달라집니다.\n- 명세의 DoS 상한은 3,000만 gas 한도를 기준으로 계산되었으며 이에 비례해 선형으로 늘어납니다.\n"},"zh":{"lang":"zh","tldr":"一项陷入停滞的提案，旨在大幅降低瞬态存储的成本（TLOAD 5 gas，TSTORE 8 gas 外加随新 slot 增长的费用），让重入锁之类的功能几乎免费，同时让 DoS 攻击依然昂贵。","tags":["gas","evm","transient-storage","repricing","stagnant"],"related":[1153,2929],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/zh/eip-7609/","markdown":"## 它解决什么问题？\n\n[EIP-1153](/eip-1153/) 引入了瞬态存储：`TSTORE` / `TLOAD` 给合约提供一个只在当前交易内存在的键值存储。它非常适合用于重入锁和在调用之间传递数据。它的定价是每次操作 100 gas，与热存储访问相同，部分是为了简单，部分是为了防范两种 DoS 担忧：分配过多的瞬态内存，以及在 revert 时回滚它的成本。\n\n作者认为这个定价偏高。瞬态存储从不接触数据库，没有退款，每个合约在每笔交易中也只需要分配一次。如果最初的几个 slot 非常便宜，编译器甚至可以默认启用重入保护。\n\n## 它如何运作\n\n该提案用下面的方案取代固定价格：\n\n- `TLOAD`：**5 gas**（在基准测试中 CPU 成本与 `MUL` 相近）。\n- `TSTORE`：**8 gas**，如果该键在该合约的瞬态存储中是新的，还要加上扩展费用。扩展费用是 1 gas 乘以已经分配的 slot 数量。\n\n因此，写入第 n 个新 slot 的成本大约是 `8 + (n - 1)` gas。在常见情形下这比现在便宜（规范估计每个合约写入的 slot 少于约 95 个），而对于试图分配海量空间的人，成本会呈二次增长。\n\n规范的安全分析假设区块为 3000 万 gas：单个合约大约可以分配 7,739 个 slot（约 248 KB）。把分配分散到多个合约，每笔交易可达约 23,000 个 slot（约 736 KB），作者指出这比当前定价所允许的内存还要少。\n\n## 示例代码\n\n规范中的定价：\n\n```python\nG_LOW = 5\nG_MID = 8\nSLOPE = 1\n\ndef gas_tload(_key):\n    return G_LOW\n\ndef gas_tstore(key, transient_mapping):\n    cost = G_MID\n    if key not in transient_mapping:\n        cost += SLOPE * transient_mapping.size()\n    return cost\n```\n\n它所针对的使用场景：瞬态重入保护（Solidity 0.8.24+）：\n\n```solidity\n// SPDX-License-Identifier: MIT\npragma solidity ^0.8.24;\n\nabstract contract TransientReentrancyGuard {\n    bytes32 private constant SLOT = keccak256(\"reentrancy.guard\");\n\n    modifier nonReentrant() {\n        bytes32 slot = SLOT;\n        assembly {\n            if tload(slot) { revert(0, 0) }\n            tstore(slot, 1)\n        }\n        _;\n        assembly { tstore(slot, 0) }\n    }\n}\n```\n\n现在每次 `tload`/`tstore` 花费 100 gas；在这个提案下，同样的保护大约只需要 5 + 8 + 8 gas。\n\n## 需要注意\n\n- 状态为 **Stagnant**：它没有被安排进任何升级，主网的瞬态存储仍然使用 EIP-1153 的定价。\n- 额外费用取决于当前合约在本笔交易中已经写入了多少个 slot，所以 `TSTORE` 的 gas 会随先前的活动而变化。\n- 规范中的 DoS 上限是按 3000 万 gas 限制计算的，并随之线性变化。\n"}}}
