{"eip":3521,"title":"Reduce access list cost","description":"Reduce the cost of declaring tx.to storage keys in access lists.","authors":["Matt Garnett (@lightclient)"],"status":"Stagnant","type":"Standards Track","category":"Core","created":"2021-04-15","requires":[2028,2930],"discussionsTo":"https://ethereum-magicians.org/t/eip-3521-reduce-access-list-cost/6072","repo":"EIPs","label":"EIP-3521","officialUrl":"https://eips.ethereum.org/EIPS/eip-3521","sourceUrl":"https://github.com/ethereum/EIPs/blob/master/EIPS/eip-3521.md","url":"https://eips.huatuo.xyz/eip-3521/","tldr":{"en":"Proposed charging tx.to in an access list only as calldata instead of the full 2400-gas address cost, since it is warm anyway, making access lists worthwhile far sooner.","ja":"アクセスリスト内の tx.to を、どのみちウォームなので、2400 ガスのアドレス料金全額ではなく calldata としてのみ課金することを提案した。アクセスリストがはるかに早い段階で割に合うようになる。","ko":"접근 목록의 tx.to를 어차피 웜 상태이므로 2400 가스의 전체 주소 비용 대신 calldata로만 과금하자고 제안했다. 접근 목록이 훨씬 일찍 이득이 되게 만든다.","zh":"提议对访问列表中的 tx.to 仅按 calldata 收费，而不是收取完整的 2400 gas 地址费用，因为它本来就是热的，从而让访问列表远早于现在就变得划算。"},"tags":["gas","access-list","transactions","core","optimization"],"explainers":{"en":{"lang":"en","tldr":"Proposed charging tx.to in an access list only as calldata instead of the full 2400-gas address cost, since it is warm anyway, making access lists worthwhile far sooner.","tags":["gas","access-list","transactions","core","optimization"],"related":[2930,2929,2028],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/eip-3521/","markdown":"## What problem does it solve?\n\n[EIP-2929](/eip-2929/) made the first access to an address or storage slot in a transaction \"cold\" and expensive, and later accesses \"warm\" and cheap. [EIP-2930](/eip-2930/) added **access lists**: a transaction can declare up front which addresses and slots it will touch, paying a fixed price per entry so they start warm.\n\nFor storage in the contract being called (`tx.to`) this rarely pays off. To pre-warm its slots you must list the address, paying `ACCESS_LIST_ADDRESS_COST` (2400 gas), even though `tx.to` is already warm by default. According to the spec, a transaction had to read about 25 distinct slots in `tx.to` before an access list became cheaper than not using one.\n\nEIP-3521 removes that double charge.\n\n## How it works\n\n- The **first occurrence of `tx.to`** in an access list is not charged `ACCESS_LIST_ADDRESS_COST`. Instead, its 20 bytes are charged like calldata (per [EIP-2028](/eip-2028/): 16 gas per non-zero byte, 4 per zero byte).\n- Storage keys under that address are charged as before (`ACCESS_LIST_STORAGE_KEY_COST`).\n- Any repeat of `tx.to`, and every other address, is charged the normal address cost.\n- For contract-creation transactions (`tx.to == nil`), `tx.to` means the address of the contract being created.\n\nCalldata pricing was chosen as the floor: listing `tx.to` adds no work for clients, since it is already in the accessed-addresses set, so only the data itself should be paid for.\n\nThe spec says this cuts the break-even point from roughly 25 slots to about 5 unique reads.\n\n## Sample code\n\nAccess-list gas under EIP-3521, for the list part only (pseudocode, matching the spec's test cases):\n\n```python\nACCESS_LIST_ADDRESS_COST = 2400\nACCESS_LIST_STORAGE_KEY_COST = 1900\n\ndef calldata_cost(b: bytes) -\u003e int:\n    return sum(16 if x else 4 for x in b)\n\ndef access_list_cost(access_list, tx_to: bytes) -\u003e int:\n    cost, seen_to = 0, False\n    for address, keys in access_list:\n        if address == tx_to and not seen_to:\n            cost += calldata_cost(address)      # e.g. 20 non-zero bytes -\u003e 320\n            seen_to = True\n        else:\n            cost += ACCESS_LIST_ADDRESS_COST\n        cost += ACCESS_LIST_STORAGE_KEY_COST * len(keys)\n    return cost\n\nto = bytes.fromhex(\"ff\" * 20)\nassert access_list_cost([(to, [])], to) == 320\nassert access_list_cost([(to, []), (to, [])], to) == 2720\nassert access_list_cost([(to, [b\"\\x00\"]), (to, [b\"\\x00\"])], to) == 6520\n```\n\n## Things to know\n\n- Status is **Stagnant**. It was not included in any upgrade; access lists are still priced as in EIP-2930.\n- Under current rules you can check whether an access list helps a given transaction with `eth_createAccessList` and comparing gas estimates with and without it.\n- The change only affects how much the access list itself costs; warm/cold access pricing during execution stays as EIP-2929 defines.\n"},"ja":{"lang":"ja","tldr":"アクセスリスト内の tx.to を、どのみちウォームなので、2400 ガスのアドレス料金全額ではなく calldata としてのみ課金することを提案した。アクセスリストがはるかに早い段階で割に合うようになる。","tags":["gas","access-list","transactions","core","optimization"],"related":[2930,2929,2028],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ja/eip-3521/","markdown":"## 何を解決するのか\n\n[EIP-2929](/eip-2929/) は、トランザクション内でアドレスやストレージスロットに最初にアクセスする際を「コールド」で高価に、以降のアクセスを「ウォーム」で安価にしました。[EIP-2930](/eip-2930/) は**アクセスリスト**を追加しました。トランザクションが、触れるアドレスとスロットを事前に宣言し、エントリごとに固定の料金を支払うことで、それらが最初からウォームになります。\n\n呼び出されるコントラクト（`tx.to`）内のストレージについては、これはめったに割に合いません。そのスロットを事前にウォームにするにはアドレスを列挙しなければならず、`tx.to` はデフォルトですでにウォームであるにもかかわらず、`ACCESS_LIST_ADDRESS_COST`（2400 ガス）を支払うことになります。仕様によれば、アクセスリストを使わない場合よりも安くなるには、トランザクションが `tx.to` 内でおよそ 25 個の異なるスロットを読む必要がありました。\n\nEIP-3521 は、この二重の課金をなくします。\n\n## 仕組み\n\n- アクセスリスト内の **`tx.to` の最初の出現**には、`ACCESS_LIST_ADDRESS_COST` が課されません。代わりに、その 20 バイトが calldata と同様に課金されます（[EIP-2028](/eip-2028/) に従い、非ゼロのバイトは 16 ガス、ゼロのバイトは 4 ガス）。\n- そのアドレスの下のストレージキーは、従来どおり課金されます（`ACCESS_LIST_STORAGE_KEY_COST`）。\n- `tx.to` の 2 回目以降の出現と、それ以外のすべてのアドレスには、通常のアドレス料金が課されます。\n- コントラクト作成トランザクション（`tx.to == nil`）では、`tx.to` は作成されるコントラクトのアドレスを意味します。\n\ncalldata の価格設定が下限として選ばれたのは、`tx.to` を列挙してもクライアントの作業は増えないからです。すでにアクセス済みアドレスの集合に入っているため、データそのものにだけ料金を払うべきだという考え方です。\n\n仕様によれば、これにより損益分岐点が約 25 スロットから約 5 個の一意な読み取りに下がります。\n\n## サンプルコード\n\nEIP-3521 におけるアクセスリストのガス（リスト部分のみ、擬似コード、仕様のテストケースに対応）:\n\n```python\nACCESS_LIST_ADDRESS_COST = 2400\nACCESS_LIST_STORAGE_KEY_COST = 1900\n\ndef calldata_cost(b: bytes) -\u003e int:\n    return sum(16 if x else 4 for x in b)\n\ndef access_list_cost(access_list, tx_to: bytes) -\u003e int:\n    cost, seen_to = 0, False\n    for address, keys in access_list:\n        if address == tx_to and not seen_to:\n            cost += calldata_cost(address)      # e.g. 20 non-zero bytes -\u003e 320\n            seen_to = True\n        else:\n            cost += ACCESS_LIST_ADDRESS_COST\n        cost += ACCESS_LIST_STORAGE_KEY_COST * len(keys)\n    return cost\n\nto = bytes.fromhex(\"ff\" * 20)\nassert access_list_cost([(to, [])], to) == 320\nassert access_list_cost([(to, []), (to, [])], to) == 2720\nassert access_list_cost([(to, [b\"\\x00\"]), (to, [b\"\\x00\"])], to) == 6520\n```\n\n## 知っておくべきこと\n\n- ステータスは **Stagnant** です。どのアップグレードにも含まれず、アクセスリストの価格は今も EIP-2930 のままです。\n- 現行のルールでは、`eth_createAccessList` を使い、アクセスリストがある場合とない場合のガス見積もりを比較することで、特定のトランザクションにアクセスリストが役立つかを確認できます。\n- この変更が影響するのはアクセスリスト自体のコストだけです。実行中のウォーム/コールドのアクセス価格は、EIP-2929 の定義のままです。\n"},"ko":{"lang":"ko","tldr":"접근 목록의 tx.to를 어차피 웜 상태이므로 2400 가스의 전체 주소 비용 대신 calldata로만 과금하자고 제안했다. 접근 목록이 훨씬 일찍 이득이 되게 만든다.","tags":["gas","access-list","transactions","core","optimization"],"related":[2930,2929,2028],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ko/eip-3521/","markdown":"## 어떤 문제를 해결하나요?\n\n[EIP-2929](/eip-2929/)는 트랜잭션에서 주소나 스토리지 슬롯에 처음 접근하는 것을 \"콜드\"로 비싸게, 이후 접근을 \"웜\"으로 싸게 만들었습니다. [EIP-2930](/eip-2930/)은 **접근 목록**을 추가했습니다. 트랜잭션이 건드릴 주소와 슬롯을 미리 선언하고 항목당 고정 가격을 내면, 그것들이 처음부터 웜 상태가 됩니다.\n\n호출되는 컨트랙트(`tx.to`)의 스토리지에는 이것이 거의 이득이 되지 않습니다. 그 슬롯을 미리 웜으로 만들려면 주소를 나열해야 하고 `ACCESS_LIST_ADDRESS_COST`(2400 가스)를 내야 하는데, `tx.to`는 기본적으로 이미 웜 상태입니다. 명세에 따르면 접근 목록이 쓰지 않는 것보다 싸지려면 트랜잭션이 `tx.to`에서 서로 다른 슬롯을 약 25개 읽어야 했습니다.\n\nEIP-3521은 이 이중 과금을 없앱니다.\n\n## 어떻게 동작하나요?\n\n- 접근 목록에서 **`tx.to`의 첫 번째 등장**에는 `ACCESS_LIST_ADDRESS_COST`가 부과되지 않습니다. 대신 그 20바이트가 calldata처럼 과금됩니다([EIP-2028](/eip-2028/)에 따라 0이 아닌 바이트당 16 가스, 0 바이트당 4 가스).\n- 그 주소 아래의 스토리지 키는 이전처럼 과금됩니다(`ACCESS_LIST_STORAGE_KEY_COST`).\n- `tx.to`의 반복 등장과 그 밖의 모든 주소에는 일반 주소 비용이 부과됩니다.\n- 컨트랙트 생성 트랜잭션(`tx.to == nil`)에서 `tx.to`는 생성되는 컨트랙트의 주소를 뜻합니다.\n\ncalldata 가격이 하한으로 선택된 이유는 `tx.to`를 나열해도 클라이언트의 작업이 늘지 않기 때문입니다. 이미 접근된 주소 집합에 들어 있으므로 데이터 자체에 대해서만 값을 치르면 된다는 것입니다.\n\n명세에 따르면 이로써 손익분기점이 약 25개 슬롯에서 약 5개의 고유한 읽기로 낮아집니다.\n\n## 샘플 코드\n\nEIP-3521에서의 접근 목록 가스, 목록 부분만(의사 코드, 명세의 테스트 케이스에 대응):\n\n```python\nACCESS_LIST_ADDRESS_COST = 2400\nACCESS_LIST_STORAGE_KEY_COST = 1900\n\ndef calldata_cost(b: bytes) -\u003e int:\n    return sum(16 if x else 4 for x in b)\n\ndef access_list_cost(access_list, tx_to: bytes) -\u003e int:\n    cost, seen_to = 0, False\n    for address, keys in access_list:\n        if address == tx_to and not seen_to:\n            cost += calldata_cost(address)      # e.g. 20 non-zero bytes -\u003e 320\n            seen_to = True\n        else:\n            cost += ACCESS_LIST_ADDRESS_COST\n        cost += ACCESS_LIST_STORAGE_KEY_COST * len(keys)\n    return cost\n\nto = bytes.fromhex(\"ff\" * 20)\nassert access_list_cost([(to, [])], to) == 320\nassert access_list_cost([(to, []), (to, [])], to) == 2720\nassert access_list_cost([(to, [b\"\\x00\"]), (to, [b\"\\x00\"])], to) == 6520\n```\n\n## 알아둘 점\n\n- 상태는 **Stagnant**입니다. 어떤 업그레이드에도 포함되지 않았으며, 접근 목록은 여전히 EIP-2930대로 가격이 매겨집니다.\n- 현재 규칙에서는 `eth_createAccessList`를 사용하고 접근 목록이 있을 때와 없을 때의 가스 추정치를 비교해, 특정 트랜잭션에 접근 목록이 도움이 되는지 확인할 수 있습니다.\n- 이 변경은 접근 목록 자체의 비용에만 영향을 줍니다. 실행 중의 웜/콜드 접근 가격은 EIP-2929가 정의한 그대로입니다.\n"},"zh":{"lang":"zh","tldr":"提议对访问列表中的 tx.to 仅按 calldata 收费，而不是收取完整的 2400 gas 地址费用，因为它本来就是热的，从而让访问列表远早于现在就变得划算。","tags":["gas","access-list","transactions","core","optimization"],"related":[2930,2929,2028],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/zh/eip-3521/","markdown":"## 它解决什么问题？\n\n[EIP-2929](/eip-2929/) 让交易中首次访问某个地址或存储槽位变为\"冷\"而昂贵，之后的访问则\"热\"而廉价。[EIP-2930](/eip-2930/) 增加了**访问列表**：交易可以预先声明它将触及的地址和槽位，为每个条目支付固定价格，使它们一开始就是热的。\n\n对于被调用合约（`tx.to`）中的存储，这很少划算。要预热它的槽位，你必须列出该地址，支付 `ACCESS_LIST_ADDRESS_COST`（2400 gas），尽管 `tx.to` 默认已经是热的。根据规范，交易需要在 `tx.to` 中读取大约 25 个不同的槽位，访问列表才会比不用更便宜。\n\nEIP-3521 消除了这种重复收费。\n\n## 它如何运作\n\n- 访问列表中 **`tx.to` 的第一次出现**不再收取 `ACCESS_LIST_ADDRESS_COST`。取而代之的是，它的 20 个字节按 calldata 收费（依据 [EIP-2028](/eip-2028/)：每个非零字节 16 gas，每个零字节 4 gas）。\n- 该地址下的存储键照旧收费（`ACCESS_LIST_STORAGE_KEY_COST`）。\n- `tx.to` 的任何重复出现，以及所有其他地址，都按正常的地址费用收取。\n- 对于合约创建交易（`tx.to == nil`），`tx.to` 指被创建合约的地址。\n\n选择 calldata 定价作为下限，是因为列出 `tx.to` 不会给客户端增加任何工作，它本来就在已访问地址集合中，所以只应为数据本身付费。\n\n规范称，这将盈亏平衡点从大约 25 个槽位降到约 5 次唯一读取。\n\n## 示例代码\n\nEIP-3521 下的访问列表 gas，仅针对列表部分（伪代码，对应规范的测试用例）：\n\n```python\nACCESS_LIST_ADDRESS_COST = 2400\nACCESS_LIST_STORAGE_KEY_COST = 1900\n\ndef calldata_cost(b: bytes) -\u003e int:\n    return sum(16 if x else 4 for x in b)\n\ndef access_list_cost(access_list, tx_to: bytes) -\u003e int:\n    cost, seen_to = 0, False\n    for address, keys in access_list:\n        if address == tx_to and not seen_to:\n            cost += calldata_cost(address)      # e.g. 20 non-zero bytes -\u003e 320\n            seen_to = True\n        else:\n            cost += ACCESS_LIST_ADDRESS_COST\n        cost += ACCESS_LIST_STORAGE_KEY_COST * len(keys)\n    return cost\n\nto = bytes.fromhex(\"ff\" * 20)\nassert access_list_cost([(to, [])], to) == 320\nassert access_list_cost([(to, []), (to, [])], to) == 2720\nassert access_list_cost([(to, [b\"\\x00\"]), (to, [b\"\\x00\"])], to) == 6520\n```\n\n## 需要注意\n\n- 状态为 **Stagnant**。它没有被纳入任何升级；访问列表仍按 EIP-2930 定价。\n- 在当前规则下，你可以用 `eth_createAccessList` 并比较使用和不使用访问列表时的 gas 估算值，来检查访问列表是否对某笔交易有帮助。\n- 这一变更只影响访问列表本身的成本；执行期间的冷/热访问定价仍按 EIP-2929 的定义。\n"}}}
