Create the Hyperledger Channel

Create your Hyperledger Channel

Before deploying your smart contract, you need to establish an environment for running the smart contract. You need to create a Fabric Channel and join all peers to your Fabric Channel.

In terminal 1, execute the following commands to create a Fabric Channel ${USER}-channel

#Configure a channel
configtxgen -profile AppChannel \
--configPath ${FABRIC_CFG_PATH} \
--channelID ${USER}-channel \
-outputCreateChannelTx ~/channel.tx

#Create a new channel (with a genesis block)
peer channel create -o node-1:7050 \
--channelID  ${USER}-channel \
-f ~/channel.tx \
--outputBlock ~/channel.block

#Let peer node-1 join the newly created channel
peer channel join -b ~/channel.block

#Verify if your Fabric Channel is on the list 
peer channel list

In terminal 2, join the newly created channel (via the ~/channel.block; shared in your home directory)

#Let peer node-2 join the newly created channel
peer channel join -b ~/channel.block

#Verify if your Fabric Channel is on the list 
peer channel list

Do the same in terminal 3

#Let peer node-3 join the newly created channel
peer channel join -b ~/channel.block

#Verify if your Fabric Channel is on the list 
peer channel list

Last updated

Was this helpful?