Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In Hyperledger Fabric, how do I join a channel if I cannot use the peer channel fetch command?

I want to be able to have my peer join a channel (mychannel in this case). This specific peer does not have the mychannel.block file on its filesystem.

What I then tried was to use peer channel fetch 0 -c mychannel. I then get the following error:

2019-01-15 08:11:18.948 UTC [msp] Validate -> DEBU 036 MSP ZafitMSP validating identity
2019-01-15 08:11:18.949 UTC [msp] GetDefaultSigningIdentity -> DEBU 037 Obtaining default signing identity
2019-01-15 08:11:18.949 UTC [grpc] DialContext -> DEBU 038 parsed scheme: ""
2019-01-15 08:11:18.949 UTC [grpc] DialContext -> DEBU 039 scheme "" not registered, fallback to default scheme
2019-01-15 08:11:18.949 UTC [grpc] watcher -> DEBU 03a ccResolverWrapper: sending new addresses to cc: [{peer1.zafit.example.com:7051 0  <nil>}]
2019-01-15 08:11:18.949 UTC [grpc] switchBalancer -> DEBU 03b ClientConn switching balancer to "pick_first"
2019-01-15 08:11:18.950 UTC [grpc] HandleSubConnStateChange -> DEBU 03c pickfirstBalancer: HandleSubConnStateChange: 0xc4202b78d0, CONNECTING
2019-01-15 08:11:18.952 UTC [grpc] HandleSubConnStateChange -> DEBU 03d pickfirstBalancer: HandleSubConnStateChange: 0xc4202b78d0, READY
2019-01-15 08:11:18.953 UTC [channelCmd] InitCmdFactory -> INFO 03e Endorser and orderer connections initialized
2019-01-15 08:11:18.953 UTC [msp] GetDefaultSigningIdentity -> DEBU 03f Obtaining default signing identity
2019-01-15 08:11:18.953 UTC [msp] GetDefaultSigningIdentity -> DEBU 040 Obtaining default signing identity
2019-01-15 08:11:18.953 UTC [msp/identity] Sign -> DEBU 041 Sign: plaintext: 0AF2060A1508051A0608A6ABF6E10522...1BB3248E4BFA12080A021A0012021A00
2019-01-15 08:11:18.953 UTC [msp/identity] Sign -> DEBU 042 Sign: digest: C8988576954088FD1A61D6D4FFA7A7280E52F10B2F2671693C260B54B09F3B89
2019-01-15 08:11:18.954 UTC [cli/common] readBlock -> INFO 043 Got status: &{NOT_FOUND}

However, when I copy the mychannel.block file from another peer I am able to join mychannel successfully. The peer channel fetch command also works successfully after joining the channel.

To me this seems like a chicken and egg scenario, I need to join the channel as a peer, but I can't join because I need the genesis block. But I can't get the genesis block because I need to join the channel?

So the question is what is the appropriate command to retrieve the genesis mychannel.block file?

like image 517
Shiraaz.M Avatar asked Jan 15 '19 08:01

Shiraaz.M


1 Answers

It turns out that I needed to add the orderer parameter -o. Additionally, since I was connecting with TLS, I needed to specify --tls true as well as specify the --cafile.

The full command is as follows:?

peer channel fetch 0 -c mychannel -o orderer.example.com:7050 --tls true --cafile $ORDERER_CA

like image 102
Shiraaz.M Avatar answered Oct 31 '22 01:10

Shiraaz.M