I've already got the number of total supply tokens using web3.js But now I faced the problem that I don't have any idea how to get the number of token holders (I don't need the list of holders) and the number of transactions. I think it is very similar. Is it possible to do it using web3.js? I take my test token in rinkeby network for tests: https://rinkeby.etherscan.io/token/0x3ead2f2dacdcba32f9834a71464cae15a88755e8 or Binance token in mainnet https://etherscan.io/token/0xB8c77482e45F1F44dE1745F52C74426C631bDD52
Asked
Active
Viewed 6,006 times
1 Answers
0
This is not directly supported by the ERC-20 token. So if you want to do this you will have to add extra functionality yourself and keep track who has tokens and who not every time a transfer happens. Then you can create a function to get this number. Since it is not supported by the ERC-20 you will not find it on etherscan, you will have to get it yourself. Adding extra functionality will not stop the token from being an ERC-20.
The other way would be to iterate all of the addresses, which is a really bad idea.
Or if you have a server running you can listen for all the events on the contract and keep track of the holders in your own database.

nikos fotiadis
- 1,040
- 2
- 8
- 16
-
Thanks a lot for your answer! So etherscan shows information about total supply, number of holders and number of transactions but using web3.js we can get only total supply or balance of any address without adding extra functionality but not the number of holders? It's so weird... – Aleksandr Mar 06 '19 at 07:53
-
You can get the same info as etherscan. Etherscan is nothing special. What I meant is that you cannot get this information directly from the contract. Etherscan just looks at the transactions, you can do that with web3 as well. – nikos fotiadis Mar 06 '19 at 09:04