I want to get token transfers of an address (incoming) but i guess once i have this sorted i can figure that out.

So for example here - https://etherscan.io/address/0x3f5ce5fbfe3e9af3971dd833d26ba9b5c936f0be#tokentxns

They have all the token transfers and i can't really see in their API to get all the token transfers so i was wondering if anyone knew how to do to get all token transfers going on the address. I have tried doing many stuff while trying to using web3.js and try subscribe to events. I realise when a smart contract transfers a token the Transfer event is called and emitted but i don't see how to show all the token transfers using etherscan API. Thanks guys.

2 Answers 2


If you wish to use etherscan API, you can use https://etherscan.io/apis#logs.

However, you'll have to know contract addresses of all tokens that you wish to watch.

The Transfer event for ERC20 is defined as

event Transfer(address indexed _from, address indexed _to, uint256 _value);

That means:

  • topic0 will be the hash of the signature of the event itself
  • topic1 will be the address of the sender
  • topic2 will be the address of the receiver

For orientation, you can look into the logs in the transaction receipt of a transfer transaction. -> e.g. https://etherscan.io/tx/0x5c354e4f25f2da8ee608c445cad43c171bc553859dd787fc0800a904344a7ecd#eventlog

  • How does etherscan do it though? I want to get all token transfers..? and i don't know all the contract addresses ;/ Mar 27, 2018 at 12:54
  • They have the complete chain. Most probably also with indexed data in their own database. This way it's easy to compile a list of all ERC20 contract instances. If you wish that too, you'll have to setup own node, make a full sync and parse through the transactions and transaction receipts (which include the logs).
    – ivicaa
    Mar 27, 2018 at 13:51

Sure, you can do it like this: https://api.etherscan.io/api?module=logs&action=getLogs&fromBlock=0&toBlock=latest&topic0=0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef&topic2=0x000000000000000000000000001c356c0be5dd6c91ca24ef04d9e10081510682

Here topic2 parameter specifies the address (padded to 256 bits) to get all incoming token transfers for.

Here is an example of result record:

{ "address":"0x2155877da05c52368b830bfd56e96405a2668d8b", // Token smart contract
    "0x000000000000000000000000a67d0d44eee2a6ed2081a6f50bb59dd41df3c554", // From
    "0x000000000000000000000000001c356c0be5dd6c91ca24ef04d9e10081510682"], // To
  "data":"0x00000000000000000000000000000000000000000000000000000000000003e8", // Amount

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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