We have tested the composer application in the playground, so next we will deploy it to the blockchain:
- Create a folder called insurance-claim-network, and navigate to the folder.
- Generate a business network project template, as follows:
yo hyperledger-composer:businessnetwork
It will prompt a few questions. Enter insurance-claim-network as the network name and choose the empty template network, as shown in the following screenshot:
This will generate a few files with a default template. Replace the contents of com.packt.quickstart
.claim.cto with our earlier tested model file.
Create a new folder called lib, under the lib folder, and copy the tested logic.js in here.
Replace permissions.acl with the tested acl file, as follows:
- Start Hyperledger Fabric, as follows:
cd ~/fabric-devservers
export FABRIC_VERSION=hlfv12
./startFabric.sh
./createPeerAdminCard.sh
This will create PeerAdminCard, as shown in the following screenshot:
- Generate a business network archive. From the insurance-claim-network directory, run the following command:
composer archive create -t dir -n
This will generate insurance-claim-network@0.0.1.bna.
- Install the business network. From the insurance-claim-network directory, run the following command:
composer network install --card PeerAdmin@hlfv1 --archiveFile
insurance-claim-network@0.0.1.bna
- Start the business network. From the insurance-claim-network directory, run the following command:
composer network start --networkName insurance-claim-network --
networkVersion 0.0.1 --networkAdmin admin --networkAdminEnrollSecret
adminpw --card PeerAdmin@hlfv1 --file networkadmin.card
- Import the network admin card. From the insurance-claim-network in directory, run the following command. This will import insurance-claim-network to the network:
composer card import --file networkadmin.card
- Check if the business network has been deployed successfully. From the insurance-claim-network directory, run the following command:
composer network ping --card admin@insurance-claim-network
The result should look as follows:
Checking if the business network been deployed successfully