Closed luu-alex closed 3 years ago
As mentioned in #4149, the Docker version of Geth needs to be reverted from 1.10.3
to stable
(tracked via #4150)
Any ETA for this change? EIP-1559 activation isn't that far away :).
It'll be our priority to get EIP-1559 asap :)
Until it's released it's still possible to extend it ourselves using web3.extend. I gave it a try and it worked like charm
Until it's released it's still possible to extend it ourselves using web3.extend. I gave it a try and it worked like charm
Mind posting the extensions?
Mind posting the extensions?
Sure, it depends on which part you need exactly.
In my case it's nothing more than cherry picking some of the changes from the on-going PR.
I wanted access to the getBlockByNumber()
method and read the block baseFeePerGas as well as fetch transactions and to read tipping information when available.
Something like this was enough:
const inputFormatters = [
blockNumber => (blockNumber ? web3.utils.toHex(blockNumber) : 'latest'),
() => false
];
const getBlockByNumberMethodDescription = {
name: 'getBlockByNumber',
call: 'eth_getBlockByNumber',
params: 2,
inputFormatter: inputFormatters
};
const extendWeb3 = web3 => {
web3.eth.extend({
methods: [getBlockByNumberMethodDescription]
});
};
Then call the extendWeb3
function and the new method should be available.
So something like:
const baseFeePerGas = async(web3, callback) => {
const networkId = await web3.eth.net.getId();
const networkType = await web3.eth.net.getNetworkType();
const block = await web3.eth.getBlockByNumber();
console.log(`networkType: ${networkType}`); // ropsten
console.log(`networkId: ${networkId}`); // would output 3 for Ropsten
console.log(`baseFeePerGas: ${block.baseFeePerGas}`); // e.g. 0x11
callback();
};
extendWeb3(web3);
baseFeePerGas(web3, process.exit);
Well that's the idea, but it turns out that we could probably use the already existing web3.eth.getBlock()
method and also transaction tipping info is available out of the box (when provided), hence you can read it already using web3.js 1.4.0.
That's for the reading chain data part. For making an EIP-1559 transaction, I guess we're better of installing npm module from the on-going branch/PR.
I haven't tried myself, but something like this should work I suppose:
npm install --save npm install git://github.com/ChainSafe/web3.js.git#wyatt/eip1559
If this is not enough, maybe dirty patching your from node_modules/
folder should do it.
https://github.com/ChainSafe/web3.js/pull/4155.patch
But now we're hijacking the issue a bit I'm afraid :confused:
EIP-1559 is a transaction type that targets fee market changes