We can use the configrxgen tool to create important artifacts for the food supply chain network, namely: the Genesis block, channel, and anchor peer transactions. To achieve that goal, we run the following commands:
> configtxgen -profile FSCOrgsOrdererGenesis -outputBlock ./channel-artifacts/genesis.block
> export CHANNEL_NAME="fscchannel"
> configtxgen -profile FSCOrgsChannel -outputCreateChannelTx ./channel-artifacts/channel.tx -channelID $CHANNEL_NAME
The first command creates the orderer Genesis block, whereas the last command initiates a channel configuration transaction, channel.tx. At each step we supply to the configtxgen tool the profiles defined earlier in the configtx.yaml file.
After creating a channel with multiple organizations, we need to define AnchorPeers to initiate gossip communication between peers from different organizations. As stated in the official documentation at https://hyperledger-fabric.readthedocs.io/en/release-1.2/glossary.html#anchor-peer, an anchor node serves as the entry point for another organization's peer on the same channel to communicate with each of the peers in the anchor peer’s organization.
Next, we need to use configtxgen to create a configuration update transaction to include those anchor peers for the different Orgs:
configtxgen -profile FSCOrgsChannel -outputAnchorPeersUpdate ./channel-artifacts/Org1MSPanchors.tx -asOrg Org1MSP -channelID $CHANNEL_NAME
configtxgen -profile FSCOrgsChannel -outputAnchorPeersUpdate ./channel-artifacts/Org2MSPanchors.tx -asOrg Org2MSP -channelID $CHANNEL_NAME
configtxgen -profile FSCOrgsChannel -outputAnchorPeersUpdate ./channel-artifacts/Org3MSPanchors.tx -asOrg Org3MSP -channelID $CHANNEL_NAME
To update an anchor peer in the FSCOrgsChannel channel, run the following commands:
peer channel update -f ./channel-artifacts/Org${ORG}MSPanchors.tx -c $CHANNEL_NAME -o orderer.fsc.com:7050 --tls $CORE_PEER_TLS_ENABLED --cafile $ORDERER_CA >&log.txt
As a result, you should see output similar to the following screenshot: