0

Im trying to estimate the gas of this kind of tx to send to a contract

 var estimateGas = this.web3.eth.estimateGas({
  to: toContractAddress,
  gasPrice: this.web3.toHex(40000000000),
  nonce: 10,
  value: this.web3.toHex(forwardingValueInWei)
})

And I get as return this value: 4 712 388 which is super big gas, while the MyEtherWallet estimate 127 943

are those estimations the same unit? Why is too big from web3?

1 Answer 1

1

4,712,388 is the old block gas limit. This used to be the most gas you could send in a transaction. This probably means that your software is detecting an error condition. An error takes all available gas. Since you aren't specifying a limit to how much gas you want to send, this takes all the gas you could possibly send.

1
  • so should I add the gasLimit parameter with a lower than 4 712 388 inside of the estimateGas function? Aug 28, 2017 at 22:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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