{"eip":8358,"title":"Net Gas Metering for Account Changes","description":"Make repeated value transfers cheaper by charging account changes once per transaction and refunding accounts that return to original state","authors":["Dragan Rakita (@rakita)","Charles Cooper (@charles-cooper)"],"status":"Draft","type":"Standards Track","category":"Core","created":"2026-07-26","requires":[161,2200,2780,2929,3529,7702,7708,8037,8038],"discussionsTo":"https://ethereum-magicians.org/t/eip-8358-net-gas-metering-for-account-changes/29304","repo":"EIPs","label":"EIP-8358","officialUrl":"https://eips.ethereum.org/EIPS/eip-8358","sourceUrl":"https://github.com/ethereum/EIPs/blob/master/EIPS/eip-8358.md","url":"https://eips.huatuo.xyz/eip-8358/","tldr":{"en":"Prices ETH transfers inside a transaction like net-metered storage: each account pays the balance-write charge once, later changes are cheaper, and an account that ends where it started earns a refund.","ja":"トランザクション内での ETH 送金を、ネットメータリングされたストレージのように価格付けする。各アカウントは残高書き込み料金を一度だけ支払い、その後の変更は安くなり、開始時と同じ状態で終わるアカウントは払い戻しを受ける。","ko":"트랜잭션 안의 ETH 전송을 순 계량(net-metered) 스토리지처럼 가격 책정한다. 각 계정은 잔액 쓰기 요금을 한 번만 내고, 이후 변경은 더 저렴하며, 시작했을 때와 같은 상태로 끝나는 계정은 환불을 받는다.","zh":"像净计量存储一样为交易内的 ETH 转账定价：每个账户只需支付一次余额写入费用，之后的变更更便宜，最终回到起始状态的账户可获得退款。"},"tags":["gas","evm","value-transfer","core","refunds"],"explainers":{"en":{"lang":"en","tldr":"Prices ETH transfers inside a transaction like net-metered storage: each account pays the balance-write charge once, later changes are cheaper, and an account that ends where it started earns a refund.","tags":["gas","evm","value-transfer","core","refunds"],"related":[2200,8038,2780,7708,7702],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/eip-8358/","markdown":"## What problem does it solve?\n\nA `CALL` that sends ETH currently costs a flat amount every time (`CALL_VALUE`, effectively 9,000 gas under [EIP-8038](/eip-8038/) once the unused 2,300 stipend is returned). That charge mostly pays for writing the changed account to the state trie. But each account is written only **once per block**, however many times its balance changes.\n\nStorage slots already get **net gas metering** ([EIP-2200](/eip-2200/)): the first change pays the write cost, later changes are cheap, and restoring the original value earns a refund. Native ETH has no such rule, so an ERC-20 balance in storage is metered more accurately than ether itself. Routers that forward `msg.value`, contracts that refund excess ETH, and batch payouts (including [EIP-7702](/eip-7702/) wallets) all pay for state writes that never happen.\n\n## How it works\n\n- **Original state.** Each account's *original* balance and nonce are taken at the start of execution (after gas debit, sender nonce bump and the transaction's own value transfer). An account is **clean** if its balance and nonce still match, **dirty** otherwise.\n- **New price for a value-bearing `CALL`/`CALLCODE`:**\n  - `CALL_VALUE_BASE_GAS = 4000` always (it covers the stipend and the [EIP-7708](/eip-7708/) transfer log);\n  - `+ 2500` for each of sender and recipient that is still clean;\n  - `+ 0` for accounts already dirty.\n  Two clean accounts → 9,000 gas, the same as today.\n- **Refund.** If a transfer brings an account back to its original balance and its nonce is unchanged, 2,500 gas is added to the refund counter (subject to the usual [EIP-3529](/eip-3529/) cap).\n- **Stipend becomes a floor.** The callee gets `max(gasLimit, 2300)` instead of `gasLimit + 2300`. `transfer`/`send` still give the callee 2,300 gas, but extra stipend gas is no longer returned to the caller.\n- Nonce changes (from `CREATE`, `CREATE2` or a 7702 authorization) make an account dirty, so it cannot collect a reset refund.\n\n## Sample code\n\nGas for the value-transfer component, from the spec's test table:\n\n```text\nScenario                 Charged  Refund  Net     Before\nA→B x                    9000     0       9000    9000\nA→B x; A→B x             13000    0       13000   18000\nA→B x; B→C x             15500    2500    13000   18000\nA→B x; B→A x             13000    5000    8000    18000   (round trip)\nA→A x (self-transfer)    4000     0       4000    9000\n```\n\nA pattern that becomes cheaper: a router that forwards ETH it just received.\n\n```solidity\n// SPDX-License-Identifier: MIT\npragma solidity ^0.8.20;\n\ncontract Forwarder {\n    function forward(address payable to) external payable {\n        // Router's balance goes +v then -v within the tx:\n        // the second hop pays 4000 base + 2500 for `to` (if clean),\n        // nothing for the router, and the router earns a 2500 refund.\n        (bool ok, ) = to.call{value: msg.value}(\"\");\n        require(ok);\n    }\n}\n```\n\n## Things to know\n\n- **Status: Draft.** It requires a hard fork and builds on other drafts, including [EIP-8038](/eip-8038/) and [EIP-2780](/eip-2780/), so the numbers may change.\n- A value transfer never costs more than today's effective 9,000 gas, but a callee given an explicit gas limit now receives up to 2,300 less gas, and code measuring `gasleft()` around value calls may see different values.\n- Gas estimation becomes order-dependent, like warm/cold access: a transfer's cost depends on earlier balance changes in the same transaction.\n- The base (4,000) is kept above the stipend (2,300) on purpose, so stipend gas can never fund another value call and transfer logs never become cheaper than plain `LOG` opcodes.\n"},"ja":{"lang":"ja","tldr":"トランザクション内での ETH 送金を、ネットメータリングされたストレージのように価格付けする。各アカウントは残高書き込み料金を一度だけ支払い、その後の変更は安くなり、開始時と同じ状態で終わるアカウントは払い戻しを受ける。","tags":["gas","evm","value-transfer","core","refunds"],"related":[2200,8038,2780,7708,7702],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ja/eip-8358/","markdown":"## 何を解決するのか\n\nETH を送る `CALL` は現在、毎回一定の額（`CALL_VALUE`。[EIP-8038](/eip-8038/) のもとでは、使われなかった 2,300 のスタイペンドが返却された後で、実質 9,000 ガス）がかかります。この料金は主に、変更されたアカウントをステートトライに書き込むためのものです。しかし、残高が何度変わっても、各アカウントが書き込まれるのは**ブロックあたり一度だけ**です。\n\nストレージスロットにはすでに**ネットガスメータリング**（[EIP-2200](/eip-2200/)）があります。最初の変更が書き込みコストを支払い、その後の変更は安く、元の値に戻すと払い戻しが得られます。ネイティブな ETH にはそのようなルールがないため、ストレージ内の ERC-20 の残高のほうが、イーサそのものよりも正確に計量されています。受け取った `msg.value` を転送するルーター、余った ETH を返金するコントラクト、一括送金（[EIP-7702](/eip-7702/) ウォレットを含む）は、実際には発生しないステート書き込みの分まで支払っています。\n\n## 仕組み\n\n- **元の状態。** 各アカウントの*元の*残高とナンスは、実行開始時（ガスの引き落とし、送信者のナンス加算、トランザクション自身の送金の後）に取得されます。残高とナンスがまだ一致していればアカウントは**クリーン**、そうでなければ**ダーティ**です。\n- **価値を伴う `CALL`/`CALLCODE` の新しい価格:**\n  - `CALL_VALUE_BASE_GAS = 4000` を常に課す（スタイペンドと [EIP-7708](/eip-7708/) の送金ログをカバーする）。\n  - 送信者と受信者のうち、まだクリーンなものそれぞれにつき `+ 2500`。\n  - すでにダーティなアカウントには `+ 0`。\n  クリーンなアカウントが 2 つなら 9,000 ガスで、現在と同じです。\n- **払い戻し。** 送金によってアカウントが元の残高に戻り、ナンスが変わっていない場合、払い戻しカウンターに 2,500 ガスが加算されます（通常の [EIP-3529](/eip-3529/) の上限が適用されます）。\n- **スタイペンドは下限になります。** 呼び出し先は `gasLimit + 2300` ではなく `max(gasLimit, 2300)` を受け取ります。`transfer`/`send` は引き続き呼び出し先に 2,300 ガスを与えますが、余分なスタイペンドのガスは呼び出し元に返されなくなります。\n- ナンスの変更（`CREATE`、`CREATE2`、7702 の認可による）はアカウントをダーティにするため、リセットの払い戻しを受け取れません。\n\n## サンプルコード\n\n仕様のテスト表にある、送金部分のガス:\n\n```text\nScenario                 Charged  Refund  Net     Before\nA→B x                    9000     0       9000    9000\nA→B x; A→B x             13000    0       13000   18000\nA→B x; B→C x             15500    2500    13000   18000\nA→B x; B→A x             13000    5000    8000    18000   (round trip)\nA→A x (self-transfer)    4000     0       4000    9000\n```\n\n安くなるパターンの例。受け取ったばかりの ETH を転送するルーター:\n\n```solidity\n// SPDX-License-Identifier: MIT\npragma solidity ^0.8.20;\n\ncontract Forwarder {\n    function forward(address payable to) external payable {\n        // Router's balance goes +v then -v within the tx:\n        // the second hop pays 4000 base + 2500 for `to` (if clean),\n        // nothing for the router, and the router earns a 2500 refund.\n        (bool ok, ) = to.call{value: msg.value}(\"\");\n        require(ok);\n    }\n}\n```\n\n## 知っておくべきこと\n\n- **ステータス: Draft。** ハードフォークが必要で、[EIP-8038](/eip-8038/) や [EIP-2780](/eip-2780/) などの他のドラフトに依存しているため、数値は変わる可能性があります。\n- 送金のコストが現在の実効 9,000 ガスを超えることはありませんが、ガスリミットを明示された呼び出し先は、最大で 2,300 少ないガスを受け取ることになり、価値を伴う呼び出しの前後で `gasleft()` を計測するコードは、異なる値を目にするかもしれません。\n- ガス見積もりは、warm/cold アクセスのように順序に依存するようになります。送金のコストは、同じトランザクション内の先行する残高変更に左右されます。\n- ベース（4,000）は意図的にスタイペンド（2,300）より高く保たれています。スタイペンドのガスが別の価値を伴う呼び出しの資金になることがなく、送金ログが通常の `LOG` オペコードより安くなることもありません。\n"},"ko":{"lang":"ko","tldr":"트랜잭션 안의 ETH 전송을 순 계량(net-metered) 스토리지처럼 가격 책정한다. 각 계정은 잔액 쓰기 요금을 한 번만 내고, 이후 변경은 더 저렴하며, 시작했을 때와 같은 상태로 끝나는 계정은 환불을 받는다.","tags":["gas","evm","value-transfer","core","refunds"],"related":[2200,8038,2780,7708,7702],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ko/eip-8358/","markdown":"## 어떤 문제를 해결하나요?\n\nETH를 보내는 `CALL`은 현재 매번 고정된 금액(`CALL_VALUE`. [EIP-8038](/eip-8038/)에서는 쓰지 않은 2,300 스티펜드가 반환된 뒤 실질적으로 9,000 가스)을 냅니다. 이 요금은 주로 변경된 계정을 상태 트라이에 쓰는 비용입니다. 하지만 잔액이 몇 번 바뀌든 각 계정은 **블록당 한 번만** 쓰입니다.\n\n스토리지 슬롯에는 이미 **순 가스 계량**([EIP-2200](/eip-2200/))이 있습니다. 첫 변경이 쓰기 비용을 내고, 이후 변경은 저렴하며, 원래 값으로 되돌리면 환불을 받습니다. 네이티브 ETH에는 이런 규칙이 없어서, 스토리지에 있는 ERC-20 잔액이 이더 자체보다 더 정확하게 계량됩니다. 받은 `msg.value`를 전달하는 라우터, 초과 ETH를 환불하는 컨트랙트, 일괄 지급([EIP-7702](/eip-7702/) 지갑 포함)은 모두 실제로는 일어나지 않는 상태 쓰기에 대해 비용을 냅니다.\n\n## 어떻게 동작하나요?\n\n- **원래 상태.** 각 계정의 *원래* 잔액과 nonce는 실행 시작 시점(가스 차감, 발신자 nonce 증가, 트랜잭션 자체의 가치 전송 이후)에 가져옵니다. 잔액과 nonce가 여전히 같으면 계정은 **클린**, 그렇지 않으면 **더티**입니다.\n- **가치를 동반한 `CALL`/`CALLCODE`의 새 가격:**\n  - 항상 `CALL_VALUE_BASE_GAS = 4000`(스티펜드와 [EIP-7708](/eip-7708/) 전송 로그를 포함);\n  - 발신자와 수신자 중 아직 클린인 쪽마다 `+ 2500`;\n  - 이미 더티인 계정은 `+ 0`.\n  클린 계정이 둘이면 9,000 가스로 지금과 같습니다.\n- **환불.** 전송으로 계정이 원래 잔액으로 돌아오고 nonce가 바뀌지 않았다면, 환불 카운터에 2,500 가스가 더해집니다(통상적인 [EIP-3529](/eip-3529/) 상한이 적용됩니다).\n- **스티펜드가 하한이 됩니다.** 피호출자는 `gasLimit + 2300` 대신 `max(gasLimit, 2300)`을 받습니다. `transfer`/`send`는 여전히 피호출자에게 2,300 가스를 주지만, 추가 스티펜드 가스는 더 이상 호출자에게 반환되지 않습니다.\n- nonce 변경(`CREATE`, `CREATE2`, 7702 인가에 의한)은 계정을 더티로 만들어 리셋 환불을 받을 수 없습니다.\n\n## 샘플 코드\n\n스펙의 테스트 표에서 가져온, 가치 전송 부분의 가스:\n\n```text\nScenario                 Charged  Refund  Net     Before\nA→B x                    9000     0       9000    9000\nA→B x; A→B x             13000    0       13000   18000\nA→B x; B→C x             15500    2500    13000   18000\nA→B x; B→A x             13000    5000    8000    18000   (round trip)\nA→A x (self-transfer)    4000     0       4000    9000\n```\n\n더 저렴해지는 패턴: 방금 받은 ETH를 전달하는 라우터.\n\n```solidity\n// SPDX-License-Identifier: MIT\npragma solidity ^0.8.20;\n\ncontract Forwarder {\n    function forward(address payable to) external payable {\n        // Router's balance goes +v then -v within the tx:\n        // the second hop pays 4000 base + 2500 for `to` (if clean),\n        // nothing for the router, and the router earns a 2500 refund.\n        (bool ok, ) = to.call{value: msg.value}(\"\");\n        require(ok);\n    }\n}\n```\n\n## 알아둘 점\n\n- **상태: Draft.** 하드포크가 필요하며 [EIP-8038](/eip-8038/), [EIP-2780](/eip-2780/) 등 다른 초안에 의존하므로 수치는 바뀔 수 있습니다.\n- 가치 전송 비용이 현재의 실질 9,000 가스를 넘는 일은 없지만, 가스 한도를 명시한 피호출자는 이제 최대 2,300 가스를 덜 받게 되며, 가치 호출 전후로 `gasleft()`를 측정하는 코드는 다른 값을 볼 수 있습니다.\n- 가스 추정은 warm/cold 접근처럼 순서에 의존하게 됩니다. 전송 비용이 같은 트랜잭션에서 앞서 일어난 잔액 변경에 따라 달라집니다.\n- 기본값(4,000)은 스티펜드(2,300)보다 의도적으로 높게 유지되므로, 스티펜드 가스가 또 다른 가치 호출의 자금이 될 수 없고 전송 로그가 일반 `LOG` 옵코드보다 저렴해지는 일도 없습니다.\n"},"zh":{"lang":"zh","tldr":"像净计量存储一样为交易内的 ETH 转账定价：每个账户只需支付一次余额写入费用，之后的变更更便宜，最终回到起始状态的账户可获得退款。","tags":["gas","evm","value-transfer","core","refunds"],"related":[2200,8038,2780,7708,7702],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/zh/eip-8358/","markdown":"## 它解决什么问题？\n\n目前，发送 ETH 的 `CALL` 每次都收取固定费用（`CALL_VALUE`；在 [EIP-8038](/eip-8038/) 下，退还未使用的 2,300 津贴后，实际为 9,000 gas）。这笔费用主要用来支付把变更后的账户写入状态树的成本。但无论余额变化多少次，每个账户在**每个区块中只会被写入一次**。\n\n存储槽位已经有了**净 gas 计量**（[EIP-2200](/eip-2200/)）：第一次变更支付写入成本，之后的变更很便宜，恢复为原值则获得退款。原生 ETH 没有这样的规则，因此存储中的 ERC-20 余额比以太币本身计量得更准确。转发 `msg.value` 的路由合约、退还多余 ETH 的合约，以及批量发放（包括 [EIP-7702](/eip-7702/) 钱包），都在为根本不会发生的状态写入付费。\n\n## 它如何运作\n\n- **原始状态。** 每个账户的*原始*余额和 nonce 在执行开始时获取（在扣除 gas、发送方 nonce 加一以及交易自身的价值转移之后）。如果余额和 nonce 仍然匹配，账户是**干净的**，否则是**脏的**。\n- **携带价值的 `CALL`/`CALLCODE` 的新价格：**\n  - 始终收取 `CALL_VALUE_BASE_GAS = 4000`（涵盖津贴和 [EIP-7708](/eip-7708/) 的转账日志）；\n  - 发送方和接收方中每个仍是干净的账户 `+ 2500`；\n  - 已经是脏的账户 `+ 0`。\n  两个干净账户 → 9,000 gas，与现在相同。\n- **退款。** 如果一次转账使账户回到其原始余额且 nonce 未变，则向退款计数器增加 2,500 gas（受常规 [EIP-3529](/eip-3529/) 上限约束）。\n- **津贴变为下限。** 被调用方获得 `max(gasLimit, 2300)`，而不是 `gasLimit + 2300`。`transfer`/`send` 仍然给被调用方 2,300 gas，但多余的津贴 gas 不再退还给调用方。\n- nonce 变化（来自 `CREATE`、`CREATE2` 或 7702 授权）会使账户变脏，因此无法获得重置退款。\n\n## 示例代码\n\n价值转移部分的 gas，取自规范的测试表：\n\n```text\nScenario                 Charged  Refund  Net     Before\nA→B x                    9000     0       9000    9000\nA→B x; A→B x             13000    0       13000   18000\nA→B x; B→C x             15500    2500    13000   18000\nA→B x; B→A x             13000    5000    8000    18000   (round trip)\nA→A x (self-transfer)    4000     0       4000    9000\n```\n\n一种会变便宜的模式：转发刚收到的 ETH 的路由合约。\n\n```solidity\n// SPDX-License-Identifier: MIT\npragma solidity ^0.8.20;\n\ncontract Forwarder {\n    function forward(address payable to) external payable {\n        // Router's balance goes +v then -v within the tx:\n        // the second hop pays 4000 base + 2500 for `to` (if clean),\n        // nothing for the router, and the router earns a 2500 refund.\n        (bool ok, ) = to.call{value: msg.value}(\"\");\n        require(ok);\n    }\n}\n```\n\n## 需要注意\n\n- **状态：Draft。** 它需要硬分叉，并建立在其他草案之上，包括 [EIP-8038](/eip-8038/) 和 [EIP-2780](/eip-2780/)，因此数值可能改变。\n- 一次价值转移的成本绝不会超过目前实际的 9,000 gas，但被明确指定了 gas 上限的被调用方现在最多会少收到 2,300 gas，在价值调用前后测量 `gasleft()` 的代码可能会看到不同的值。\n- gas 估算会像 warm/cold 访问一样依赖顺序：一次转账的成本取决于同一交易中较早的余额变化。\n- 基础值（4,000）被有意保持在津贴（2,300）之上，这样津贴 gas 永远不能为另一次价值调用提供资金，转账日志也永远不会比普通的 `LOG` 操作码更便宜。\n"}}}
