---
eip: 7707
label: EIP-7707
title: Incentivize Access List Provisioning
status: Stagnant
type: Standards Track
category: Core
created: 2024-05-12
requires: 2930
official: https://eips.ethereum.org/EIPS/eip-7707
source: https://github.com/ethereum/EIPs/blob/master/EIPS/eip-7707.md
canonical: https://eips.huatuo.xyz/zh/eip-7707/
lang: zh
tldr: 曾提议把 EIP-2930 访问列表条目的 gas 价格降到与 calldata 相近的水平，让发送者真正愿意提供访问列表，客户端也能并行预取状态。
tags: [gas, access-list, transactions, performance, core]
---

# EIP-7707: Incentivize Access List Provisioning

> This EIP proposes updating gas cost parameters for access lists to incentivise their use and improve transaction execution efficiency.

**TL;DR:** 曾提议把 EIP-2930 访问列表条目的 gas 价格降到与 calldata 相近的水平，让发送者真正愿意提供访问列表，客户端也能并行预取状态。

## 它解决什么问题？

[EIP-2930](/eip-2930/) 允许交易预先声明它将访问哪些地址和存储槽（即*访问列表*）。原则上这对客户端很有利：提前知道要加载什么，就能并行地从磁盘取状态，而不必一次一个随机读，这很重要，因为对某些客户端来说，数据加载占据了区块执行的大部分时间。

实际上几乎没人使用访问列表，因为定价很少划算。列表中每个地址花费 2,400 gas，每个存储键花费 1,900 gas，而预热相比冷 `SLOAD` 每个键只省 100 gas。按规范的分析，每个地址大约需要 24 个键才能勉强回本，而只要有一个键没被用到，成本就远超节省的部分。由于执行路径稍有不同就可能改变访问的存储槽，发送者把访问列表视为风险。

EIP-7707 提议把访问列表做得足够便宜，使得附带一份完整的访问列表成为显而易见的选择。

## 它如何运作

该提案只改动 EIP-2930 中的两个常量：

| 常量 | EIP-2930 | EIP-7707 |
| --- | --- | --- |
| `ACCESS_LIST_ADDRESS_COST` | 2400 | 512 |
| `ACCESS_LIST_STORAGE_KEY_COST` | 1900 | 320 |

新数值按 calldata 的方式给访问列表的字节定价：`字节数 × 4 个 token × 每个 token 4 gas`，如规范所算，地址条目为 32 × 16 = 512，键为 20 × 16 = 320。`SLOAD` 等指令的冷/热访问规则不变，只是声明条目时的预付费用变少了。

按这些数值，规范中的例子（在访问列表中声明一次冷 `SLOAD`）总开销从 4,400 gas 降到 932 gas，比未声明的冷读取的 2,100 gas 还便宜。

## 示例代码

用节点的 `eth_createAccessList` 生成访问列表，并附加到 type-1 或 type-2 交易上（ethers v6）：

```ts
import { JsonRpcProvider, Wallet } from "ethers";

const provider = new JsonRpcProvider(process.env.RPC_URL);
const wallet = new Wallet(process.env.PRIVATE_KEY!, provider);

const req = { from: wallet.address, to: target, data: calldata };
const { accessList } = await provider.send("eth_createAccessList", [req, "latest"]);

const tx = await wallet.sendTransaction({
  ...req,
  type: 2,
  accessList, // [{ address, storageKeys: [...] }, ...]
});
await tx.wait();
```

如今这只对大量读取存储的交易省 gas；EIP-7707 的定价会让普通交易也值得这样做。

## 需要注意

- 状态为 **Stagnant**。这些价格没有在任何网络上生效。
- 更早的尝试 [EIP-3521](/eip-3521/) 只提议降低地址成本；它同样处于 Stagnant。
- 此后协议的方向反而相反：[EIP-7981](/eip-7981/) 提议*提高*访问列表的成本，避免它被当作廉价数据使用，而 [EIP-7928](/eip-7928/) 则引入由区块构建者而非各个发送者生成的区块级访问列表。
- 访问列表只有准确时才有用；节点生成的列表如果在打包前状态发生变化，可能会过时。


---

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