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?
Ethereum Stack Exchange is a question and answer site for users of Ethereum, the decentralized application platform and smart contract enabled blockchain. It only takes a minute to sign up.Sign up to join this community
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.