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

Can you try using your own API key for etherscan?
const provider = ethers.getDefaultProvider('homestead', { etherscan: 'apikey' });
Related issue https://github.com/ethers-io/ethers.js/issues/799
I鈥檝e noticed this starting today as well. It looks like Etherscan may have dialed up their throttling for the ethers default API key.
I鈥檒l get in touch with them and look into this. It may need to be removed from the default provider for now.
Thanks!
It's that damn eth_blockNumber call, referenced here: https://github.com/ethers-io/ethers.js/issues/901#issuecomment-650945611
I'm not sure I understand why it constantly needs to be polled in the background? Is this how events are monitored?
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鈥檇 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.
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?
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鈥檛 be encountering such a high level of throttling...
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.
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.
I think this should be addressed now with the new retry logic. If you continue having issues though, please re-open.
Thanks! :)