3

On etherscan.io I can download the last 2000 erc20 token transactions of a specific token holder as csv.

How can I get all erc20 token transactions of a token holder?

I'd prefer a web service or a website that lets me download manually, but if it has to be I am able to set up a development environment.

2

There are no web services that I know of that provide this data.

You could use web3.js to get all the events emitted by the contract. These could be filtered based on the sender or receivers address.

ERC20 sepcifies the Transfer event:

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

The specific API method docs can be found here.

  • but is the transfer event reliable? What if some token contract fails to emit event? The whole database of token transfers would become invalid immediately. – Nulik May 30 '18 at 11:16
  • Unfortunately there is no better alternative. – medvedev1088 Jun 26 '18 at 18:12
2

Here is a guide on how to export Ethereum data, including ERC20 Transfers, to csv https://medium.com/@medvedev1088/exporting-and-analyzing-ethereum-blockchain-f5353414a94e

It uses https://github.com/medvedev1088/ethereum-etl which outputs the data into blocks.csv, transactions.csv, erc20_transfers.csv.

blocks.csv

Column                  | Type               |
------------------------|---------------------
block_number            | bigint             |
block_hash              | hex_string         |
block_parent_hash       | hex_string         |
block_nonce             | hex_string         |
block_sha3_uncles       | hex_string         |
block_logs_bloom        | hex_string         |
block_transactions_root | hex_string         |
block_state_root        | hex_string         |
block_miner             | hex_string         |
block_difficulty        | bigint             |
block_total_difficulty  | bigint             |
block_size              | bigint             |
block_extra_data        | hex_string         |
block_gas_limit         | bigint             |
block_gas_used          | bigint             |
block_timestamp         | bigint             |
block_transaction_count | bigint             |

transactions.csv

Column              |    Type     |
--------------------|--------------
tx_hash             | hex_string  |
tx_nonce            | bigint      |
tx_block_hash       | hex_string  |
tx_block_number     | bigint      |
tx_index            | bigint      |
tx_from             | hex_string  |
tx_to               | hex_string  |
tx_value            | bigint      |
tx_gas              | bigint      |
tx_gas_price        | bigint      |
tx_input            | hex_string  |

erc20_transfers.csv

Column              |    Type     |
--------------------|--------------
erc20_token         | hex_string  |
erc20_from          | hex_string  |
erc20_to            | hex_string  |
erc20_value         | bigint      |
erc20_tx_hash       | hex_string  |
erc20_block_number  | bigint      |
2

I found it very easy to use Google BigQuery to do this. It is free up to a point. Was able to easily retrieve my data. I will update when I figure out how to add fees.

https://console.cloud.google.com/bigquery

select tx.token_address, t.name, tx.from_address, tx.to_address, tx.value, tx.block_timestamp, (trans.receipt_gas_used * trans.gas_price) / 1000000000000000000 as Fee, trans.gas as Gas_Limit, trans.gas_price, trans.receipt_gas_used as Gas_Used_by_Tx
from 
  `bigquery-public-data.crypto_ethereum.token_transfers` tx 
  JOIN `bigquery-public-data.crypto_ethereum.tokens` t on tx.token_address = t.address
  JOIN `bigquery-public-data.crypto_ethereum.transactions` trans on trans.`hash` = tx.transaction_hash
where 
   (to_address = '<your 0x0... public Address>' 
or from_address ='<your 0x0... public Address>') 
    order by date(tx.block_timestamp) desc  

edit: 10/11/2019 - Added fee calculation (gas_used*gas_price)

0

We created a tool named ERC20 Crawler. It works well my side, https://github.com/tomochain/erc20-crawler

Feel free to create issue and PRs

Hope it save your time

0

Ethplorer does this:

https://ethplorer.io/address/0x0000000000000000000000000000000000000000#showTx=tokens

Note the "Export as CSV" link below the table.

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.