Node RPC
  • Introduction
  • Ethereum API endpoints
    • eth_getBlockByHash
    • eth_blocknumber
    • eth_getBlockByNumber
    • eth_getBlockTransactionCountByHash
    • eth_getBlockTransactionCountByNumber
    • eth_getTransactionByHash
    • eth_getTransactionByBlockHashAndIndex
    • eth_getTransactionByBlockNumberAndIndex
    • eth_getTransactionReceipt
    • eth_getTransactionCount
    • eth_sendRawTransaction
    • eth_call
    • eth_getCode
    • eth_getBalance
    • eth_accounts
    • eth_getStorageAt
    • eth_getProof
    • eth_getLogs
    • eth_newFilter
    • eth_newPendingTransactionFilter
    • eth_newBlockFilter
    • eth_getFilterChanges
    • eth_getFilterLogs
    • eth_uninstallFilter
    • eth_chainId
    • eth_protocolVersion
    • net_listening
    • net_version
    • eth_getUncleCountByBlockHash
    • eth_getUncleByBlockNumberAndIndex
    • eth_getUncleByBlockHashAndIndex
    • eth_getUncleCountByBlockNumber
    • eth_estimateGas
    • eth_gasPrice
    • eth_feeHistory
    • eth_maxPriorityFeePerGas
    • eth_createAccessList
    • web3_clientVersion
    • web3_sha3
Powered by GitBook
On this page
  • Parameters
  • Returns
  • Example
  1. Ethereum API endpoints

eth_createAccessList

Previouseth_maxPriorityFeePerGasNextweb3_clientVersion

Last updated 1 year ago

Ethereum API - Creates an type accessList based on a given Transaction object. Returns list of addresses and storage keys that are read and written by the transaction (except the sender account and precompiles), plus the estimated gas consumed when the access list is added.

Parameters

  • TRANSACTION CALL OBJECT [required]

    • from: [optional] 20 Bytes - The address of the sender.

    • to: 20 Bytes - The address the transaction is directed to.

    • gas: [optional] Hexadecimal value of the gas provided for the transaction execution.

    • gasPrice: [optional] Hexadecimal value gas price, in Wei, provided by the sender. The default is 0. Used only in non-EIP1559 transactions.

    • maxPriorityFeePerGas: [optional] Maximum fee, in Wei, the sender is willing to pay per gas above the base fee. See transactions. If used, must specify maxFeePerGas.

    • maxFeePerGas: [optional] Maximum total fee (base fee + priority fee), in Wei, the sender is willing to pay per gas. See transactions. If used, must specify maxPriorityFeePerGas.

    • value: [optional] hexadecimal value transferred, in Wei.

    • data: [optional] Hash of the method signature and encoded parameters. See the .

  • BLOCK NUMBER or BLOCK HASH: [required] string representing a block number, block hash, or one of the string tags latest, earliest, or pending.

Returns

access list object with the following fields:

  • accessList: list of objects with the following fields:

    • address: addresses to be accessed by the transaction

    • storageKeys: storage keys to be accessed by the transaction

  • gasUsed: string - approximate gas cost for the transaction if the access list is included

Example

Query

import { ethers } from 'ethers';

const provider =
  new ethers
    .providers
    .JsonRpcProvider("https://www.noderpc.xyz/rpc-mainnet/public")

const info = async ()=> {
  const result = await provider.send("eth_createAccessList", [
    {"from": "0xaeA8F8f781326bfE6A7683C2BD48Dd6AA4d3Ba63", "data": "0x608060806080608155"}, "latest"
  ]);
  console.log(result);
}
info();

Result

{
    "accessList": [
        {
            "address": "0x45e5af19ae13aac19215266edfab04f8db6f2c53",
            "storageKeys": [
                "0x0000000000000000000000000000000000000000000000000000000000000081"
            ]
        }
    ],
    "gasUsed": "0x12e92"
}

NOTE: In this example we are using public Ethereum endpoint. Ideally, for your own projects, you should use your own endpoint, which you can generate for free by connecting to your wallet .

NOTE: ethers used below is a well-known web3 library, check it out .

EIP2930
EIP-1559
EIP-1559
Ethereum contract ABI specification
here
here