A streamlined setup for developing, testing, and managing a Hyperledger Fabric network, integrated seamlessly with Hyperledger Explorer for real-time network visibility.
To start the network, follow these steps:
-
Navigate to the
test-network
directory:cd test-network
-
Launch the network with the following command:
./network.sh up createChannel -c mychannel -ca
This will spin up the Fabric network and create a channel named
mychannel
. Additionally, the-ca
flag starts the Certificate Authority (CA) services for the network. -
Adding a new peer to Org1?
Simply use the commands provided in theaddPeer1.sh
script to quickly set up a peer for Org1. -
Once the network is up and running, Explorer will be available at port 8090.
Access it via your browser at:
http://localhost:8090
🔍 Explorer Dashboard:
Hyperledger Explorer provides a user-friendly interface to monitor and explore your network’s transactions, blocks, chaincodes, and peers.
- Explorer not accessible on port 8090?
If you're unable to access Explorer, try restarting it from the Docker console.
Run the following command to stop and restart the Docker services:docker-compose -f explorer/docker-compose-explorer.yaml down docker-compose -f explorer/docker-compose-explorer.yaml up -d
When your development or testing session is complete, you can bring the network down with the following command:
./network.sh down
After stopping the network, it's essential to ensure that all Docker volumes are properly removed. This will prevent potential issues when restarting the network for future sessions.
To explore and test chaincode functionality, you can run the Asset-Transfer-Basic application. Follow the steps below:
-
Navigate to the Asset Transfer Directory:
cd asset-transfer-basic/application-gateway-typescript
-
Install required dependencies using
yarn
:yarn install
-
Start the application by running:
cd src ts-node app.js
You can test various functionalities of the Asset Transfer chaincode by enabling/disabling the provided methods in the app.js
file. Here’s an example of how you can customize which functions to run:
// Initialize a set of asset data on the ledger using the chaincode 'InitLedger' function.
// await initLedger(contract);
// Return all the current assets on the ledger.
await getAllAssets(contract);
// Create a new asset on the ledger.
// await createAsset(contract);
// Update an existing asset asynchronously.
// await transferAssetAsync(contract);
// Get the asset details by assetID.
// await readAssetByID(contract);
// Update an asset which does not exist.
// await updateNonExistentAsset(contract);
🔑 Tip:
Simply uncomment the method(s) you want to test and comment out the ones you don't. This way, you can control which operations to perform on the ledger.
- Fabric Network: A customizable, multi-org, multi-peer Hyperledger Fabric network.
- Explorer Integration: Real-time monitoring of the network, including transactions, chaincodes, and blocks via Hyperledger Explorer.
- Chaincode Testing: A ready-to-go asset transfer chaincode application in TypeScript for testing and development.
🎉 Happy Developing with Hyperledger Fabric & Explorer! 🎉