Overview
AccessList is a branded array type representing EIP-2930 access lists. Each entry contains a contract address and the storage keys that will be accessed at that address.- Type Definition
- Gas Constants
Quick Start
- Create Access List
- Calculate Gas Savings
- Build Incrementally
API Reference
Constructors
| Method | Description |
|---|---|
create() | Create empty access list |
from(items | bytes) | Create from array of items or RLP bytes |
fromBytes(bytes) | Decode from RLP-encoded bytes |
Gas Calculation
| Method | Description |
|---|---|
gasCost(list) | Total gas cost of access list itself |
gasSavings(list) | Net gas savings vs cold access |
hasSavings(list) | Returns true if access list saves gas |
Queries
| Method | Description |
|---|---|
includesAddress(list, address) | Check if address is in list |
includesStorageKey(list, address, key) | Check if storage key is accessible |
keysFor(list, address) | Get all storage keys for address |
addressCount(list) | Count of addresses in list |
storageKeyCount(list) | Total storage keys across all addresses |
isEmpty(list) | Check if list has no entries |
Manipulation
| Method | Description |
|---|---|
withAddress(list, address) | Add address (returns new list) |
withStorageKey(list, address, key) | Add storage key (returns new list) |
merge(...lists) | Combine multiple access lists |
deduplicate(list) | Remove duplicate addresses and keys |
Validation & Conversion
| Method | Description |
|---|---|
is(value) | Type guard for AccessList |
isItem(value) | Type guard for AccessList Item |
assertValid(list) | Throws if list is invalid |
toBytes(list) | RLP-encode to bytes |
Constants
| Constant | Value | Description |
|---|---|---|
ADDRESS_COST | 2400n | Gas per address in access list |
STORAGE_KEY_COST | 1900n | Gas per storage key |
COLD_ACCOUNT_ACCESS_COST | 2600n | Gas for cold account access |
COLD_STORAGE_ACCESS_COST | 2100n | Gas for cold storage access |
WARM_STORAGE_ACCESS_COST | 100n | Gas for warm storage access |
Practical Examples
Transaction with Access List
Merging Access Lists from Simulation
Finding Accessed Storage
When to Use Access Lists
Access lists provide net gas savings when:- Multiple cold accesses: Accessing the same address/slot multiple times
- Complex DeFi operations: Swaps, lending, multi-hop transactions
- Batch operations: Multiple transfers or contract interactions
- Contract calls with many SLOAD: Storage-heavy operations
- Address: Saves 200 gas per address (2600 - 2400)
- Storage key: Saves 200 gas per key (2100 - 1900)
hasSavings() to verify before including in transactions.

