Hyperledger Explorer Setup with Hyperledger Fabric

sudo apt update
sudo apt upgrade
# Docker Installation
sudo apt-get remove docker docker-engine docker.io containerd runc
docker system prunedocker system prune -a

sudo apt update
sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
gnupg-agent \
software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo apt-key fingerprint 0EBFCD88
sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.iosudo groupadd docker
sudo usermod -aG docker $USER
logout
#exit from docker installation#docker-compose installsudo curl -L https://github.com/docker/compose/releases/download/1.18.0/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-composesudo chmod +x /usr/local/bin/docker-compose
curl -sSL https://bit.ly/2ysbOFE | bash -s
sudo nano ~/.profile
#add this in last to set the path of cryptogen it will be used when #we create our cryptoconfig or first network
export PATH=/home/ubuntu/fabric-samples/bin:$PATH
source ~/.profile
cd /home/ubuntu/fabric-samples/first-network
./byfn.sh up
#If it runs correctly then its ok but if it does not run Correctly #then
#check it is running correctly or not
#if not delete all docker images
docker kill $(docker ps -q)
docker rm $(docker ps -aq)
docker rmi $(docker images peer* -q)
docker system prune
docker system prune -a
#Install GO
wget https://dl.google.com/go/go1.11.2.linux-amd64.tar.gz
tar -xzvf go1.11.2.linux-amd64.tar.gz
mv go/ /usr/local
nano ~/.bashrc
#add these two lines in bashrc to set paths of GO
export GOPATH=/usr/local/go
export PATH=$PATH:$GOPATH/bin
source ~/.bashrc
#Clone blockchain explorer
git clone https://github.com/hyperledger/blockchain-explorer.git
#Install POSTGRE
sudo apt-get update
sudo apt-get install postgresql postgresql-contrib
#Configure blockchain explorer
cd blockchain-explorer/app
modify explorerconfig.json
#set your database username and password
cd blockchain-explorer/app/persistence/fabric/postgreSQL
chmod -R 775 db/
cd blockchain-explorer/app/persistence/fabric/postgreSQL/db
./createdb.sh
#If createdb.sh is not running then copy explrerpg.sql file into the postgres directory then run the cmds
$ sudo -u postgres -i
$ ALTER USER postgres PASSWORD 'password'
$ psql postgres -v dbname=fabricexplorer -v user=postgres -v passwd=password -f ./explorerpg.sql ;
$ cd /home/ubuntu/blockchain-explorer/app/platform/fabric/connection-profile/
$ nano first-network.json
# change the following PATH according to your need
# adminPrivateKey path
# signedCert path
# tlsCACertspath
$ SAMPLE: /home/ubuntu/fabric-samples/first-network/crypto-config/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/keystore/aaacd899a6362a5c8cc1e6f86d13bfccc777375365bbda9c710bb7119993d71c_sk
#especially bold part
$ cd blockchain-explorer
$ ./main.sh install
$ ./main.sh clean // if u get any error
$ ./main.sh test
$ cd blockchain-explorer/
$ ./start.sh (it will have the backend up). // if u will get error in channel then delete the channel manually from postgres.
$ ./start.sh debug (it will have the backend in debug mode).
$ ./start.sh print (it will print help).

--

--

--

Love podcasts or audiobooks? Learn on the go with our new app.

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
ABHISHEK KUMAR

ABHISHEK KUMAR

More from Medium

MinIO SDK Using REST API .NET

How to read/write Azure AD B2C custom user attributes?

Docker Networking — Bridge Network

Fix no require module provides package