3

How do I get a list of a given ERC20 token holders?

I use QuickNode + ethers.js or web3.js and I have SC address for the ERC20 token.

Is there a short way to get a list of token holders or do I have to look through transactions?

I've tried Covalent's endpoint for that, but they are not reliable --> 90% of requests are 504. I need to use a provider that gives me access to multiple chains so polygonscan API doesn't work in my case.

TylerH
  • 20,799
  • 66
  • 75
  • 101
Stefan Drl
  • 53
  • 7

3 Answers3

2

There is no straightforward way to get a list of token holders from the network. However, there are few workarounds:

  1. If you have control over the ERC20 token, you could add a tracking array of token holders that is updated by overriding the transfer function.
  2. If you do not have control over the ERC20 token, you could track all of the ERC20 transfer event logs to build and maintain a ledger of holders.
  3. If you do not have the resources to track every transaction, you could rely on API services such as Ankr Advanced API.
tinom9
  • 369
  • 2
  • 12
  • Hey, thanks. I will go with the 2nd option and I'll try to use QuickNode to get transaction history for the given ERC20 token. – Stefan Drl Oct 31 '22 at 19:22
1

Is there a short way to get a list of token holders or do I have to look through transactions?

The only way without using a third-party commercial dataset like Alchemy or Moralis is to index all ERC-20 Transfer events.

I created a Python-based tool for this back in the day.

I also suggest running your local own node as then you can pull out this data 100x - 1000x faster than with any commercial node API provider.

Mikko Ohtamaa
  • 82,057
  • 50
  • 264
  • 435
  • Hey, thanks. Will have a look at your tool. Will check also how I may run the local node, but I need an universal solution to be able to reuse it for multiple chains, so I think that I'll still have to use some 3rd party tools/APIs. – Stefan Drl Oct 31 '22 at 19:25
  • No, only universal solution is that you run the nodes yourself. Most third party providers only support some networks. – Mikko Ohtamaa Nov 01 '22 at 08:41
0

Please check token holder APIs on Bitquery.

Currently it supports Ethereum and BNB chain, however Arbitrum and Polygon is coming soon.

Gaurav Agrawal
  • 909
  • 1
  • 10
  • 20