Sunday, October 11, 2020

In Hyperledger Fabric chaincode Lifecyle, package of chaincode is very important step so I will show you how to package your chaincode in chaincode LifeCycle.

You need to ensure that you have chaincode development and compiled. You can develop your chaincode in Go Lang, Java, Node, Type Script, Java Script.

In ideal scenario, packaging of chaincode is done by only one organization in network rather that need to be done by each organization. One of the organization can package the chaincode and then send that package to all other organizations.

When you package the chaincode, it create a file with extension .tar.gz.

Now let's see what steps you need to follow for chaincode packaging. 

First you need to ensure that your network is up & running and channel is also created.

Before you package the chaincode, you need to set some variable so you can simply run below commands for that.



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

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

export CORE_PEER_ADDRESS=localhost:7051

Now run below command to package your chaincode. You need to ensure that you are under fabric-samples/test-network folder.

peer lifecycle chaincode package car.tar.gz --path ../chaincode/car/go/ --lang golang --label car_1


car.tar.gz is your packaged chaincode

../chaincode/car/go is the path of your compiled chaincode

golang is chaincode language 

car_1 is label of your chaincode package

This is the most recent post.
Older Post


Post a Comment