NOTE: I am doing my work with the Ganache v1.2.2 GUI client on a Linux Ubuntu 18.04 station.

There are many revert errors that happen during the estimateGas() call that precedes the actual Web3.js send() call. Unfortunately, as far as I can tell, you don't get back a Tx hash for transactions that revert during the estimateGas() call, so you can't debug the problem with the Truffle debugger.

Instead, the Web3.js estimateGas() throws a promise rejection during that method call. I also checked carefully the Ganache log window and it never shows a Tx hash. However it does show a Tx hash for all the Ethereum transactions that concluded successfully before the one that reverts, and it does show reverted transactions that revert during the actual send() call.

When this happens, I make a temporary change to my code to skip the estimateGas() call and go straight to the send() call with an artificially high gas price to make sure the transaction does not revert due to insufficient gas. This is all done just so I can get back a Tx Hashand debug the transaction with the Truffle debugger.

This workflow works but it is tedious. Is there a better way to debug a transaction that reverts during the estimateGas() than this?

1 Answer 1


You don't get a transaction hash because there is no transaction. If estimateGas reverts, then the actual transaction should revert as well. I don't know of a way to debug estimateGas calls, but you may want to set the properties for estimateGas the same as you will when you actually send the transaction (e.g. set the gas price and from address to what they will actually be.)

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.