For example, the contract saves the address when token created but after that token holder could send token or all tokens to another wallet.
Is it possible to find all wallet addresses of token holders which were created by my contract?
Ethereum Stack Exchange is a question and answer site for users of Ethereum, the decentralized application platform and smart contract enabled blockchain. It only takes a minute to sign up.Sign up to join this community
All token transfers are performed by calling methods on your contract - so your contract can track balances and accounts in any way it wishes. If you're using the default arrangement of using a Solidity
mapping, you will also need to keep a separate list of known account IDs in an array, so you can iterate over them.
I have created a standalone open source tool which does the same.
Take a token contract address
Iterate over all ERC-20
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) - note that some balances may have become zero
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.