support for createAccessList
See original GitHub issueDescribe the Feature
By EIP-2930, transaction containing an access list can reduce gas price. However, it’s hard to determine what accessList
should be passed when building a transaction. Fortunately, many geth nodes support eth_createAccessList
rpc and this method creates accessList
based on a given transaction.
It’s already issued before in #1364, but it’s closed without supporting eth_createAccessList
. ethers.js supports accessList in transaction param, but it doesn’t support eth_createAccessList
rpc to create accessList
for the transaction.
According to EIP-2930 - Rationale: Charging less for accesses in the access list, passing accessList
to transaction is encouraged since it helps to pre-load data from database (such as by loading the data in parallel). It also helps to reduce gas consumption for transactions.
RPC Documentation
https://geth.ethereum.org/docs/rpc/ns-eth#eth_createaccesslist
eth_createAccessList
is similar with eth_estimateGas
. It returns the estimated gas like eth_estimateGas
, but it also returns accessList
for the transaction.
Code Example
const { accessList, gasUsed } = await provider.createAccessList(txReq);
txReq.accessList = accessList;
const tx = await provider.sendTransaction(txReq);
Issue Analytics
- State:
- Created a year ago
- Reactions:4
- Comments:6 (2 by maintainers)
Top GitHub Comments
Looking forward to this feature as well. @0xall in the meantime, you can still access the create list api using the low level ethers method
send
from your wallet instance.Cool cool. I’ll try it out and figure out the best way to add it to the API. We don’t want to include it by default (like we do for estimate gas, which is required) since the reads and writes may not be consistent, which could make transactions wildly more expensive as you would pre-pay for slots you end up not accessing.
But maybe it makes sense in v6 to add a pseudo-property, like the planned
gasMultiplier
which is part of the porcelain API to hint to fill in the accessList.