1

When I input https://api-sepolia.etherscan.io/api?module=proxy&action=eth_getTransactionByHash&txhash=0xafdcdf23b2bfdae668a825630340c48eca9a7598e205a0291de1db05c1231926&apikey=MY_KEY in browser and press return, I will get correct response.

But when I input: curl https://api-sepolia.etherscan.io/api?module=proxy&action=eth_getTransactionByHash&txhash=0xafdcdf23b2bfdae668a825630340c48eca9a7598e205a0291de1db05c1231926&apikey=MY_KEY in my command window, I got below error:

[1] 2122
[2] 2123
[3] 2124
[2]- Done action=eth_getTransactionByHash
[3]+ Done txhash=0xafdcdf23b2bfdae668a825630340c48eca9a7598e205a0291de1db05c1231926
{"status":"0","message":"NOTOK-Missing/Invalid API Key, rate limit of 1/5sec applied","result":"Error! Missing Or invalid Action name"}

I think it is because curl requested etherscan API more than 5 times per second, which caused this error. How can I avoid this?

Please assist. Thank you.

3
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking.
    – Community Bot
    Mar 24, 2023 at 18:01
  • Did you try registering to get your own apikey?
    – Ismael
    Mar 26, 2023 at 20:03
  • Yes, I used "MY_KEY" in my question, but in reality, it is my real key, otherwise I won't be able to get correct response when I keyed it in my browser. Mar 31, 2023 at 4:06

1 Answer 1

2

It seems your curl command needs some quoting, as the result indicates 3 different shell processes:

[1] 2122
[2] 2123
[3] 2124
[2]- Done action=eth_getTransactionByHash
[3]+ Done txhash=0xafdcdf23b2bfdae668a825630340c48eca9a7598e205a0291de1db05c1231926
{"status":"0","message":"NOTOK-Missing/Invalid API Key, rate limit of 1/5sec applied","result":"Error! Missing Or invalid Action name"}

Try your command like this (two commands in sequence) :

MY_KEY="<your_actual_key>"

curl "https://api-sepolia.etherscan.io/api?module=proxy&action=eth_getTransactionByHash&txhash=0xafdcdf23b2bfdae668a825630340c48eca9a7598e205a0291de1db05c1231926&apikey=$MY_KEY"

Please use the double quotes in both for your shell interpolate correctly your environment variable.

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.