L0vdL0vd

eth_createAccessList

Builds an EIP-2930 access list for a transaction and reports the gas it would use with it.

归档 · 可查询任意历史区块

curl https://eth.l0vdinfra.com/YOUR_KEY \
  -X POST \
  -H "Content-Type: application/json" \
  --data '{"jsonrpc":"2.0","id":1,"method":"eth_createAccessList","params":[{"from":"0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045","to":"0xdAC17F958D2ee523a2206206994597C13D831ec7","data":"0x18160ddd"},"0x1208a5f"]}'

响应示例

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "accessList": [
      {
        "address": "0xdac17f958d2ee523a2206206994597c13d831ec7",
        "storageKeys": [
          "0x000000000000000000000000000000000000000000000000000000000000000a",
          "0x0000000000000000000000000000000000000000000000000000000000000001"
        ]
      }
    ],
    "gasUsed": "0x6ce3"
  }
}
参数与您的端点

参数

transactionobject必填
Transaction object.
blockstring必填
Block number in hex (e.g. "0x1208a5f") or a tag: "latest", "safe", "finalized", "earliest" or "pending". L0vd endpoints run archive nodes, so any historical block works.

返回值

object Access list and gas estimate.

accessListarray
Addresses and storage keys the transaction touches.
gasUsedstring
Gas used with the access list, hex.

适用场景

Get the EIP-2930 access list (addresses and storage keys) a transaction touches, plus the gas it uses with that list.

如何解读结果

accessList lists address and storageKeys; gasUsed is the estimate with the list applied.

提示

  • Attaching the list to a type 1 or type 2 transaction can save gas for contracts that read many cold slots.

相关方法