5

I'm trying to do some distribution calculations on a couple of tokens and could use an export of the token holders list that I can find in Etherscan when I search for a specific token. Since Etherscan is showing the list I was hoping the API would have a function for this, but it looks to me like it doesn't. Please bear with me as I am totally new to this and am not able to really build anything. I know how to fiddle with some APIs and that's about it.

1

Try this: [https://etherscan.io/exportData?type=tokens&contract=0xa02e3bb9cebc03952601b3724b4940e0845bebcf

Replace Contract with your token contract address

  • Can we export all token holders addresses into a smart contract? – Fariha Abbasi Dec 3 '18 at 17:57
1

I have created a standalone tool which does the same.

  • Take a token contract address

  • Iterate over all Transfer events for token using eth_getLogs JSON-RPC API

  • Build a local database of these events

  • Allow you to use SQL to query any account balance on any point of time (block num)

You can find the command line application execution example how to build the token holder database here

The core Python logic is here.

You can also trivially export this list from SQLite database to CSV file.

There are some quirks here and there: for example detecting mint / creation event for some tokens is not straightforward. Thus, you will may negative balance on the account receiving initial total supply if you rely on Transfer event only.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.