Failed to establish connection between 1 Organisation peer and channel - hyperledger-fabric

I have created a Solo config Fabric network with 2 Organisation peers connected to single channel on launching the network My 1st Organisation peer is sucessfully getting connected to channel but for 2nd organisation peer it says:
Error: error getting endorser client for channel: endorser client failed to connect to org2-peer1.org2.com:8051: failed to create new connection: connection error: desc = "transport: error while dialing: dial tcp 127.0.0.1:8051: connect: connection refused"

Make sure all docker containers are up and running.
docker ps

Related

not able to invoke/query chaincode usin fabric Node SDK

I have created a sample HLF network with 3 organizations. I have taken an orderer and a peer from each organization ( total 3 orderers, 3 peers, 3 fabric-CA, 3 CouchDB instances).
I have successfully created the certificates, system channel, channel configuration, application channel and also successfully deployed the chaincode on each peer.
I am able to invoke/query any chaincode using peer binary in docker cli but not able to invoke/query the same chaincode through fabric Node SDK.
I have created the connection profile as per the template provided in the test network and also able to register any user for a specific organization. But whenever I am trying to query any chaincode function I am getting the below error:
[ServiceEndpoint]: Error: Failed to connect before the deadline on
Committer- name: orderer.example.com:7050, url:grpcs://localhost:7050,
connected:false, connectAttempted:true [ServiceEndpoint]: waitForReady
Failed to connect to remote gRPC server orderer.example.com:7050 url:grpcs://localhost:7050 timeout:3000
When I check the orderer logs I found this error:
ServerHandshake -> ERRO 087 Server TLS handshake failed in 2.085859ms
with error EOF server=Orderer remoteaddress=172.23.0.1:45678
**Why I am getting this error?
I am trying to just query so why it's connecting to the orderer?
If there is any TLS issue then why I am able to query it through peer binary?**
This link might help Hyperledger Fabric CA releasing wrong certificates (wrong issuer) to Node SDK when TLS enabled
If you are not running as a test network on your local machine, then you will need to specify the connection option of discovery.asLocalhost as false

orderer and peer container are exited after a few seconds run ./network.sh up and then i can't create channel

I followed the Official Fabric Test Network tutorial "Using the Fabric Test Network ", but reported some errors when I run ./network.sh createChannel. Log and errors like this:
Error: failed to create deliver client for orderer: orderer client
failed to connect to localhost:7050: failed to create new connection:
connection error: desc = "transport: error while dialing: dial tcp
127.0.0.1:7050: connect: connection refused"
Orderer and peer container are exited after a few seconds after i launch the network.sh and then i cant't create channel. I don't understand why.

Hyperledger Fabric, javascript fabcar chaincode error. Transport: error while dialing: dial tcp 127.0.0.1:7051: connect: connection refused

I am having the same problem with Hyperledger fabric 2.1.1, but I am able to run test network with default options, but when I try to run Fabcar javascript chaincode I get an error:
Error: error getting endorser client for channel: endorser client failed to connect to localhost:7051: failed to create new connection: connection error: desc = "transport: error while dialing: dial tcp 127.0.0.1:7051: connect: connection refused"
I have tried everything mentioned in thread Error deploying Fabric test-network fabcar chaincode, removed docker images, ran prune, removed organizations data and fired ./network.sh up createChannel -ca -c mychannel -s couchdb -i 2.1.1, but the error is still there. Also, my RAM is 16Gb, so the problem is not there. Any other suggestion, please ?
This situation is happened because you called a gRPC to 127.0.0.1:7051 server but your call failed to hit the server. This situation may happen for many reasons, but for most of the cases the situation is happened due to server down(server exit or down due to misconfiguration) or for wrong certificate or your call failed to hit the server due to misconfiguration.
Please check the following docker container and ensure that is running properly.

Endorsement fails when node.js fabric-client application is run on a separate node

I'm running the fabcar example from fabric samples on a node. My fabric network is first-network (BYFN) run inside docker containers and I would like to invoke chaincode using a node.js fabric-client application on a separate node (Raspberry Pi).
In connection-org1.json file, I have replaced the localhost domain names (in the peer urls) with my own domain name (mydomain.com) where the fabric network is running.
I execute invoke.js on Raspberry Pi with the following modified gateway settings:
await gateway.connect(ccpPath, { wallet, identity: 'user1', discovery: { enabled: true, asLocalhost: false } });
This gives me an error message:
2019-07-04T07:15:30.124Z - error: [Remote.js]: Error: Failed to connect before the deadline URL:grpcs://peer0.org1.example.com:7051
2019-07-04T07:15:30.132Z - warn: [DiscoveryEndorsementHandler]: _build_endorse_group_member >> G0:0 - endorsement failed - Error: Failed to connect before the deadline URL:grpcs://peer0.org1.example.com:7051
2019-07-04T07:15:30.134Z - error: [Remote.js]: Error: Failed to connect before the deadline URL:grpcs://peer0.org2.example.com:9051
2019-07-04T07:15:30.135Z - warn: [DiscoveryEndorsementHandler]: _build_endorse_group_member >> G1:1 - endorsement failed - Error: Failed to connect before the deadline URL:grpcs://peer0.org2.example.com:9051
Failed to submit transaction: Error: Endorsement has failed
I see that the domain names of the endorserers are the ones defined in the docker composer files, not the domain (mydomain.com) where my fabric network is running.
How should I configure the fabric network or the node.js fabric-client application so that I can invoke chaincode from my Raspberry Pi node?
I made a workaround where I extended the /etc/hosts file on my Raspberry Pi. I made the endorsing peer domain names peer0.org1.example.com and peer0.org2.example.com to point to the IP address of my host where I run the fabric network (docker).
This fixed the issue and now I'm able to invoke chaincode from the Raspberry Pi host.

GRPC connection timeout for hyperledger fabric when sending proposal to the endorser

It is solved, please see this: Connection timeout when installing chaincode using fabric-sdk-go
Dev ENV: Mac and Docker (3 CAs, 3 Orgs, 4 Peers)
Fabric SDK: fabric-sdk-go
Description: I use the sdk to install the chaincode but it errors out when sending proposal to the endorser. Seems that I cannot send the grpc request to the container. Things are working fine with the http request to the fabric CA containers.
ErrorMessage:
unable to verify if cc is installed on grpcs://peer1-xxxx:7051. Got error: lscc.getinstalledchaincodes failed: SendProposal failed: Transaction processing for endorser [peer1-xxxx:7051]: Endorser Client Status Code: (2) CONNECTION_FAILED. Description: dialing connection timed out [peer1-xxxx:7051]

Resources