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?

up vote 1 down vote accepted

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.

  • so should I add the gasLimit parameter with a lower than 4 712 388 inside of the estimateGas function? – Ernane Luis Aug 28 '17 at 22:15

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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