1

Ethgasstation and similar websites estimate proper Gas Price based on current state of Ethereum network. Is there any way of using working with Geth/web3 to estimate proper Gas Price? and similar to this, how about estimate Gas Limit?

2

You can use getBlock on the latest block in Web3 to get back the gas limit of that block:

https://web3js.readthedocs.io/en/1.0/web3-eth.html#getblock

gasLimit - Number: The maximum gas allowed in this block.

You are probably pretty safe to use that gas limit on the next transaction you want to create.

Web3 also has a gas price oracle as documented here:

https://web3js.readthedocs.io/en/1.0/web3-eth.html#getgasprice

Returns the current gas price oracle. The gas price is determined by the last few blocks median gas price.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.