⛓️Channel Creation
Here we will understand the Confixtx.yaml file and learn how to create channel.
Create Channel
Set the Config Path
export PATH=${PWD}/../bin:${PWD}:$PATH
export FABRIC_CFG_PATH=${PWD}/configtx
export CHANNEL_NAME=mychannelCreate the System Genesis Block and Channel Genesis block
configtxgen -profile TwoOrgsApplicationGenesis -outputBlock ./channel-artifacts/${CHANNEL_NAME}.block -channelID $CHANNEL_NAMEConvert Block to JSON format to understand the data inside it.
configtxgen -inspectBlock ./channel-artifacts/mychannel.block > dump.jsonCopy some prerequisites
cp ../config/core.yaml ./configtx/.Create the Channel
Let's Export the Environment variables to provide Orderer access to our terminal.
export ORDERER_CA=${PWD}/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem
export ORDERER_ADMIN_TLS_SIGN_CERT=${PWD}/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/tls/server.crt
export ORDERER_ADMIN_TLS_PRIVATE_KEY=${PWD}/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/tls/server.keyLet's create a channel using "OSNADMIN" binary file.
osnadmin channel join --channel-id $CHANNEL_NAME --config-block ./channel-artifacts/${CHANNEL_NAME}.block -o localhost:7053 --ca-file "$ORDERER_CA" --client-cert "$ORDERER_ADMIN_TLS_SIGN_CERT" --client-key "$ORDERER_ADMIN_TLS_PRIVATE_KEY"Join the Organizational peers in the channel
First Let's join Org1 Peer.
To join the channel, our terminal needs access to peer, for that let's write a script which will set the environment variables.
Script Name: setOrgPeerContext.sh
Now let's source the script.
Let's join the peer now
Join Org2 Peer Now
Update Anchor peer for Org1
Update Anchor peer for Org2
That's it!
Last updated
Was this helpful?