I'm getting gas required exceeds allowance (9998602) or always failing transaction error on transaction.estimateGas() on mainnet, but it's working ok on kovan.

What is the reason of this error? Is there any settings to set the allowance?

1 Answer 1


Your web3 provider will try to estimate how much gas your transaction will take. If it encounters an error (i.e. the tested transaction fails) then it will try to increase the gas, because the error could be an "out of gas" error instead of an internal error in the smart contract. Sadly, by simply reading the error code, you are unable to know whether it was an out-of-gas exception or an internal error.

If a transaction gets tested for about the block limit amount of gas (i.e. for mainnet currently 10 million) and it still fails, then either the transaction tries to do too much calculations (it thus runs out of gas) OR the contract internally throws an error. It is more likely that the latter is the case, since you specify that it works on kovan.

What are you trying to do?

If you are trying to interact with a contract which uses your ERC20 tokens, check that you have approved the contract to spend your ERC20 tokens.

  • thank you for your answer. I'm trying to deploy a contract. Weirdly it is ok on kovan..
    – bbnn
    May 2, 2020 at 1:45
  • sorry, I think it was failing to create a contract. I tried to set the gasLimit manually and it gets reverted instead of out of gas.
    – bbnn
    May 2, 2020 at 1:51
  • You will have to retrace why it is reverting. If you need any further help let me know.
    – JBrouwer
    May 2, 2020 at 12:00
  • The problem is solved now. Thank you!
    – bbnn
    May 2, 2020 at 19:13

Your Answer

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

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