[Ethereum] Obtain token transfer data from an address

etherscanexplorersexternal-apitokens

I would like to obtain token transfer data from an address via Rest API

For example, take this address:
https://etherscan.io/address/0xfbb1b73c4f0bda4f67dca266ce6ef42f520fbb98#tokentxns

(Etherscan doesn't answer support questions about their API "because its free and presented as is", and they don't seem to have an API endpoint to show that same data.)

That link shows all of the token transfers for that address.

I would like to see all token transfers of X for that address. X being a token of my choice.

What is involved with obtaining that data via API?

Best Answer

How about using Etherscan's Event Log API?

https://api.etherscan.io/api?module=logs&action=getLogs
    &fromBlock=0
    &toBlock=latest
    &address=[Token Contract Address]
    &topic0=0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef
    &topic1=[From Address, padded to 32 bytes - optional]
    &topic2=[To Address, padded to 32 bytes - optional]

In the above topic0 is the signature of an ERC20 Transfer event.

For example, the following link shows you all the send transactions of LLL tokens from my account (two transactions).

Here, your X (the token) is represented by the token's contract address, which is easy enough to find out for the various tokens.

As always, the API will return you a maximum of 10000 results, so you may need to manage fromBlock and toBlock accordingly.

Related Topic