Join Peer to BYFN Network Channel

Q

How to join the default peer to a BYFN network Channel?

✍: FYIcenter.com

A

You can follow this tutorial to join the default peer to a BYFN network Channel.

In last tutorial, we have created a transaction file, channel.tx, that contains a transaction message to create a channel called "mychannel" on the BYFN network.

Now we need connect to the BYFN CLI container to submit it the running BYFN network.

1. Connect the FYBN CLI container:

$ docker exec -it cli bash
bash-4.4# 

2. Verify if the channel.tx file is deployed on the CLI container or not:

bash-4.4# ls -l channel-artifacts/
total 28
-rw-r--r--  1 1000  1000    284 Apr  1 23:59 Org1MSPanchors.tx
-rw-r--r--  1 1000  1000    284 Apr  1 23:59 Org2MSPanchors.tx
-rw-r--r--  1 1000  1000    346 Apr  1 23:57 channel.tx
-rw-r--r--  1 1000  1000  12980 Apr  1 23:56 genesis.block

3. Submit transaction file, channel.tx, to create a channel:

bash-4.4# peer channel create -o orderer.example.com:7050 -c mychannel \
   -f ./channel-artifacts/channel.tx --tls \
   --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto\
   /ordererOrganizations/example.com/orderers/orderer.example.com/msp\
   /tlscacerts/tlsca.example.com-cert.pem
   
[channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
[cli.common] readBlock -> INFO 002 Got status: &{NOT_FOUND}
[channelCmd] InitCmdFactory -> INFO 003 Endorser and orderer connections initialized
[cli.common] readBlock -> INFO 004 Received block: 0   

4. Verify the output file, mychannel.block, which contains the channel information:

bash-4.4# ls -l mychannel.block
-rw-r--r--    1 root     root         15994 Apr 12 00:52 mychannel.block

5. Join the default peer to the "mychannel":

bash-4.4# peer channel join -b mychannel.block
[channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
[channelCmd] executeJoin -> INFO 002 Successfully submitted proposal to join channel

6. Verify channels joined by the default peer:

bash-4.4# peer channel list

[channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
Channels peers has joined:
mychannel

peer0.org1.example.com has joined the "mychannel".

 

Switch Default Peer on BYFN CLI Container

CORE_PEER_* Environment Variables on BYFN CLI

Hyperledger Fabric Sample Networks

⇑⇑ Hyperledger Tutorials

2019-04-12, 246👍, 0💬