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_ENABLED=true

export CORE_PEER_LOCALMSPID="Org1MSP"

export CORE_PEER_TLS_ROOTCERT_FILE=${PWD}/organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt

export CORE_PEER_MSPCONFIGPATH=${PWD}/organizations/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp

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

Here

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



Next
This is the most recent post.
Previous
Older Post

0 comments :

Post a Comment