I'm using geth 1.7.2-stable. I noticed "eth_estimateGas" is very slow. It does not show the result. I confirmed that it worked a few days ago. Someone said the number of transaction is very high from yesterday. Is it related to my issue? How can I fix it?

$curl -X POST --data '{"jsonrpc":"2.0","method":"eth_estimateGas","params":[{"to": "0x109aa384b8786e55abfa1f0ac6cb0561e0a06e94", "from": "0xdf4221b931b6ad4f4f221e2eb03913bd4368d0ba"}],"id":1}' http://localhost:1234

Update 1

After I restart the geth process, it worked for a few minutes. After that the same issue was occurred again.

Update 2

Seems v1.7.3 was released. I will update my node and try it again.


Update 3

I updated to 1.7.3-stable but it did not work yet.

Update 4

It worked when I call the same API with infura.io. Although I don't know what node mainnet.infura.io uses but it seems that my node has some issues.

curl -X POST --data '{"jsonrpc":"2.0","method":"eth_estimateGas","params":[{"to": "0x109aa384b8786e55abfa1f0ac6cb0561e0a06e94", "from": "0xdf4221b931b6ad4f4f221e2eb03913bd4368d0ba"}],"id":1}' https://mainnet.infura.io/

Update 5

Although it is still slow but I can get the result now. I did not change anything.

// call rpc to localhost
$ time curl -X POST --data '{"jsonrpc":"2.0","method":"eth_estimateGas","params":[{"to": "0x109aa384b8786e55abfa1f0ac6cb0561e0a06e94", "from": "0xdf4221b931b6ad4f4f221e2eb03913bd4368d0ba"}],"id":1}' http://localhost:8545

real    0m4.195s
user    0m0.004s
sys 0m0.000s

Method etc_estimateGas makes a "dummy transaction" on your node and returns aprox. amount of gas you should provide for your transaction to go through. This should work most of the time .. but when network gets congested and your (or public) node receives huge amount of data, it gets overloaded and returns inaccurate results or timeouts. I had same issues while deploying a ERC20 contract for a client and decided to build my own node network with a layer on top, which optimises calculation of certain requests like estimateGas. I've just recently made it public, you can read more about it at https://www.fosha.org/

| improve this answer | |

We've made our custom "estimateGas" calculation public at https://www.fosha.org/public/eth/estimategas. You are free to use it.

CURL request:

$ curl https://www.fosha.org/public/eth/estimategas


| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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