Updated on 2023-12-06 GMT+08:00

eth_createAccessList

Introduction

This API creates an EIP-2930 type accessList based on a given Transaction object. It returns a list of addresses and storage keys that are read and written by the transaction (except the sender account and precompiles). It consumes 44 CUs.

Parameter Description

It consists of transaction-related fields and the block number.

Parameter

Type

Description

from

String

The address from which the transaction is sent.

to

String

The address to which the transaction is directed.

gas

Integer

The integer of gas provided for the transaction execution.

gasPrice

Integer

The integer of gasPrice used for each paid gas encoded as hexadecimal.

value

Integer

The integer of value sent with this transaction encoded as hexadecimal.

data

String

The hash of the method signature and encoded parameters. For more information, see the Contract ABI description in the Solidity documentation.

Block number

String

A hexadecimal block number, or the string (earliest, latest, or pending).

Return Value

It returns a 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.

accessList: a list of objects with the following fields:
  • address: the addresses to be accessed by the transaction.
  • storageKeys: the storage keys to be accessed by the transaction.
  • gasUsed: a hexadecimal string representing the approximate gas cost for the transaction if the access list is included.

Request

curl https://your-http-endpoint/v1/<API-KEY> \
    -X POST \
    -H "Content-Type: application/json" \
    -d '{"method":"eth_createAccessList","params":[{"from": "0xaeA8F8f781326bfE6A7683C2BD48Dd6AA4d3Ba63", "data": "0x608060806080608155"}, "pending"],"id":1,"jsonrpc":"2.0"}'