---
eip: 2929
label: EIP-2929
title: Gas cost increases for state access opcodes
status: Final
type: Standards Track
category: Core
created: 2020-09-01
official: https://eips.ethereum.org/EIPS/eip-2929
source: https://github.com/ethereum/EIPs/blob/master/EIPS/eip-2929.md
canonical: https://eips.huatuo.xyz/eip-2929/
lang: en
tldr: "Introduced warm and cold state access: the first touch of an address or storage slot in a transaction costs 2600 or 2100 gas, later touches cost 100, closing a long-standing DoS vector."
tags: [gas, evm, state, access-lists, berlin]
---

# EIP-2929: Gas cost increases for state access opcodes

> Increases gas cost for SLOAD, CALL, BALANCE, EXT and SELFDESTRUCT when used for the first time in a transaction.

**TL;DR:** Introduced warm and cold state access: the first touch of an address or storage slot in a transaction costs 2600 or 2100 gas, later touches cost 100, closing a long-standing DoS vector.

## What problem does it solve?

Opcodes that read state, such as `SLOAD`, `BALANCE`, `EXTCODESIZE` and the `CALL` family, may force a node to fetch data from disk. They had been underpriced for years. The authors cite research in which deliberately IO-heavy transactions took 20 to 80 seconds to process, compared with milliseconds for an average transaction.

Simply raising every price would have punished contracts that read the same data repeatedly, even though the second read hits a cache. EIP-2929 charges the expensive price only the **first** time something is touched in a transaction. It went live in the Berlin upgrade (April 2021).

## How it works

During each transaction the client keeps two sets:

- `accessed_addresses`, pre-filled with the sender, `tx.to` (or the created contract) and all precompiles;
- `accessed_storage_keys`, a set of `(address, slot)` pairs, starting empty.

| Constant | Gas |
| --- | --- |
| `COLD_ACCOUNT_ACCESS_COST` | 2600 |
| `COLD_SLOAD_COST` | 2100 |
| `WARM_STORAGE_READ_COST` | 100 |

- **Account access** (`BALANCE`, `EXTCODESIZE`, `EXTCODECOPY`, `EXTCODEHASH`, `CALL`, `CALLCODE`, `DELEGATECALL`, `STATICCALL`): 2600 if the address is cold (then mark it warm), otherwise 100. For calls this is charged before the 63/64 gas forwarding rule.
- **`SLOAD`**: 2100 if the slot is cold, otherwise 100.
- **`SSTORE`**: adds 2100 if the slot is cold. [EIP-2200](/eip-2200/) parameters are adjusted (`SLOAD_GAS` becomes 100, `SSTORE_RESET_GAS` becomes `5000 - 2100`), so a cold read-modify-write costs about the same as before.
- **`SELFDESTRUCT`**: adds 2600 if the beneficiary is cold.
- `CREATE`/`CREATE2` warm the new address immediately.
- If a call frame reverts, the warm sets roll back to their state before that frame.

## Sample code

Gas difference between a cold and a warm read in one transaction:

```solidity
contract WarmCold {
    uint256 public x = 1;

    function readTwice() external view returns (uint256 cold, uint256 warm) {
        uint256 g = gasleft();
        uint256 a = x;               // first SLOAD of this slot: cold (2100)
        cold = g - gasleft();
        g = gasleft();
        uint256 b = x;               // same slot again: warm (100)
        warm = g - gasleft();
        require(a == b);
    }
}
```

(The measured numbers include a little overhead, and the optimiser may merge the two reads.)

Pre-warming with an access list ([EIP-2930](/eip-2930/)), ethers v6:

```ts
const tx = await wallet.sendTransaction({
  to: token,
  data,
  accessList: [{ address: token, storageKeys: [balanceSlot] }],
});
```

## Things to know

- **Status: Final**, activated in Berlin alongside [EIP-2930](/eip-2930/) access lists, which let a transaction declare addresses and slots up front to pre-pay them at a slightly lower rate and avoid breaking contracts with hard-coded gas.
- Contracts that forward a fixed amount of gas, or rely on the 2300 gas stipend of `transfer`/`send`, can break when a callee's first storage read now costs 2100. Avoid hard-coded gas amounts.
- The warm/cold model is the basis for later changes: [EIP-3651](/eip-3651/) pre-warms the block's `COINBASE`, and refund rules were revised in [EIP-3529](/eip-3529/).
- Reading the same slot repeatedly is now cheap; reading many distinct slots or contracts is what costs gas.


---

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