Hyperledger fabric custom block explorer built using React JS as client and Node JS as server
-
Nodejs 10.x.x
-
Fabric Network
-
Fabric Crypto material
First ensure you are in a new and empty directory.
- Clone the repository
git clone https://github.com/varuntejay/fabric-block-explorer
- Change the directory to the server and install node modules
cd ./server
npm install
- Change the directory to the client and install node modules
cd ./client
npm install
- Copy the peer TLS certificate from network crypto-config folder to the following directory
./server/src/certs
E.g. peer TLS certificate path in fabric samples - first network is following
fabric-samples/first-network/crypto-config/peerOrganizations/org1.example.com/tlsca/tlsca.org1.example.com-cert.pem
- Copy the user certificate registered either from fabric-ca tool or custom tool to the following directory
./server/src/certs/hfc
- If User certificate available. Please update the following globalconfig file with username
./server/src/globalconfig.js
module.exports.FABRIC_CLIENT_USERNAME = '{username}'
-
If you don't have scripts to generate user certificates. Please follow the steps listed below.
- Open the following file in a code/text editor
./server/src/globalconfig.js
- Edit the following configuration to point to the fabric CA
module.exports.FABRIC_CA_URL='http://localhost:7054' module.exports.FABRIC_CLIENT_USERNAME = 'user1'
- Next run the following scripts one after another.
./server/src/fabric_ca/enrolladmin.js ./server/src/fabric_ca/enrollaffiliation.js ./server/src/fabric_ca/registeruser.js
- With the above steps, a user certificate will be created under the following directory.
./server/src/certs/hfc
- Update the fabric configuration following global config file.
./server/src/globalconfig.js
//
module.exports.FABRIC_CHANNEL_NAME = 'mychannel'
module.exports.FABRIC_PEER_NAME = 'peer0.org1.example.com'
module.exports.FABRIC_PEER_ADDRESS = 'grpcs://localhost:7051'
-
First, ensure that you're in the fabric-block-explorer/server folder.
-
Run the node express back end server in dev mode. This will up bring the express server on PORT 9086.
npm run dev
- Make a test get call to express server. This will return "Hello from server".
http://localhost:9086
-
First, ensure that you're in the fabric-block-explorer/client folder.
-
Run the web application in dev mode. This will up bring the react front end application on PORT 4000.
npm run dev
- Check out to the following URL to access the web application.
http://localhost:4000