The purpose of this article is so provide the minimum steps to get the simplest configuration of Hyperledger Explorer up and running on a Mac to show the state of a Hyperledger Fabric network.
This article is has the following structure
Install Hyperledger Explorer
To keep things as simple as possible all of the default values from the Hyperledger tutorials are used.
I ran into some issues where things silently failed so I have included screenshots for some of the install steps as a reference to what it should look like.
For the purpose of adding commands into this doc I am cloning the repo into ~/Hyperledger
$ git clone
For the purpose of the demo all of the default database settings will be left as is
Database
Using the default configuration at
~/Hyperledger/blockchain-explorer/app/explorerconfig.json
Start the PostgreSQL.
$ pg_ctl -D /usr/local/var/postgres start
To create the database
$ cd ~/Hyperledger/blockchain-explorer/app/persistence/fabric/postgreSQL/db
$ ./createdb.sh
App Config
I have updated the app config below to include the settings required to use fabric-ca as the certificate authority.
$ vim ~/Hyperledger/blockchain-explorer/app/platform/fabric/config.json
The updated config should look like
{
"network-configs": {
"network-1": {
"version": "1.0",
"clients": {
"client-1": {
"tlsEnable": true,
"organization": "Org1MSP",
"channel": "mychannel",
"credentialStore": {
"path": "./tmp/credentialStore_Org1/credential",
"cryptoStore": {
"path": "./tmp/credentialStore_Org1/crypto"
}
}
}
},
"channels": {
"mychannel": {
"peers": {
"peer0.org1.example.com": {}
},
"connection": {
"timeout": {
"peer": {
"endorser": "6000",
"eventHub": "6000",
"eventReg": "6000"
}
}
}
}
},
"organizations": {
"Org1MSP": {
"certificateAuthorities": "fabric-ca",
"mspid": "Org1MSP",
"fullpath": false,
"adminPrivateKey": {
"path": "/tmp/fabric-samples/first-network/crypto-config/peerOrganizations/org1.example.com/users/[email protected]/msp/keystore"
},
"signedCert": {
"path": "/tmp/fabric-samples/first-network/crypto-config/peerOrganizations/org1.example.com/users/[email protected]/msp/signcerts"
}
},
"Org2MSP": {
"certificateAuthorities": "fabric-ca",
"mspid": "Org2MSP",
"adminPrivateKey": {
"path": "/tmp/fabric-samples/first-network/crypto-config/peerOrganizations/org2.example.com/users/[email protected]/msp/keystore"
}
},
"OrdererMSP": {
"mspid": "OrdererMSP",
"adminPrivateKey": {
"path": "/tmp/fabric-samples/first-network/crypto-config/ordererOrganizations/example.com/users/[email protected]/msp/keystore"
}
}
},
"peers": {
"peer0.org1.example.com": {
"tlsCACerts": {
"path": "/tmp/fabric-samples/first-network/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt"
},
"url": "grpcs://localhost:7051",
"eventUrl": "grpcs://localhost:7053",
"grpcOptions": {
"ssl-target-name-override": "peer0.org1.example.com"
}
},
"peer1.org1.example.com": {
"url": "grpcs://localhost:8051"
},
"peer0.org2.example.com": {
"url": "grpcs://localhost:9051"
},
"peer1.org2.example.com": {
"url": "grpcs://localhost:10051"
}
},
"orderers": {
"orderer.example.com": {
"url": "grpcs://localhost:7050"
}
},
"certificateAuthorities": {
"fabric-ca": {
"url": "http://localhost:7054",
"httpOptions":{
"verify": false
},
"registrar": {
"enrollId": "admin",
"enrollSecret": "adminpw"
},
"caName": "fabric-ca"
}
}
},
"network-2": {}
},
"configtxgenToolPath": "/tmp/fabric-samples/bin",
"license": "Apache-2.0"
}
Build the App
$ cd ~/Hyperledger/blockchain-explorer
$ npm install
Initially I ran into an error here
$ npm install
> [email protected] install /Users/benlongstaff/Hyperledger/blockchain-explorer/node_modules/pkcs11js
> node-gyp rebuild
gyp WARN download NVM_NODEJS_ORG_MIRROR is deprecated and will be removed in node-gyp v4, please use NODEJS_ORG_MIRROR
xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance
.....
npm ERR! errno 1
npm ERR! [email protected] install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
the issue was caused by
$ xcodebuild -version
xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance
to fix it
$ sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
which then gave
$ xcodebuild -version
Xcode 10.1
Build version 10B61
run the app tests
$ cd ~/Hyperledger/blockchain-explorer/app/test
$ npm install
$ npm run test
There seems to be one test that has an error in it but it doesn’t prevent the app running.
build the client
$ cd ~/Hyperledger/blockchain-explorer/client
$ npm install
$ npm test -- -u --coverage
$ npm run build
$ serve -s build
start the backend
$ cd ~/Hyperledger/blockchain-explorer
$ ./start.sh
If everything has gone to plan you should now be able to access it at http://localhost:8080
Shutdown
$ cd ~/Hyperledger/blockchain-explorer/
$ ./stop.sh
$ cd /tmp/fabric-samples/first-network/
$ ./byfn.sh down
Next Steps
If you want to learn more about the architecture of Hyperledger Fabric checkout this cheatsheet I put together.
This article is has the following structure
- Screenshots of the end result.
- Dependency installs
- Installing Hyperledger Explorer
Dashboard for the NetworkHyperledger Explorer is an open source project that is intended to eventually support all of the Hyperledger distributed ledgers, currently it only supports Hyperledger Fabric.
Block details
A list of all of the nodes in the network
All of the blocks across the channels.
All of the transactions in the blocks
A list of all of the chaincode (sometimes referred to as smart contracts)
Channel list, note that each channel has its own blockchain.
Example transaction.Installing Dependancies
This article is written using Hyperledger Explorer and Hyperledger Fabric release 1.4.
If you don’t already have it installed follow the on the site.
(8.11.x)
Note that v9.x is not currently supported.
$ which node
/usr/local/bin/node
$ npm install -g n
$ sudo n 8.11.1
$ node --version
v8.11.1
PostgreSQL
$ brew install postgres
$ which postgres
/usr/local/bin/postgres
$ postgres --version
postgres (PostgreSQL) 11.1
$ brew install jq
$ which jq
/usr/local/bin/jq
$ jq --version
jq-1.6
$ which docker
/usr/local/bin/docker
$ docker --version
Docker version 18.09.1, build 4c52b90
$ which docker-compose
/usr/local/bin/docker-compose
$ docker-compose --version
docker-compose version 1.23.2, build 1110ad01
Hyperledger Fabric
All of the terminal commands assume that the Hyperledger Fabric
are installed at /tmp
$ cd /tmp/fabric-samples/first-network/
$ ./byfn.sh generate
$ ./byfn.sh up
Install Hyperledger Explorer
To keep things as simple as possible all of the default values from the Hyperledger tutorials are used.
I ran into some issues where things silently failed so I have included screenshots for some of the install steps as a reference to what it should look like.
For the purpose of adding commands into this doc I am cloning the repo into ~/Hyperledger
$ git clone
For the purpose of the demo all of the default database settings will be left as is
Database
Using the default configuration at
~/Hyperledger/blockchain-explorer/app/explorerconfig.json
Start the PostgreSQL.
$ pg_ctl -D /usr/local/var/postgres start
To create the database
$ cd ~/Hyperledger/blockchain-explorer/app/persistence/fabric/postgreSQL/db
$ ./createdb.sh
App Config
I have updated the app config below to include the settings required to use fabric-ca as the certificate authority.
$ vim ~/Hyperledger/blockchain-explorer/app/platform/fabric/config.json
The updated config should look like
{
"network-configs": {
"network-1": {
"version": "1.0",
"clients": {
"client-1": {
"tlsEnable": true,
"organization": "Org1MSP",
"channel": "mychannel",
"credentialStore": {
"path": "./tmp/credentialStore_Org1/credential",
"cryptoStore": {
"path": "./tmp/credentialStore_Org1/crypto"
}
}
}
},
"channels": {
"mychannel": {
"peers": {
"peer0.org1.example.com": {}
},
"connection": {
"timeout": {
"peer": {
"endorser": "6000",
"eventHub": "6000",
"eventReg": "6000"
}
}
}
}
},
"organizations": {
"Org1MSP": {
"certificateAuthorities": "fabric-ca",
"mspid": "Org1MSP",
"fullpath": false,
"adminPrivateKey": {
"path": "/tmp/fabric-samples/first-network/crypto-config/peerOrganizations/org1.example.com/users/[email protected]/msp/keystore"
},
"signedCert": {
"path": "/tmp/fabric-samples/first-network/crypto-config/peerOrganizations/org1.example.com/users/[email protected]/msp/signcerts"
}
},
"Org2MSP": {
"certificateAuthorities": "fabric-ca",
"mspid": "Org2MSP",
"adminPrivateKey": {
"path": "/tmp/fabric-samples/first-network/crypto-config/peerOrganizations/org2.example.com/users/[email protected]/msp/keystore"
}
},
"OrdererMSP": {
"mspid": "OrdererMSP",
"adminPrivateKey": {
"path": "/tmp/fabric-samples/first-network/crypto-config/ordererOrganizations/example.com/users/[email protected]/msp/keystore"
}
}
},
"peers": {
"peer0.org1.example.com": {
"tlsCACerts": {
"path": "/tmp/fabric-samples/first-network/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt"
},
"url": "grpcs://localhost:7051",
"eventUrl": "grpcs://localhost:7053",
"grpcOptions": {
"ssl-target-name-override": "peer0.org1.example.com"
}
},
"peer1.org1.example.com": {
"url": "grpcs://localhost:8051"
},
"peer0.org2.example.com": {
"url": "grpcs://localhost:9051"
},
"peer1.org2.example.com": {
"url": "grpcs://localhost:10051"
}
},
"orderers": {
"orderer.example.com": {
"url": "grpcs://localhost:7050"
}
},
"certificateAuthorities": {
"fabric-ca": {
"url": "http://localhost:7054",
"httpOptions":{
"verify": false
},
"registrar": {
"enrollId": "admin",
"enrollSecret": "adminpw"
},
"caName": "fabric-ca"
}
}
},
"network-2": {}
},
"configtxgenToolPath": "/tmp/fabric-samples/bin",
"license": "Apache-2.0"
}
Build the App
$ cd ~/Hyperledger/blockchain-explorer
$ npm install
Initially I ran into an error here
$ npm install
> [email protected] install /Users/benlongstaff/Hyperledger/blockchain-explorer/node_modules/pkcs11js
> node-gyp rebuild
gyp WARN download NVM_NODEJS_ORG_MIRROR is deprecated and will be removed in node-gyp v4, please use NODEJS_ORG_MIRROR
xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance
.....
npm ERR! errno 1
npm ERR! [email protected] install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
the issue was caused by
$ xcodebuild -version
xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance
to fix it
$ sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
which then gave
$ xcodebuild -version
Xcode 10.1
Build version 10B61
run the app tests
$ cd ~/Hyperledger/blockchain-explorer/app/test
$ npm install
$ npm run test
There seems to be one test that has an error in it but it doesn’t prevent the app running.
build the client
$ cd ~/Hyperledger/blockchain-explorer/client
$ npm install
$ npm test -- -u --coverage
$ npm run build
$ serve -s build
start the backend
$ cd ~/Hyperledger/blockchain-explorer
$ ./start.sh
If everything has gone to plan you should now be able to access it at http://localhost:8080
Shutdown
$ cd ~/Hyperledger/blockchain-explorer/
$ ./stop.sh
$ cd /tmp/fabric-samples/first-network/
$ ./byfn.sh down
Next Steps
If you want to learn more about the architecture of Hyperledger Fabric checkout this cheatsheet I put together.