eth_createAccessList
Creates an EIP-2930 access list for a transaction. An access list specifies which addresses and storage slots the transaction will access, allowing for gas savings by pre-declaring state accesses.
Parameters
| # | Type | Description |
|---|---|---|
| 1 | object | Transaction call object. |
| 2 | string | Block number as a hexadecimal string, or a block tag ("latest", "earliest", "pending"). |
The transaction call object supports these fields:
| Field | Type | Required | Description |
|---|---|---|---|
to | string | Yes | The address the transaction is directed to. |
from | string | No | The address the transaction is sent from. |
data | string | No | Encoded function call data. |
value | string | No | Value in wei (hex). |
gas | string | No | Gas limit (hex). |
Returns
object -- An object containing:
| Field | Type | Description |
|---|---|---|
accessList | array | Array of access list entries, each with address and storageKeys. |
gasUsed | string | The estimated gas used with the access list applied (hex). |
Each access list entry:
| Field | Type | Description |
|---|---|---|
address | string | The accessed contract address. |
storageKeys | array | Array of storage slot hashes accessed at that address. |
Example
Create an access list for a WPLS balanceOf call:
curl -s -X POST https://rpc.pulsechain.box \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "eth_createAccessList",
"params": [{
"to": "0xA1077a294dDE1B09bB078844df40758a5D0f9a27",
"data": "0x70a08231000000000000000000000000A1077a294dDE1B09bB078844df40758a5D0f9a27"
}, "latest"],
"id": 1
}'
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"accessList": [
{
"address": "0xa1077a294dde1b09bb078844df40758a5d0f9a27",
"storageKeys": [
"0xf79e760e82419512c64404648588e724a1f537af0e62bed63e85946b3e1e5d96"
]
}
],
"gasUsed": "0x6720"
}
}
Notes
- Access lists allow transactions to pre-declare which addresses and storage slots will be accessed, reducing gas costs for those accesses.
- The first access to a storage slot costs 2100 gas (cold), while subsequent accesses cost 100 gas (warm). Including a slot in the access list makes the first access warm.
- Including the access list in a transaction adds a cost of 2400 gas per address and 1900 gas per storage key, so it only saves gas when enough cold accesses are made.
- This method is useful for optimizing gas usage on complex contract interactions that touch many storage slots.
- The
gasUsedfield reflects the estimated gas consumption with the generated access list applied.
eth_call
Executes a read-only call against a contract without creating a transaction on the blockchain. This is the primary method for reading data from smart contracts, such as querying ERC20 token balances,
eth_getLogs
Returns an array of event logs matching the given filter criteria. This is the primary method for querying contract events such as ERC20 transfers, approvals, and other on-chain activity.
