I working on a Ethereum project and I would like to gather a list of top X (20 for example) Ethereum accounts. This would behave similar to etherscan.io (https://etherscan.io/accounts)
Is there an API that does this ? If not does anyone know of a way to accomplish this. Im curious how etherscan accomplished this. I looked at their and there is no endpoint that behaves like it.
I would like to do this for other ERC20 tokens as well.
Best Answer
I don't know of any APIs that will achieve what you want.
Here's some fairly dumb Python code that scrapes that page and writes it to a
.csv
file:Probably by parsing the state data and creating their own internal representation of it. This would then allow them to manipulate and present it in any way they like.
Here's a slightly more complicated script (that I wrote a while ago) that lists all addresses and balances - in rank order - associated with a given token contract, across multiple Etherscan pages. You can poke around with it to suit your needs. (There's an example contract address currently hard-coded into it.)