Show all BSC tokens based on number of holders

Hi

I want to show all bsc tokens on a site and sort them based on number of holders.

I wanted to be sure if I need archive node at all or no.

Or for example if I want to add a feature to let people to sort tokens based on most holders in 1 hour ago (I mean which tokens get most holders in the last hour) , or:

Most holders (1 hour/ 24 hours/ 7 days/ 30 days/ 90 days/ 1 year/ All time)

Do I need archive node for this?

Thanks

I don’t think an archive node would be any more helpful in this case because there is no easy way that I’m aware of to get the total number of holders for a token. If there was some function that could be called, liked there is for totalSupply() then an archive node could be used to get the value of that function at a specific block number in the past… unfortunately there is no such function for number of holders in the ERC20 interface.

This is all there is to work with:

That leaves using the Transfer event logs to figure out which addresses had a positive balance between a given range of block numbers. This is BIG data crunching. Pancakeswap alone has 100k+ tokens listed. We’re working on infrastructure in Moralis to handle tasks like this but it is not ready for public consumption. This a huge project, and a perfect example of a case where an indexed database is necessary (a godzilla sized one).

1 Like

Hey, thanks a lot : )

Adam Fortuna told me that you are working on Atomic Real-Time API, and such queries will be able to be made easily.

This is not true? Or maybe it’s not related to what I want to achieve?

Thanks

It will come in a few months :slight_smile: