Install Hyperledger Explorer and PostgreSQL Database


Install Hyperledger Explorer and PostgreSQL Database

Recipe ID: hsts-r18


Recipe Overview

Hyperledger Explorer is a powerful utility that allows users to create user-friendly web-based applications. It is a blockchain dashboard and provides the ability to view, invoke, deploy, and query raw blockchain data and network information, including block details, chain codes, and transactions stored in the ledger.

For those who are not familiar with Hyperledger project, reading Blockchain Overview, Intro to Hyperledger Family and Hyperledger Blockchain Ecosystem, Hyperledger Design Philosophy and Framework Architecture, and Overview of Building Blockchain Smart Contracts in Hyperledger articles are strongly recommended beforehand.

After finishing this recipe, you can work on these recipes: Configuring Hyperledger Explorer with Fabric, Building Hyperledger Explorer, and Running the Hyperledger Explorer Application

Hyperledger Explorer is a highly maintainable and open source browser that can be configured and built natively on macOS and Ubuntu. At the time of writing, Hyperledger Explorer has not yet gone live. The latest release, v0.3.8, supports Fabric v1.3.
It is common to encounter errors here and there, especially around issues related to versions and/or setting up environments. To save time while debugging, I have included various notes and tips, along with recommended fixes, for some of errors you might run into while walking through this recipe.

Since in our previous recipe (Overview of Hyperledger Explorer and its Development Environment), we installed all Hyperledger Explorer pre-requisites, we are now ready to install Hyperledger Explorer.

Step-by-Step Hyperledger Explorer and Database Installation

Execute the following steps to set up your database and Hyperledger Explorer:
1. Run the following command from your home directory. This will clone the latest version of Hyperledger Explorer from GitHub to your system. To make sure we get v0.3.8, do a version checkout in case there is a newer release:

git clone https://github.com/hyperledger/blockchain-explorer.git

 git checkout release-3.8

cd blockchain-explorer

 

2. Set up the PostgreSQL database. Navigate to Hyperledger Explorer's App directory and make a back-up copy of the original explorer configuration file in case you need to rollback to the original configuration:

$ cd app or $ cd ~/blockchain-explorer/app

cp explorerconfig.json explorerconfig.json.bak

3. You can use the vi editor or any other editor to update the PostgreSQL properties in the explorerconfig.json file, as shown. You can set the passwd to password of your preference, then save your changes:

"postgreSQL": {
"host": "127.0.0.1",
"port": "5432",
"database": "fabricexplorer",
"username": "hppoc",
"passwd": "password"

},

4. Next, we need to create a PostgreSQL database. To do this, run the following commands:

cd ~/blockchain-explorer/app/persistence/fabric/postgreSQL/db

 sudo bash ./createdb.sh

5. If you would like to check the database status, you can connect to the PostgreSQL database with the PostgreSQL command-line interface. Check out the sample commands as follows:

sudo -u postgres psql psql (9.5.14)

Type "help" for help.
postgres=# \l

You will see the following screenshot with a list of Postgres databases:
Hyperledger explorer installation and fabric integration

 


6. To exit the PostgreSQL, you can use the following command:

to exit from psql: postgres=# \q

 

Congratulation! We have successfully installed Hyperledger Explorer and PostgreSQL. After completing this recipe, you can Configure Hyperledger Explorer with Fabric, Build Hyperledger Explorer, and Run the Hyperledger Explorer Application

The following recipes are excellent resources for installing other Hyperledger tools:

Blockchain Developer Guide- How to Install and work with Hyperledger Sawtooth
Blockchain Developer Guide- How to Install Hyperledger Fabric on AWS
Blockchain Hyperledger Composer Business Network Modeling and Environment Setup
Blockchain Developer Guide- How to Install Hyperledger Burrow on AWS
Blockchain Developer Guide- How to Install Hyperledger Seth and Docker on AWS
Blockchain Developer Guide- How to Install Hyperledger Indy and Indy CLI on AWS

To conclude this recipe, we like to recommend our Blockchain Hyperledger Development in 30 hours course to those interested in pursuing a blockchain development career. Indeed, as of this writing, Hyperledger Foundation offers the following two Hyperledger certifications: The Certified Hyperledger Fabric Administrator (CHFA) and The Certified Hyperledger Sawtooth Administrator (CHSA), both of which are highly regarded in the industry. Hyperledger Foundation is in the process of creating Hyperledger Developer certification program, which may be released in early or middle of 2020. In short, by taking our hands-on online Hyperledger class, you would be able to obtain CHFA certification.

This tutorial is written by Brian Wu who is our senior Hyperledger instructor in Washington DC. His Hyperledger Cookbook with 40+ hands-on recipes is highly recommended.

Related Training Courses

Hands-on Node.JS, MongoDB and Express.js Training
Advance JavaScript, jQuery Using JSON and Ajax
Learn Hands-on Blockchain Ethereum Development & Get Certified in 30 Hrs
Learn Blockchain Hyperledger Development & Get Certified in 30 Hrs
Become Blockchain Certified Security Architect in 30 hours
Blockchain Certified Solution Architect in 30 hours
Introduction to Python Programming
Object Oriented Programming with UML


Private and Custom Tutoring

We provide private tutoring classes online and offline (at our DC site or your preferred location) with custom curriculum for almost all of our classes for $50 per hour online or $75 per hour in DC. Give us a call or submit our private tutoring registration form to discuss your needs.


View Other Classes!