$ nano .bash_profile

export PATH=$PATH:~/fabric-samples/bin

$ source .bash_profile

$ peer version

$ ./ deployCC \
-c myfirstchannel \
-ccn basic \
-ccp ../asset-transfer-basic/chaincode-go \
-ccl go

peer chaincode query -C myfirstchannel -n basic -c ‘{“Args”:[“GetAllAssets”]}’ | jq

Within assetTransfer let’s add our own asset

            ID: 'asset7',
            Color: 'violet',
            Size: 10,
            Owner: 'Alice',
            AppraisedValue: 900,
            ID: 'asset8',
            Color: 'brown',
            Size: 5,
            Owner: 'Bob',
            AppraisedValue: 1000,

Make sure you are in this directory

$ cd ~/tools/hyperledger/fabric-samples/test-network

Create a new channel

$ ./ createChannel -c newchannel

./ deployCC \
-c newchannel \
-ccn basic \
-ccp ../asset-transfer-basic/chaincode-javascript \
-ccl javascript

$ peer chaincode query \
-C newchannel -n basic -c ‘{“Args”:[“GetAllAssets”]}’ | jq

$ nano

export FABRIC_CFG_PATH=$PWD/../config/



export CORE_PEER_TLS_ROOTCERT_FILE=${PWD}/organizations/peerOrganizations/

export CORE_PEER_MSPCONFIGPATH=${PWD}/organizations/peerOrganizations/

export CORE_PEER_ADDRESS=localhost:7051

export PATH=${PWD}/../bin:$PATH

Terminal – now let’s initialize the ledger with assets

peer chaincode invoke -o localhost:7050 \
–ordererTLSHostnameOverride \
–tls –cafile “${PWD}/organizations/ordererOrganizations/” \
-C newchannel \
-n basic \
–peerAddresses localhost:7051 \
–tlsRootCertFiles “${PWD}/organizations/peerOrganizations/” \
–peerAddresses localhost:9051 \
–tlsRootCertFiles “${PWD}/organizations/peerOrganizations/” \
-c ‘{“function”:”InitLedger”,”Args”:[]}’

Day 4 – 18th Oct 2023


Test the Smart Contract
Now we can start testing our smart contract for these functions:

(1) Call the makeEquipment chaincode method:

sudo ./ invoke equipment GlobalEquipmentCorp 2000.001 e360-Ventilator GlobalEquipmentCorp

(2) Issue the following script command to query equipment:

sudo ./ invoke query 2000.001

(3) Continue to invoke the remaining equipment functions for the wholesaler and

sudo ./ invoke wholesaler 2000.001 GlobalWholesalerCorp

sudo ./ invoke pharmacy 2000.001 PharmacyCorp

(4) Once equipment ownership is moved to the pharmacy, the supply chain reaches
its final state. We can issue queryHistoryByKey from the peer chaincode query
command. Let’s check equipment historical data:

sudo ./ invoke queryHistory 2000.001

All of the transaction history records are displayed as output. We have tested our smart contract, and it works as expected.

const wallet = await Wallets.newFileSystemWallet(‘../identity/ user/’+userName+’/wallet’);

const gateway = new Gateway();
let connectionProfile =
yaml.safeLoad(fs.readFileSync(‘../../../organizations/peerOrganizations/’, ‘utf8’));
// Set connection options; identity and wallet
let connectionOptions = {
identity: userName,
wallet: wallet,
discovery: { enabled: true, asLocalhost: true }
await gateway.connect(connectionProfile, connectionOptions);

Day 5 : 19th Oct 2023


Insurance Claim Management

Doc :

Demo :

Spare Parts Management

Doc :

Demo :


Hackathon announcement

VAC D5 Resources