Hyperledger Explorer with Fabric 1.2 running on multiple hosts
Introduction
Hyperledger Explorer is one of the Hyperledger projects hosted by Linux foundation to visualize blockchain network using a web application. This project is in the Incubation stage and for more details please visit their official website . In this post, I am going to install Hyperledger Explorer on Ubuntu Virtual machine and connect to Hyperledger Fabric V1.2 installed on multiple hosts.
Prerequisites
- Fabric network with 2 orgs running on multiple hosts. Refer to my earlier post to install and run fabric network. I used the exact topology to configure Hyperledger explorer
- Ubuntu 16.04 host to run Hyperledger explorer with the following dependencies
- nodejs 8.11.x
- PostgreSQL 9.5 or greater
- Jq [https://stedolan.github.io/jq/] — run “ sudo apt-get install jq to install jq
Get Hyperledger Explorer source code
- git clone https://github.com/hyperledger/blockchain-explorer.git.
- cd blockchain-explorer
Setup Database
- cd app
- modify exploreconfig.json to update postgres host, port, username, password, database
Create database
- cd blockchain-explorer/app/persistence/fabric/postgreSQL/db
- ./createdb.sh
Test Database
- sudo -u postgres psql
- \l view created fabricexplorer database
- \d view created tables
Configure Fabric network
- cd blockchain-explorer
- Copy crypto-config directory in Orderer host
- curl -sSL http://bit.ly/2ysbOFE | bash -s 1.2.0
- Copy config.json [link] to blockchain-explorer/app/platform/fabric
- Modify Orderer, Org1 [peer0 & peer1), Org2(peer0 & peer1) IP address in config.json
Build Hyperledger Explorer
- cd blockchain-explorer
- npm install
- cd blockchain-explorer/app/test
- npm install
- npm run test
- cd client/
- npm install
- npm test — -u — coverage
- npm run build
Start Hyperledger Explorer
- Set sync type to “host” in blockchain-explorer\app\exploreconfig.json file
- cd blockchain-explorer/
- ./start.sh (it will have the backend up).
Sync process
If Sync type is set to “local” in last step, sync process will happen automatically. However current version of Hyperledger explorer crashes while receiving updates in this mode.
If sync type is set to “host” in exploreconfig.json, Sync process should be initiated manually to receive updates as below
- cd blockchain-explorer/
- ./syncstart.sh (it will have the sync node up).
- ./syncstop.sh (it will stop the sync node).
Launch
- Launch the URL http://<host>:8080 on a browser. Make sure port 8080 is not blocked
If the above screen is displayed, then setup is correct and Hyperledger explorer is running.
Conclusion
Hyperledger explorer is a great tool to visualize fabric network. This is still in incubation and cannot be deployed for production usage.