Hyperledger fabric: Cant connect peer to channel

0 votes

I am trying to join peer to the channel. When i run the following command: 

peer channel join -b mychannel.block

I get below error

2017-08-02 06:38:12.375 UTC [msp] GetLocalMSP -> DEBU 001 Returning existing local MSP
2017-08-02 06:38:12.376 UTC [msp] GetDefaultSigningIdentity -> DEBU 002 Obtaining default signing identity
2017-08-02 06:38:12.379 UTC [grpc] Printf -> DEBU 003 grpc: addrConn.resetTransport failed to create client transport: connection error: desc = "transport: Error while dialing dial tcp 172.19.0.2:8051: getsockopt: connection refused"; Reconnecting to {peer1.org1.example.com:8051 <nil>}
2017-08-02 06:38:13.379 UTC [grpc] Printf -> DEBU 004 grpc: addrConn.resetTransport failed to create client transport: connection error: desc = "transport: Error while dialing dial tcp 172.19.0.2:8051: getsockopt: connection refused"; Reconnecting to {peer1.org1.example.com:8051 <nil>}
2017-08-02 06:38:15.085 UTC [grpc] Printf -> DEBU 005 grpc: addrConn.resetTransport failed to create client transport: connection error: desc = "transport: Error while dialing dial tcp 172.19.0.2:8051: getsockopt: connection refused"; Reconnecting to {peer1.org1.example.com:8051 <nil>}
Error: Error getting endorser client channel: PER:404 - Error trying to connect to local peer
/opt/gopath/src/github.com/hyperledger/fabric/peer/common/common.go:116 github.com/hyperledger/fabric/peer/common.GetEndorserClient
/opt/gopath/src/github.com/hyperledger/fabric/peer/channel/channel.go:149 github.com/hyperledger/fabric/peer/channel.InitCmdFactory
/opt/gopath/src/github.com/hyperledger/fabric/peer/channel/join.go:138 github.com/hyperledger/fabric/peer/channel.join
/opt/gopath/src/github.com/hyperledger/fabric/peer/channel/join.go:42 github.com/hyperledger/fabric/peer/channel.joinCmd.func1
/opt/gopath/src/github.com/hyperledger/fabric/vendor/github.com/spf13/cobra/command.go:599 github.com/hyperledger/fabric/vendor/github.com/spf13/cobra.(*Command).execute
/opt/gopath/src/github.com/hyperledger/fabric/vendor/github.com/spf13/cobra/command.go:689 github.com/hyperledger/fabric/vendor/github.com/spf13/cobra.(*Command).ExecuteC
/opt/gopath/src/github.com/hyperledger/fabric/vendor/github.com/spf13/cobra/command.go:648 github.com/hyperledger/fabric/vendor/github.com/spf13/cobra.(*Command).Execute
/opt/gopath/src/github.com/hyperledger/fabric/peer/main.go:118 main.main
/opt/go/src/runtime/proc.go:192 runtime.main
/opt/go/src/runtime/asm_amd64.s:2087 runtime.goexit
Caused by: context deadline exceeded
Usage:
  peer channel join [flags]

Flags:
  -b, --blockpath string   Path to file containing genesis block

How to solve this?

Oct 29, 2018 in Blockchain by digger
• 26,670 points
2,072 views
Hi. Which Operating system are you using?
Hi @Karan, I am using Ubuntu 14

@digger. Try disabling the firewall before running your command:

$ sudo ufw disable

3 answers to this question.

0 votes

The default port is 7051 but you have set it to 8051.

export CORE_PEER_ADDRESS=peer1.org1.example.com:8051

Try changing it to 7051 and see if it works.

export CORE_PEER_ADDRESS=peer1.org1.example.com:7051
answered Oct 29, 2018 by Omkar
• 69,030 points
0 votes

Turn down the network, Generate the necessary files and then turn the network back on. 

./byfn down
./byfn generate
./byfn up
answered May 8, 2019 by Hari
0 votes

Open the hosts file:

$ gedit /etc/hosts

And add the IP address of the system than contains the channel. Save and exit the file and then run your command. It worked for me.

answered May 8, 2019 by John
Hello John,

I'm facing the same issue, can you be more precise on what we have to write inside that file ? In my case my channel in created on the cli container, what should I write in this case ?

Thank you,

Elias

Find the IP address of the system that contains the cli container using the below command:

$ ifconfig

Then open the /etc/hosts file:

$ gedit /etc/hosts

and then add the IP address in that file.

Related Questions In Blockchain

0 votes
1 answer

How to join a peer to a channel in Hyperledger Fabric?

When you run the command: peer channel create ...READ MORE

answered Jul 31, 2018 in Blockchain by digger
• 26,670 points
865 views
+15 votes
5 answers
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

Invalid Batch or signature in Savtooth

This will solve your problem import org.apache.commons.codec.binary.Hex; Transaction txn ...READ MORE

answered Aug 1, 2018 in Blockchain by digger
• 26,670 points
202 views
+1 vote
1 answer
0 votes
1 answer

Hyperledger Fabric: Cant create channel on peer

Add host entries to your /etc/hosts should resolve your ...READ MORE

answered Oct 26, 2018 in Blockchain by Omkar
• 69,030 points
455 views
+2 votes
3 answers

Hyperledger Fabric: Peer Connection error: Failed obtaining connection: Could not connect to any of the endpoints.

 You can extend your /etc/hosts file and make orderer.example.com domain name ...READ MORE

answered Nov 13, 2018 in Blockchain by Omkar
• 69,030 points
1,923 views