Description is below.
This method creates an EIP2930 type accessList
based on a given Transaction. The accessList
contains all storage slots and addresses read and written by the transaction, except for the sender account and the precompiles. This method uses the same transaction call
object and blockNumberOrTag
object as eth_call
. An accessList
can be used to unstuck contracts that became inaccessible due to gas cost increases.
Parameters
Object
- The transaction call objectfrom
:DATA
, 20 Bytes - (optional) The address the transaction is sent from.to
:DATA
, 20 Bytes - The address the transaction is directed to.gas
:QUANTITY
- (optional) Integer of the gas provided for the transaction execution. eth_call consumes zero gas, but this parameter may be needed by some executions.gasPrice
:QUANTITY
- (optional) Integer of the gasPrice used for each paid gasmaxPriorityFeePerGas
: Maximum fee, in Wei, the sender is willing to pay per gas above the base fee. See EIP-1559 transactions.maxFeePerGas
: Maximum total fee (base fee + priority fee), in Wei, the sender is willing to pay per gas. See EIP-1559 transactions.value
:QUANTITY
- (optional) Integer of the value sent with this transactiondata
:DATA
- (optional) Hash of the method signature and encoded parameters. For details see Ethereum Contract ABI in the Solidity documentation.
QUANTITY
|TAG
- integer block number, or the string "latest", "earliest" or "pending", see the default block parameter
curl https://polygon-mainnet-archive.allthatnode.com/8U3JLUhzIDg3GShvy9hkCCSYkLGc11kj \
--request POST \
--header "Content-Type: application/json" \
--data '
{
"id": 1,
"jsonrpc": "2.0",
"method": "eth_createAccessList",
"params": [
{
"from": "0x014e32b21c634259b1a281ceae50ba88979cd084",
"to": "0x7ceb23fd6bc0add59e62ac25578270cff1b9f619",
"gas": "0x13880",
"gasPrice": "0x12D7BD4351",
"data": "0x095ea7b3000000000000000000000000ba12222222228d8ba445958a75a0704d566bf2c800000000000000000000000000000000000000000000000000925f2e84bf0000"
},
"0x2B9ACCD"
]
}
'
Returns
address
,storageKeys
, andgasUsed
It gives the list of addresses and storageKeys that will be used by that transaction, plus the gas consumed if the access list is included. Like eth_estimateGas
, this is an estimation; the list could change when the transaction is actually mined. Adding an accessList
to a transaction does not necessary result in lower gas usage compared to a transaction without an access list.
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"accessList": [
{
"address": "0x7ceb23fd6bc0add59e62ac25578270cff1b9f619",
"storageKeys": [
"0xba10e2558f34bc7bc91462140a0fc8ac94dac8a258936c5b83badab513f729d9"
]
}
],
"gasUsed": "0x7010"
}
}