From e24881989bd3be25ce15b065a3e2a62ad88b23a1 Mon Sep 17 00:00:00 2001 From: verheesj Date: Tue, 12 Oct 2021 12:45:45 +0100 Subject: [PATCH] [DOCS] add doc for eth_createAccessList (#23623) * eth_createAccessList added to docs Added `eth_createAccessList` method to documentation * Update ns-eth.md Added example usage (via RPC call) of eth_createAccessList. Added example usage (in form of pseudo code) to demonstrate how it may be used. Added reference and link to relevant EIP which will give more technical direction and rationale. Moved eth_createAccessList documentation to follow eth_call * [DOCS] updated eth_createAccessList example * [DOCS] fix nit picks Co-authored-by: Marius van der Wijden --- docs/_rpc/ns-eth.md | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/docs/_rpc/ns-eth.md b/docs/_rpc/ns-eth.md index 1a72b1dc2..42272ec64 100644 --- a/docs/_rpc/ns-eth.md +++ b/docs/_rpc/ns-eth.md @@ -184,3 +184,45 @@ And the result is the Ethereum ABI encoded threshold number: ``` Just for the sake of completeness, decoded the response is: `2`. + +### eth_createAccessList + +This method creates an [EIP2930](https://eips.ethereum.org/EIPS/eip-2930) 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 + +| Field | Type | Description | +|:-------------------|:-----------|:---------------------| +| `transaction` | `Object` | `TransactionCall` object | +| `blockNumberOrTag` | `Object` | Optional, blocknumber or `latest` or `pending` | + +#### Usage + +``` +curl --data '{"method":"eth_createAccessList","params":[{"from": "0x8cd02c6cbd8375b39b06577f8d50c51d86e8d5cd", "data": "0x608060806080608155"}, "pending"],"id":1,"jsonrpc":"2.0"}' -H "Content-Type: application/json" -X POST localhost:8545 +``` + +#### Response + +The method `eth_createAccessList` returns list of addresses and storage keys used by the transaction, plus the gas consumed when the access list is added. + +That is, it gives you the list of addresses and storage keys 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 your transaction does not necessary result in lower gas usage compared to a transaction without an access list. + +Example: +```json +{ + "accessList": [ + { + "address": "0xa02457e5dfd32bda5fc7e1f1b008aa5979568150", + "storageKeys": [ + "0x0000000000000000000000000000000000000000000000000000000000000081", + ] + } + ] + "gasUsed": "0x125f8" +} +```