Skip to content

Tutorial: Blockchain Explorer with Raspberry Pi#

How to setup the Chain-Grabber module on a Raspberry Pi device#

This is a guide for developers and data scientists interested in storing the Ergo blockchain to a standardized database format using a Raspberry Pi.

We will focus specifically on the Chain Grabber module from the Ergo Blockchain Explorer (backend).


  • Raspberry Pi with official OS installed
  • Minimum 60GB of disk space available
  • SSH enabled with stable internet connection

Preparing the RPi#

sudo apt update
sudo apt full-upgrade

Download latest Java version#

sudo apt install default-JDK

Download sbt#

echo "deb /" | sudo tee -a /etc/apt/sources.list.d/sbt.list
curl -sL "" | sudo apt-key add
sudo apt update
sudo apt install sbt

Download and unzip precompiled JAR#

If you are reading this in the future, please visit the code release repo and replace it with the appropriate version.


unzip explorer-backend-<version>

Install PostgreSQL#

In the code snippet below, we created "ergo" as the username.

sudo apt install postgresql
sudo su postgres
createuser ergo -P --interactive

Setup and load database schema#

create database explorer;
\c explorer;
\i /explorer-backend-9.4.3/modules/explorer-core/src/main/resources/db/V9__Schema.sql
The final line of code above executes a SQL script that creates a bunch of tables and indices to be populated later by the Chain Grabber.

Update app config#

This is where you need to edit the database username and password you set up earlier.

sudo nano explorer-backend-9.4.3/modules/chain-grabber/src/main/resources/application.conf

Launch chain-grabber#

Run the following command from within the explorer-backend directory.

sbt chain-grabber/run


If all goes well, the code below returns the latest block height that was stored in the database.

select max(height) from node_headers;