[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 <m.vanderwijden@live.de>
This commit is contained in:
parent
af30dfd9b6
commit
e24881989b
|
@ -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`.
|
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"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
Loading…
Reference in New Issue