Blockchains are, at their essence, a distributed database. The transactions in a blockchain are an example of time-series data. You can use Timescale to query transactions on a blockchain, in exactly the same way as you might query time-series transactions in any other database.

In this tutorial, you use Timescale hyperfunctions to analyze transactions on the Bitcoin blockchain. You can use these instructions to query any type of data on a blockchain, including other cryptocurrencies, smart contracts, or health data.

Before you begin, make sure you have:

This tutorial covers:

  1. Setting up your dataset
  2. Querying your dataset

This tutorial uses a sample Bitcoin dataset to show you how to aggregate blockchain transaction data, and construct queries to analyze information from the aggregations. The queries in this tutorial help you determine if a cryptocurrency has a high transaction fee, shows any correlation between transaction volumes and fees, or if it's expensive to mine.

It starts by setting up and connecting to a Timescale database, create tables, and load data into the tables using psql. If you have already completed the beginner blockchain tutorial, then you already have the dataset loaded, and you can skip straight to the queries.

You then learn how to conduct analysis on your dataset using Timescale hyperfunctions. It walks you through creating a series of continuous aggregates, and querying the aggregates to analyze the data. You can also use those queries to graph the output in Grafana.

Keywords

Found an issue on this page?Report an issue or Edit this page in GitHub.