Introduction

Ethdata is a Python package to help analyze Ethereum data.

Description

Ethdata offers developers and analysts a simple way to extract and analyse historical Ethereum data using free, public APIs and services.

  • Access historical Ethereum data without waiting to sync a node

  • Pull on-chain data from BigQuery (fast) instead of querying a node (slow)

  • View data in human-readable format instead of hex blobs

  • Start analyzing data right away in Pandas, or export to Excel/CSV

Ethdata is available as-is under an MIT License.

Blog

GitHub

Install

Install the package using pip. For the best results, follow the full package install instructions.

pip install eth-data-tools

Example usage

Python import statement

from ethdata import ethdata

Smart contract logs to Excel

Export all logs from the Compound smart contract to a CSV file to look at them in Excel.

compound = ethdata.Contract("0x3fda67f7583380e67ef93072294a7fac882fd7e7")
compound.event_logs.to_csv("event_logs.csv", index=False)
Compound Smart Contract Logs

Transaction data to JSON

Export all transactions from the Digix DAO multi-signature wallet to a JSON file.

digix_wallet = ethdata.Contract("0x75ba02c5baf9cc3e9fe01c51df3cb1437e8690d4")
digix_wallet.transaction_receipts.to_json("digix_wallet.json", orient="records")
digix_wallet.json
...
{
"transaction_hash":"0x6e6e5df991282692d11521addfe1e368dd9c0ea1ed229b84175dfd2e96cd6c7b",
"block_timestamp":1535702202000,
"from_address":"0x296050ad93f76439e8847047bae8f8eb82ca1f54",
"to_address":"0x75ba02c5baf9cc3e9fe01c51df3cb1437e8690d4",
"value":0.0,
"function_name":"submitTransaction",
"param_transactionId":null,
"param_destination":"0x21c470605c4e35d8cc33dc7cec170ad6283991ad",
"param_value":3000000000000000.0,
"param_data":"0000000000000000000000000000000000000000000000000000000000000060"
},
{
"transaction_hash":"0x6bb43d552b4f2562eccc5303be8dab8c38e0be84b83d33e97e8eb3a163eb196e",
"block_timestamp":1535705122000,
"from_address":"0x21c470605c4e35d8cc33dc7cec170ad6283991ad",
"to_address":"0x75ba02c5baf9cc3e9fe01c51df3cb1437e8690d4",
"value":0.0,
"function_name":"confirmTransaction",
"param_transactionId":0.0,
"param_destination":null,
"param_value":null,
"param_data":null
}
...

ERC-20 token support

Get the details about ERC-20 tokens for use in your analysis.

mkr_token = ethdata.Token("0x9f8f72aa9304c8b593d555f12ef6589cc3a579a2")
mkr_token.name
# Maker
mkr_token.symbol
# MKR
mkr_token.decimals
# 18.0
mkr_token.total_supply
# 1000000.0