Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Max Rate Limit Reached error thrown by Etherscan #926

Closed
alazarevski opened this issue Jul 3, 2020 · 9 comments
Closed

Max Rate Limit Reached error thrown by Etherscan #926

alazarevski opened this issue Jul 3, 2020 · 9 comments
Labels
enhancement New feature or improvement. fixed/complete This Bug is fixed or Enhancement is complete and published.

Comments

@alazarevski
Copy link

After upgrading to v5 ether balance checks and json rpc calls end up with the following error (This was not shown in v4) :

Rate limit reached for this call:

https://api.etherscan.io/api?module=proxy&action=eth_blockNumber&apikey=9D13ZE7XSBTJ94N9BNJ2MA33VMAY2YPIRB

Screen Shot 2020-07-03 at 11 40 32

@zemse
Copy link
Collaborator

zemse commented Jul 3, 2020

Can you try using your own API key for etherscan?

const provider = ethers.getDefaultProvider('homestead', { etherscan: 'apikey' });

Related issue #799

@ricmoo
Copy link
Member

ricmoo commented Jul 3, 2020

I’ve noticed this starting today as well. It looks like Etherscan may have dialed up their throttling for the ethers default API key.

I’ll get in touch with them and look into this. It may need to be removed from the default provider for now.

Thanks!

@ricmoo ricmoo added investigate Under investigation and may be a bug. on-deck This Enhancement or Bug is currently being worked on. labels Jul 4, 2020
@EvilJordan
Copy link

It's that damn eth_blockNumber call, referenced here: #901 (comment)

I'm not sure I understand why it constantly needs to be polled in the background? Is this how events are monitored?

@ricmoo
Copy link
Member

ricmoo commented Jul 8, 2020

Yes, this is how events are monitored. :)

The only time we need to check for new events, or transactions have been mined is when the block changes, so it is the most efficient way. Otherwise you’d really hit your limit hard if you kept polling for each event instead (not to mention it would be harder on the node).

It is only called if you have events though, in which case it is required.

@EvilJordan
Copy link

It is only called if you have events though, in which case it is required.

So, theoretically, if I'm monitoring for an event that I know occurs within a controlled set of time, I could turn this off, and then back on, when I'm expecting an event to occur.

Would unsubscribing the eventListener control this?

@ricmoo
Copy link
Member

ricmoo commented Jul 8, 2020

If you unsubscribe the event is removed. If there are no events, the polling stops. :)

You can also use .once instead of .on and it will automatically remove the listener once the event is triggered.

Do you have a lot of events? Or making a lot of calls? You shouldn’t be encountering such a high level of throttling...

@EvilJordan
Copy link

I do not have a lot of events, nor am I making a bunch of calls. The issue was exactly as you described: 1 "ping" every 4 seconds. At this point, that's the majority of my network traffic (I'm un-launched and still in testing on Rinkeby).

Since my particular application doesn't need to listen for events happening outside of its control, I've implemented a removal of listener functionality during time of no activity.

@ricmoo
Copy link
Member

ricmoo commented Jul 19, 2020

I've added retry logic (with exponential back-off) to the Etherscan provider in v5.0.6, so I suspect this should be addressed? Please try it out and let me know.

@ricmoo ricmoo added fixed/complete This Bug is fixed or Enhancement is complete and published. and removed on-deck This Enhancement or Bug is currently being worked on. labels Jul 19, 2020
@ricmoo
Copy link
Member

ricmoo commented Jul 22, 2020

I think this should be addressed now with the new retry logic. If you continue having issues though, please re-open.

Thanks! :)

@ricmoo ricmoo closed this as completed Jul 22, 2020
michaeltout pushed a commit to michaeltout/ethers.js that referenced this issue Aug 23, 2020
@ricmoo ricmoo added enhancement New feature or improvement. and removed investigate Under investigation and may be a bug. labels Oct 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or improvement. fixed/complete This Bug is fixed or Enhancement is complete and published.
Projects
None yet
Development

No branches or pull requests

4 participants