1

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.

https://github.com/ethereum/go-ethereum/releases/tag/v1.7.3


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
{"jsonrpc":"2.0","id":1,"result":"0x5208"}

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

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/

1

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

Return:

{"contract":{"gas":{"average":145618,"low":36000,"high":420000},"price":{"average":25145051463,"low":4000000000,"high":70000000000}},"transaction":{"gas":{"average":24428,"low":21000,"high":45000},"price":{"average":34714285714,"low":5000000000,"high":118000000000}}}

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.