---
eip: 2035
label: EIP-2035
title: Stateless Clients - Repricing SLOAD and SSTORE to pay for block proofs
status: Stagnant
type: Standards Track
category: Core
created: 2019-05-16
official: https://eips.ethereum.org/EIPS/eip-2035
source: https://github.com/ethereum/EIPs/blob/master/EIPS/eip-2035.md
canonical: https://eips.huatuo.xyz/zh/eip-2035/
lang: zh
tldr: 早期的无状态客户端提案：对交易中每个存储槽的首次 SLOAD 或 SSTORE 收取额外 gas，用来支付区块证明所占用的带宽。
tags: [gas, stateless, storage, sload, sstore, core]
---

# EIP-2035: Stateless Clients - Repricing SLOAD and SSTORE to pay for block proofs

> The gas cost of EVM opcodes SLOAD and SSTORE increases in order to accommodate extra bandwidth required to propagate block proof together with the block headers and block bodies, as explained here.

**TL;DR:** 早期的无状态客户端提案：对交易中每个存储槽的首次 SLOAD 或 SSTORE 收取额外 gas，用来支付区块证明所占用的带宽。

## 它解决什么问题？

执行一个区块通常需要节点持有完整的以太坊状态，并从数据库中读取，这很慢。**无状态客户端**的思路是：把区块和一份**区块证明**（witness）一起分发，其中恰好包含该区块触及的状态以及 Merkle 证明，这样节点无需本地状态就能执行它。

这些证明会占用带宽，且成本随访问的存储槽数量增长。EIP-2035 是 State Rent 研究路线图的一部分，提议提高 `SLOAD` 和 `SSTORE` 的价格，让交易为其引发的证明数据付费。第一阶段只覆盖合约存储，节点仍然需要账户数据。

## 它如何运作

- 如果某个存储槽在同一笔交易中**之前没有被访问过**，`SLOAD` 和 `SSTORE` 需要额外支付 `X` gas。对同一存储槽的重复访问不收附加费。
- `X` 没有确定。作者估计，一次未缓存的访问最多给区块证明增加约 1 KB；按当时 calldata 每字节 68 gas 计算，大约要多收 69,000 gas，但规范指出，如果 [EIP-2028](/eip-2028/) 降低了数据成本，这个增幅可能会小得多。
- 未来的一个变体会按合约存储的大小缩放附加费，让小合约更便宜。
- 规范指出，它将部分取代 [EIP-1884](/eip-1884/)，后者出于执行延迟的原因提高了 `SLOAD` 的价格。

## 示例代码

所提议的按交易收取附加费的伪代码：

```python
def storage_access_gas(tx_ctx, address, slot, base_cost):
    key = (address, slot)
    if key not in tx_ctx.accessed_slots:
        tx_ctx.accessed_slots.add(key)
        return base_cost + X          # X: proof-bandwidth surcharge, not yet set
    return base_cost

# SLOAD  -> storage_access_gas(ctx, addr, slot, SLOAD_COST)
# SSTORE -> storage_access_gas(ctx, addr, slot, sstore_cost(...))
```

## 需要注意

- 状态：**Stagnant**。该规范明确是非正式的，从未定稿。
- 对交易内首次（"冷"）访问存储槽多收费的想法，后来以另一种形式进入了主网：Berlin 升级中的 [EIP-2929](/eip-2929/) 为存储和账户访问引入了冷/热定价。
- 在代码中写死存储操作 gas 数量的合约，最容易受到此类重新定价的影响。
- 与之配套的租金预付提案是 [EIP-2026](/eip-2026/)。


---

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