Reputation: 35
I created two channels named:
I want to install two different chaincodes in the two channels how can I achieve this????
Upvotes: 0
Views: 583
Reputation: 41222
Installation of one chaincode code into specific channel not very different from doing the same, e.g. installing two chaincodes into two separate channels, please consider read official tutorial. In fact the chaincode installation is out of channel context, installation is the process of literally moving chaincode bytes into peer file system.
Basically the operation is fairly simple you just need to specify different channel names and different chaincodes, something like this:
peer chaincode install -o localhost:7050 -n chaincode1 -v 1.0 -p github.com/chaincodes/chaincode1
and then the second one:
peer chaincode install -o localhost:7050 -n chaincode2 -v 1.0 -p github.com/chaincodes/chaincode2
above will move both chaincodes bytes into peer's file system. Next you just need to instantiate chaincodes in context of right channel:
peer chaincode instantiate -o localhost:7050 -n chaincode1 -v 1.0 -C first -c '{"Args":[]}'
and to instantiate second chaincode for second channel:
peer chaincode instantiate -o localhost:7050 -n chaincode2 -v 1.0 -C second -c '{"Args":[]}'
You can find some more explanatory examples in fabric-samples repository.
Upvotes: 1