Cannot estimateGas

Hi, I’m trying to estimate gas for sending a ERC-20 token and I’m getting execution reverted: insufficient funds
I’d understand that when actually sending the trasaction but why do I need funds to estimate gas, do I pay a fee for the estimation? Does this have anything to do with the recent London update?

$ curl -XPOST -d '{"jsonrpc":"2.0","method":"eth_estimateGas","params":[{"from":"0x366758cd3111b9d4c5c9c258a0d7a279f8a35b9c","to":"0x45804880de22913dafe09f4980848ece6ecbaf78","data":"0xa9059cbb000000000000000000000000366758cd3111b9d4c5c9c258a0d7a279f8a35b9c0000000000000000000000000000000000000000000000000de0b6b3a7640000"}],"id":23}'

{"jsonrpc":"2.0","id":23,"error":{"code":3,"data":"0x08c379a000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000012696e73756666696369656e742066756e64730000000000000000000000000000","message":"execution reverted: insufficient funds"}}


Hi @premek - you can always check the real-time gas price at That will give you the most accurate estimate of what your gas price should be set to.

Thanks for your answer.
Does it mean I should not call the “eth_estimateGas” method? Is it not working? Why am I getting the response I’m getting?
Getting it from another API would require another API key. (it’s free, it’s just a bit more complicated setup for our customers)

eth_estimateGas is purely an estimate and isn’t always accurate. It’s usually close, but if you are using estimateGas, you likely should add a buffer of some sort to the result to ensure there are sufficient funds. The Eth Gas Station will always give you the real-time gas price, and that will be the most accurate.

thanks but that does not answer my question
I just wanted to know why am I getting the error above and if I need to pay fee or gas for calling the “eth_estimateGas” method

Apologies for the misunderstanding, @premek! eth_estimateGas itself does not consume any gas, but it does check the balance of the sender to make sure you have enough gas to complete the request. In your case, it has determined that your account does not have sufficient gas to complete the eventual request you are trying to call.

great, thanks a lot.

1 Like