Featured image: Coding SQL Query. Source Unsplash.


Within this tutorial, you will learn how to retrieve and analyze data from the Ethereum Blockchain with the help of the anyblock.tools SQL interface.

We will show you how to retrieve data from anyblock.tools using common SQL language.

What you must know already

This tutorial is written for programmers, who have some experience with SQL. You should also have visited the authorization page and set up our connection to the database. Remember that the subentities are stored using the Postgresql-Type JSONB. For more information on that, please take a look at the ER model.

Basic anyblock.tools SQL queries

Choose one of the databases available. All of them are encoded as the triple of:

The main chain is named ethereum_ethereum_mainnet.

After choosing a blockchain, you might continue with the example queries.

Find the latest block

This will show the whole block. But you can use a shorter form:

Find events for a given block

Find calls for a transaction hash

Find transactions for a given contract

For our example we use the address of the TenXPay token contract:

Find specific events for a given contract

For our example we use the address of the TenXPay token contract again, however, we would like to know the values of transfers greater than 1ETH:

Find the latest 10 DAI Transfer events and extract sender, receiver, and value from JSON

Where to go from here

You may continue by taking a look at the Elasticsearch tutorial. Please let us know if you have any further questions or need some help with your application.

Interested or questions?

Sascha Göbel
+49 6131 3272372

Follow us:
Twitter, LinkedIn,
Medium, YouTube

Originally published at https://www.anyblockanalytics.com on August 13, 2020.

Anyblock Analytics is a German blockchain solution provider. We offer consulting, tools and data to integrate business processes with blockchain.

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