ether_sql is a Python library to push Ethereum blockchain data into a SQL database.

The current Ethereum blockchain has more than 5.6 million blocks and 233 million transactions. Performing data-analysis on this data-set will provide useful insights on decentralized exchanges, tokens, ENS, prediction markets etc. But, unfortunately tools/libraries to easily perform data-analysis of Ethereum do not exist yet.

We at Analyse Ether wish to create these open-source libraries, ether_sql is the first of many with the goal of making Ethereum data easily queryable. This library can be used as a backbone for creating:

  1. Block explorers (coming soon …)
  2. Data analysis platforms

The library is currently in alpha stage, and is not recommended for production use until it has received sufficient testing. ether_sql currently supports Geth, Infura and Parity nodes, but transaction traces (eg. internal transactions) are currently available only with a Parity node.

To install the library locally refer to the documentation below:

Once installed you can simply start pushing the data from any Ethereum node to SQL using the CLI option:

This command will check for the highest available block in sql database and start the pushing data after that block number.

After the database is filled with some blocks you can connect to it using the following command:

Once connected you can start querying the database, find below some examples.

  1. A SQL query to get the block number of the first transaction.

2. And here is a query to get the maximum value transfer in a transaction in first 100k blocks.

3. Someone transferred 11.9 million ether! Let us check the hash of the transaction:

Indeed this transaction made a value transfer of 11.9 million ether.

To know more details about available tables and their columns refer to this link, you can check out more SQL examples here.

We can see that by pushing the Ethereum data into a query engine, even simple queries can give access to information not easily available through traditional block explorers. Our upcoming libraries will facilitate the creation of visualizations, writing machine-learning models on top of data, and bring in more transparency in the inner workings of several smart-contracts.

We believe this is a missing piece of infrastructure in the space and Analyse Ether wishes to fill this gap.

Come let us Analyse Ether together :)

Written by

Come let us analyse ether together

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store