Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement EIP-1559 #4105

Closed
luu-alex opened this issue Jun 11, 2021 · 7 comments · Fixed by #4155
Closed

Implement EIP-1559 #4105

luu-alex opened this issue Jun 11, 2021 · 7 comments · Fixed by #4155
Assignees
Labels
1.x 1.0 related issues

Comments

@luu-alex
Copy link
Contributor

EIP-1559 is a transaction type that targets fee market changes

@GregTheGreek
Copy link
Contributor

Reference ethers-io/ethers.js#1610

@luu-alex luu-alex added the 1.x 1.0 related issues label Jun 20, 2021
@spacesailor24
Copy link
Contributor

spacesailor24 commented Jun 24, 2021

As mentioned in #4149, the Docker version of Geth needs to be reverted from 1.10.3 to stable (tracked via #4150)

@mikel2000
Copy link

Any ETA for this change? EIP-1559 activation isn't that far away :).

@luu-alex
Copy link
Contributor Author

It'll be our priority to get EIP-1559 asap :)

@AndreMiras
Copy link

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

@ChristianTucker
Copy link

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?

@AndreMiras
Copy link

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 😕

@luu-alex luu-alex linked a pull request Jul 22, 2021 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1.x 1.0 related issues
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants