eth_createAccessList - HashKey Chain

This method returns an EIP-2930 access list for a transaction along with the gas used, which can reduce gas costs for transactions that touch many storage slots.

Parameters

ParameterTypeRequiredDescription
transactionobjectYesTransaction call object
blockParameterstringNoBlock number in hex, or "latest", "pending"

Transaction Object

FieldTypeRequiredDescription
fromstringNo20-byte sender address
tostringYes20-byte recipient/contract address
datastringNoEncoded function call data

Request

bashcurl --location --request POST 'https://shared.us-east-1.getblock.io/<ACCESS-TOKEN>/' \
--header 'Content-Type: application/json' \
--data-raw '{
    "jsonrpc": "2.0",
    "method": "eth_createAccessList",
    "params": [{ "from": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045", "to": "0x177b1a2c3d4e5f60718293a4b5c6d7e8f90a1b2c", "data": "0x70a08231000000000000000000000000d8da6bf26964af9d7eed9e03e53415d37aa96045" }, "latest"],
    "id": "getblock.io"
}'

example.js

javascriptconst axios = require('axios');

const response = await axios.post('https://shared.us-east-1.getblock.io/<ACCESS-TOKEN>/', {
    jsonrpc: '2.0',
    method: 'eth_createAccessList',
    params: [{ from: '0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045', to: '0x177b1a2c3d4e5f60718293a4b5c6d7e8f90a1b2c', data: '0x70a08231000000000000000000000000d8da6bf26964af9d7eed9e03e53415d37aa96045' }, 'latest'],
    id: 'getblock.io'
}, {
    headers: { 'Content-Type': 'application/json' }
});

console.log(response.data.result);

example.py

pythonimport requests

response = requests.post(
    'https://shared.us-east-1.getblock.io/<ACCESS-TOKEN>/',
    headers={'Content-Type': 'application/json'},
    json={
        'jsonrpc': '2.0',
        'method': 'eth_createAccessList',
        'params': [{ 'from': '0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045', 'to': '0x177b1a2c3d4e5f60718293a4b5c6d7e8f90a1b2c', 'data': '0x70a08231000000000000000000000000d8da6bf26964af9d7eed9e03e53415d37aa96045' }, 'latest'],
        'id': 'getblock.io'
    }
)

print(response.json())

example.rs

rustuse reqwest::Client;
use serde_json::{json, Value};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = Client::new();

    let response = client
        .post("https://shared.us-east-1.getblock.io/<ACCESS-TOKEN>/")
        .header("Content-Type", "application/json")
        .json(&json!({
            "jsonrpc": "2.0",
            "method": "eth_createAccessList",
            "params": [{ "from": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045", "to": "0x177b1a2c3d4e5f60718293a4b5c6d7e8f90a1b2c", "data": "0x70a08231000000000000000000000000d8da6bf26964af9d7eed9e03e53415d37aa96045" }, "latest"],
            "id": "getblock.io"
        }))
        .send()
        .await?
        .json::<Value>()
        .await?;

    println!("Result: {}", response["result"]);
    Ok(())
}

Response

json{
    "jsonrpc": "2.0",
    "id": "getblock.io",
    "result": {
        "accessList": [
            {
                "address": "0x177b1a2c3d4e5f60718293a4b5c6d7e8f90a1b2c",
                "storageKeys": [
                    "0x0000000000000000000000000000000000000000000000000000000000000000"
                ]
            }
        ],
        "gasUsed": "0x64a3"
    }
}

Response Parameters

ParameterTypeDescription
jsonrpcstringJSON-RPC protocol version ("2.0")
idstringRequest identifier matching the request
resultobjectAccess list plus gas used (see fields below)

Result Object

FieldTypeDescription
accessListarrayAddresses and storage keys the transaction accesses
gasUsedstringGas used when the access list is applied (hex)

Use Cases

  • Gas Optimization: Attach an access list to reduce SLOAD costs on hot slots
  • Type-1 Transactions: Build EIP-2930 access-list transactions
  • Simulation: Discover which storage slots a call touches
  • Tooling: Feed generated access lists into transaction builders

Error Handling

Error CodeMessageDescription
-32602Invalid paramsMalformed transaction object or block parameter
-32000Execution errorThe transaction failed while building the access list

Web3 Integration

ethers-example.js

javascriptimport { ethers } from 'ethers';

const provider = new ethers.JsonRpcProvider('https://shared.us-east-1.getblock.io/<ACCESS-TOKEN>/');

const al = await provider.send('eth_createAccessList', [{ from: '0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045', to: '0x177b1a2c3d4e5f60718293a4b5c6d7e8f90a1b2c', data: '0x70a08231000000000000000000000000d8da6bf26964af9d7eed9e03e53415d37aa96045' }, 'latest']);

viem-example.js

javascriptimport { createPublicClient, http } from 'viem';

const client = createPublicClient({
  transport: http('https://shared.us-east-1.getblock.io/<ACCESS-TOKEN>/')
});

const al = await client.request({ method: 'eth_createAccessList', params: [{ from: '0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045', to: '0x177b1a2c3d4e5f60718293a4b5c6d7e8f90a1b2c', data: '0x70a08231000000000000000000000000d8da6bf26964af9d7eed9e03e53415d37aa96045' }, 'latest'] });