Tips of setting up Hyperledger Explorer
It’s been awhile since I worked on Hyperledger Fabric. Recently I had revisited some of the materials built by my ex-teammate Jaren and Aldred and I would to use Hyperledger Explorer in order to monitor the transactions within the network.
Hyperledger Explorer is relatively simple to setup, especially when you try to connect to test network. Most of the configuration is pre-configured and just need to copy the right crypto materials and docker compose network name. This is where I start to face challenges when trying to setup Hyperledger Explorer to connect to my own setup, especially when the hostnames are different, not using ./network.sh
to bootstrap the crypto material. Here I summarise a few tips that you should look for.
1. Docker Compose Network Name
By design Docker Compose will create default network and bridge network, so that you (from host machine) and other containers can interact to each other. Important part is it is discoverable by using hostname that is identical to the container name. This is important as Explorer configuration we are using hostname rather than IP, e.g., peer0.org1.example.com.
In order to allow Hyperledger Explorer to connect to Fabric network, it is important to ensure the same network name is connected. This is done via defining the same network name in docker-compose.yaml of Hyperledger Fabric network, and same network work in docker-composer.yaml of Hyperledger Explorer. Once the Hyperledger Fabric is up and connect, Hyperledger Explorer containers will connnect to pre-existing network (in this example it is called fabric-test
using dockerexternal
annotation.
Example of network name in Hyperledger Fabric docker-compose.yaml
...
networks:
basic:
name: fabric_testservices:
ca.issuer1.com:
image: hyperledger/fabric-ca:1.4.8
environment:
- FABRIC_CA_HOME=/var/hyperledger/fabric-ca-server
- FABRIC_CA_SERVER_CA_NAME=ca
...
Example of network name in Hyperledger Explorer docker-compose.yaml
# SPDX-License-Identifier: Apache-2.0version: '2.1'volumes:
pgdata:
walletstore:networks:
mynetwork.com:
external:
name: fabric_test
services:
...
You can use docker command docker network list
to check the network name that runs in your machine.
2. Crypto Material
This is the mistakes I made the most. It is important that you copied the correct crypto materials from Hyperledger Fabric folder to organizations
folder in Hyperledger Explorer folder. As the crypto material is mapped to the /tmp/crypto
within the container, therefore it is important to ensure the path of private key and certificates are correct in test-config.json
.
3. Channel Name
Changed from default mychannel
to the channel name that you use in test-config.json
.
...
"channels": {
"channel1": { // channel name
"peers": {
"peer0.applicant1.com": {}
}
}
},
...
4. Disable Docker gRPC FUSE for file sharing
This is probably more related to Mac user. Ensure that you uncheck Use gRPC FUSE for file sharing
option in Preference of Docker Desktop.