EIP-2930 · Final · Core · 2020-08-29
EIP-2930: Optional access lists
Added the type-1 transaction with an access list: addresses and storage slots a transaction declares up front and pre-pays for at a small discount, so later accesses are warm.
What problem does it solve?
EIP-2929, shipped alongside this one in the Berlin upgrade (2021), made the first access to an account or storage slot in a transaction much more expensive ("cold"), while repeated accesses became cheap ("warm"). That fixed a denial-of-service risk but threatened contracts that made calls with a hard-coded gas stipend: a cold access could now push them out of gas.
EIP-2930 gives transactions a way to declare in advance which accounts and slots they will touch and pay for them up front. During execution those are already warm, costing just 100 gas. It also introduced the access-list format itself, which later features reuse.
How it works
A new EIP-2718 transaction type 0x01:
0x01 || rlp([chainId, nonce, gasPrice, gasLimit, to, value, data,
accessList, signatureYParity, signatureR, signatureS])
accessListis a list of[address, [storageKey, ...]]pairs.- At the start of execution, on top of the normal intrinsic gas, the transaction pays 2,400 gas per address and 1,900 gas per storage key. These are added to the warm sets, so in-transaction accesses cost 100 instead of the cold price (2,600 for an account, 2,100 for a slot).
- Accesses not in the list still work; they just pay the cold price.
- Duplicates are allowed but charged each time, so there is no reason to include them.
- The signature covers the type byte, so a type-1 transaction cannot be reinterpreted as another type.
chainIdis a first-class field.
The EIP-1559 type-2 transaction carries the same accessList field.
Sample code
JSON form of an access list, as used by eth_sendTransaction and eth_createAccessList:
[
{
"address": "0xde0b295669a9fd93d5f28d9ec85e40f4cb697bae",
"storageKeys": [
"0x0000000000000000000000000000000000000000000000000000000000000003",
"0x0000000000000000000000000000000000000000000000000000000000000007"
]
}
]
Sending a type-1 transaction with ethers v6:
import { JsonRpcProvider, Wallet } from "ethers";
const provider = new JsonRpcProvider(process.env.RPC_URL);
const wallet = new Wallet(process.env.PRIVATE_KEY!, provider);
const tx = await wallet.sendTransaction({
type: 1,
to: contractAddress,
data: calldata,
accessList: [
{ address: contractAddress, storageKeys: ["0x" + "00".repeat(31) + "03"] },
],
});
await tx.wait();
Things to know
- The discount is small (about 10 % versus a cold access), so access lists only pay off when you are sure the slots will be touched. Listing something that is never accessed just wastes gas.
- Many nodes offer
eth_createAccessListto simulate a transaction and suggest a list. - The access list is charged per item, not per byte, and per-byte it is more expensive than calldata, so it cannot be used to bloat blocks cheaply.
- Status is Final, activated in Berlin. Block-level access lists in EIP-7928 are a separate, later idea.