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.
Parameters
transaction
- The transaction object
Object Name | Required | Type | Detail |
---|---|---|---|
from | ❌ | String | Address the transaction is sent from. |
to | ✅ | String | Address the transaction is directed to. |
gasPrice | ❌ | Integer | A hex code of an integer that represents the price used for each paid gas. |
value | ❌ | Integer | A hex code of an integer that represents the value sent with this transaction. |
data | ❌ | String | Hash of the method signature and encoded parameters |
blockNumberOrTag
- Either the hex value of a block number OR One of the following block tags
Object Name | Required | Type | Detail |
---|---|---|---|
| ❌ | String | • |
"params": [
{
"from": "0x00000000219ab540356cBB839Cbe05303d7705Fa",
"data": "0x608060806080608155"
},
"pending"
]
Result
The transaction hash, or the zero hash if the transaction is not yet available.
Example
Request
curl <your-endpoint> \
-X POST \
-H "Content-Type: application/json" \
-d '{
"method": "eth_createAccessList",
"params": [
{
"from": "0x00000000219ab540356cBB839Cbe05303d7705Fa",
"data": "0x608060806080608155"
},
"pending"
],
"id": 1,
"jsonrpc": "2.0"
}'
Return
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"accessList": [
{
"address": "0xa86a83d1122ae2a9b5f5080236b08abceb713cbe",
"storageKeys": [
"0x0000000000000000000000000000000000000000000000000000000000000081"
]
}
],
"gasUsed": "0x12e92"
}
}