API problem for separating Orderers in separate Organizations - hyperledger-fabric

I have a hyperledger-fabric project with 3 separate hosts and each host includes 1 Organization. Each Organization has 2 Peers, 2 Orderers, 1 CA Service(I don't have a separate CA for orderers and all the nodes in each organization get their certificates from the same CA service).
All the channels and chaincodes and everything else work correctly. I use an API service to communicate with the network, and I can add users with API correctly to the network. But the problem is:
When I'm trying to invoke the chaincode with API, e.g: adding an asset or querying the ledger (submitting and evaluating transactions), the asset will be added after a while(about 20 seconds), but I get the following error:
E1116 07:17:03.978929679 1 ssl_transport_security.cc:1245] Handshake failed with fatal error SSL_ERROR_SSL: error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed.
2021-11-16T07:17:06.893Z - error: [ServiceEndpoint]: Error: Failed to connect before the deadline on Committer- name: orderer0.org2.example.com:9050, url:grpcs://orderer0.org2.example.com:9050
2021-11-16T07:17:06.894Z - error: [ServiceEndpoint]: waitForReady - Failed to connect to remote gRPC server orderer0.org2.example.com:9050 url:grpcs://orderer0.org2.example.com:9050 timeout:3000
2021-11-16T07:17:06.894Z - error: [DiscoveryService]: _buildOrderer[mychannel] - Unable to connect to the discovered orderer orderer0.org2.example.com:9050 due to Error: Failed to connect before the deadline on Committer- name: orderer0.org2.example.com:9050, url:grpcs://orderer0.org2.example.com:9050
E1116 07:17:06.909267625 1 ssl_transport_security.cc:1245] Handshake failed with fatal error SSL_ERROR_SSL: error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed.
2021-11-16T07:17:09.897Z - error: [ServiceEndpoint]: Error: Failed to connect before the deadline on Committer- name: orderer1.org2.example.com:10050, url:grpcs://orderer1.org2.example.com:10050
2021-11-16T07:17:09.898Z - error: [ServiceEndpoint]: waitForReady - Failed to connect to remote gRPC server orderer1.org2.example.com:10050 url:grpcs://orderer1.org2.example.com:10050 timeout:3000
2021-11-16T07:17:09.898Z - error: [DiscoveryService]: _buildOrderer[mychannel] - Unable to connect to the discovered orderer orderer1.org2.example.com:10050 due to Error: Failed to connect before the deadline on Committer- name: orderer1.org2.example.com:10050, url:grpcs://orderer1.org2.example.com:10050
E1116 07:17:09.928123699 1 ssl_transport_security.cc:1245] Handshake failed with fatal error SSL_ERROR_SSL: error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed.
2021-11-16T07:17:12.901Z - error: [ServiceEndpoint]: Error: Failed to connect before the deadline on Committer- name: orderer0.org3.example.com:11050, url:grpcs://orderer0.org3.example.com:11050
2021-11-16T07:17:12.902Z - error: [ServiceEndpoint]: waitForReady - Failed to connect to remote gRPC server orderer0.org3.example.com:11050 url:grpcs://orderer0.org3.example.com:11050 timeout:3000
2021-11-16T07:17:12.902Z - error: [DiscoveryService]: _buildOrderer[mychannel] - Unable to connect to the discovered orderer orderer0.org3.example.com:11050 due to Error: Failed to connect before the deadline on Committer- name: orderer0.org3.example.com:11050, url:grpcs://orderer0.org3.example.com:11050
E1116 07:17:12.952061671 1 ssl_transport_security.cc:1245] Handshake failed with fatal error SSL_ERROR_SSL: error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed.
2021-11-16T07:17:15.948Z - error: [ServiceEndpoint]: Error: Failed to connect before the deadline on Committer- name: orderer0.org3.example.com:11050, url:grpcs://orderer0.org3.example.com:11050
2021-11-16T07:17:15.949Z - error: [ServiceEndpoint]: waitForReady - Failed to connect to remote gRPC server orderer0.org3.example.com:11050 url:grpcs://orderer0.org3.example.com:11050 timeout:3000
2021-11-16T07:17:15.949Z - error: [DiscoveryService]: _buildOrderer[mychannel] - Unable to connect to the discovered orderer orderer0.org3.example.com:11050 due to Error: Failed to connect before the deadline on Committer- name: orderer0.org3.example.com:11050, url:grpcs://orderer0.org3.example.com:11050
E1116 07:17:16.120702832 1 ssl_transport_security.cc:1245] Handshake failed with fatal error SSL_ERROR_SSL: error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed.
Thanks in advance for your help

Related

Fabric Api disconnects (grpcs)from peers after sometime

I have a nodejs REST api using fabric API. everything is working fine but after a given time (2days) we got an endless number of these errors. And the story repeats, BUT ONCE THE API IS RESTARTED THE ERROR DISAPEARS.
[ServiceEndpoint]: ServiceEndpoint grpcs://192.168.1.3:7051 reset connection failed :: Error: Failed to connect before the deadline on Discoverer- name: peer0.org1.example.com, url:grpcs://192.168.1.3:7051, connected:false, connectAttempted:true
[DiscoveryService]: send[mychannel] - no discovery results
[ServiceEndpoint]: Error: Failed to connect before the deadline on Endorser- name: peer0.org1.example.com, url:grpcs://192.168.1.3:7051, connected:false, connectAttempted:true
[ServiceEndpoint]: waitForReady - Failed to connect to remote gRPC server peer0.org1.example.com url:grpcs://192.168.1.3:7051 timeout:3000
[ServiceEndpoint]: Error: Failed to connect before the deadline on Endorser- name: peer0.org1.example.com, url:grpcs://192.168.1.3:7051, connected:false, connectAttempted:true
[ServiceEndpoint]: waitForReady - Failed to connect to remote gRPC server peer0.org1.example.com url:grpcs://192.168.1.3:7051 timeout:3000
[ServiceEndpoint]: Error: Failed to connect before the deadline on Discoverer- name: peer0.org1.example.com, url:grpcs://192.168.1.3:7051, connected:false, connectAttempted:true
[ServiceEndpoint]: waitForReady - Failed to connect to remote gRPC server peer0.org1.example.com url:grpcs://192.168.1.3:7051 timeout:3000
[DiscoveryService]: send[mychannel] - no discovery results
192.168.1.3 is the ip of the remote peer the api is connected 2.
The api and HF peer are running in a separate VM and they are always connected. And using HF 2.2
Any leads?
I have inspected the peer and it seems to be working nomal

Failed to enroll admin user "admin": Error: Calling enroll endpoint failed with error

I am trying to run the fabcar-UI code provided here using 2 org (1 peer each) network using docker swarm network on AWS. 2 Orderer services are running on peer0.org1. I am able to run peer chaincode invoke command successfully from the terminal. After integrating the fabcar-ui I am running into below error when registering the admin. Can someone please guide me?
ubuntu#ip-172-31-11-233:~/hlf-docker-swarm/fabcar-ui$ node app
fabcar-ui listening on port 3000
Wallet path: /home/ubuntu/hlf-docker-swarm/fabcar-ui/wallet
2022-03-12T05:49:09.886Z - error: [FabricCAClientService.js]: Failed to enroll admin, error:%o message=Calling enroll endpoint failed with error [Error: getaddrinfo ENOTFOUND ca.org1.example.com ca.org1.example.com:7054], stack=Error: Calling enroll endpoint failed with error [Error: getaddrinfo ENOTFOUND ca.org1.example.com ca.org1.example.com:7054]
at ClientRequest.request.on (/home/ubuntu/hlf-docker-swarm/fabcar-ui/node_modules/fabric-ca-client/lib/FabricCAClient.js:327:19)
at ClientRequest.emit (events.js:198:13)
at TLSSocket.socketErrorListener (_http_client.js:401:9)
at TLSSocket.emit (events.js:198:13)
at emitErrorNT (internal/streams/destroy.js:91:8)
at emitErrorAndCloseNT (internal/streams/destroy.js:59:3)
at process._tickCallback (internal/process/next_tick.js:63:19), errno=ENOTFOUND, code=ENOTFOUND, syscall=getaddrinfo, hostname=ca.org1.example.com, host=ca.org1.example.com, port=7054
Failed to enroll admin user "admin": Error: Calling enroll endpoint failed with error [Error: getaddrinfo ENOTFOUND ca.org1.example.com ca.org1.example.com:7054]
Failed to enroll admin user "admin": Error: Calling enroll endpoint failed with error [Error: getaddrinfo ENOTFOUND ca.org1.example.com ca.org1.example.com:7054]
Since this is related to fabric CA, I am providing the docker-compose file for CA Org1.
services:
ca_org1:
deploy:
placement:
constraints:
- node.labels.name == manager
image: hyperledger/fabric-ca:latest
environment:
- FABRIC_CA_HOME=/etc/hyperledger/fabric-ca-server
- FABRIC_CA_SERVER_CA_NAME=ca-org1
- FABRIC_CA_SERVER_TLS_ENABLED=true
- FABRIC_CA_SERVER_PORT=7054
ports:
- "7054:7054"
command: sh -c 'fabric-ca-server start -b admin:adminpw -d'
volumes:
- /home/ubuntu/hlf-docker-swarm/test-network/organizations/fabric-ca/org1:/etc/hyperledger/fabric-ca-server
container_name: ca_org1
networks:
test:
aliases:
- ca.org1.example.com

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.

error: [Orderer.js]: sendBroadcast - on error: "Error: 14 UNAVAILABLE:.. Hyperledger Caliper

I have setup hyperledger fabric version 1.4.2 with 1 org 2 peers 1 orderer setup all are running in 3 different VMs natively. Now I am trying to implement caliper v0.3.0 in this fabric setup. Peers and Orderer are already up and peers are joined in the channel. I have modified the network config file and benchconfig file in caliper according to my network. So I directly run the caliper using the flag "caliper-flow-only-install". While executing this, I am facing issues like
error: [Orderer.js]: sendBroadcast - on error: "Error: 14 UNAVAILABLE: failed to connect to all addresses\n at Object.exports.createStatusError (/home/xx/caliper-benchmarks/node_modules/grpc/src/common.js:91:15)\n at ClientDuplexStream._emitStatusIfDone (/home/xx/caliper-benchmarks/node_modules/grpc/src/client.js:233:26)\n at ClientDuplexStream._receiveStatus (/home/xx/caliper-benchmarks/node_modules/grpc/src/client.js:211:8)\n at Object.onReceiveStatus (/home/xx/caliper-benchmarks/node_modules/grpc/src/client_interceptors.js:1306:15)\n at InterceptingListener._callNext (/home/xx/caliper-benchmarks/node_modules/grpc/src/client_interceptors.js:568:42)\n at InterceptingListener.onReceiveStatus (/home/xx/caliper-benchmarks/node_modules/grpc/src/client_interceptors.js:618:8)\n at /home/xx/caliper-benchmarks/node_modules/grpc/src/client_interceptors.js:1123:18"
2020.04.29-12:22:12.094 error [caliper] [caliper-engine] Error while performing "install" step: Error: Orderer error for instantiating W1CC#v0 in composerchannelrest: SERVICE_UNAVAILABLE
It seems the issue is with using incorrect docker container port mapping.
Use the host port rather docker container port.
You can even cross check connection to container with network utility.
For instance, nc -vz [host] [port]
Hope this resolves SERVICE_UNAVAILABLE error.

Hyperledger Fabric fabcar client can't connect to the peer node

Two months ago, I've written an application using Hyperledger Fabric. Now, I try to run it again, but I get error and I can't resolve it. So I go the the Hyperledger Fabric doc again(https://hyperledger-fabric.readthedocs.io/en/latest/install.html), and reinstall everything(including cmd tools, docker images and even my MacOS).
I've tried two versions(v2.0.1 and v2.1.0), and my node version is v12. What I do is:
download the fabric-samples repo using cmd (curl -sSL https://xxx/2ysbOFE | bash -s -- 2.1.0 1.4.6 0.4.18)
and go the fabcar/ directory and run ./startFabric.sh
and go the fabrcar/javascript/ directory and run npm install && node enrollAdmin.js && node registerUser.js && node invoke.js
However, I meet this error again:
2020-05-07T06:39:28.354Z - error: [ServiceEndpoint]: Error: Failed to connect before the deadline on Endorser- name: peer0.org1.example.com, url:grpcs://localhost:7051
2020-05-07T06:39:28.356Z - error: [ServiceEndpoint]: waitForReady - Failed to connect to remote gRPC server peer0.org1.example.com url:grpcs://localhost:7051 timeout:3000
2020-05-07T06:39:28.360Z - error: [NetworkConfig]: buildPeer - Unable to connect to the endorser peer0.org1.example.com due to Error: Failed to connect before the deadline on Endorser- name: peer0.org1.example.com, url:grpcs://localhost:7051
at checkState (/Users/xiebei/code/fabric-samples/fabcar/javascript/node_modules/grpc/src/client.js:883:16) {
connectFailed: true
}
2020-05-07T06:39:31.363Z - error: [ServiceEndpoint]: Error: Failed to connect before the deadline on Discoverer- name: peer0.org1.example.com, url:grpcs://localhost:7051
2020-05-07T06:39:31.363Z - error: [ServiceEndpoint]: waitForReady - Failed to connect to remote gRPC server peer0.org1.example.com url:grpcs://localhost:7051 timeout:3000
Failed to evaluate transaction: Error: Failed to connect before the deadline on Discoverer- name: peer0.org1.example.com, url:grpcs://localhost:7051
I use docker ps:
enter image description here
Seems everything goes ok. And the orderer node docker logs is :
2020-05-07 06:12:07.554 UTC [orderer.consensus.etcdraft] propose -> INFO 059 Created block [5], there are 0 blocks in flight channel=mychannel node=1
2020-05-07 06:12:07.558 UTC [orderer.consensus.etcdraft] writeBlock -> INFO 05a Writing block [5] (Raft index: 7) to ledger channel=mychannel node=1
2020-05-07 06:12:07.788 UTC [orderer.common.broadcast] Handle -> WARN 05b Error reading from 172.18.0.1:36216: rpc error: code = Canceled desc = context canceled
2020-05-07 06:12:07.789 UTC [comm.grpc.server] 1 -> INFO 05c streaming call completed grpc.service=orderer.AtomicBroadcast grpc.method=Broadcast grpc.peer_address=172.18.0.1:36216 error="rpc error: code = Canceled desc = context canceled" grpc.code=Canceled grpc.call_duration=2.257323471s
2020-05-07 06:12:14.117 UTC [orderer.common.broadcast] Handle -> WARN 05d Error reading from 172.18.0.1:36256: rpc error: code = Canceled desc = context canceled
2020-05-07 06:12:14.117 UTC [comm.grpc.server] 1 -> INFO 05e streaming call completed grpc.service=orderer.AtomicBroadcast grpc.method=Broadcast grpc.peer_address=172.18.0.1:36256 error="rpc error: code = Canceled desc = context canceled" grpc.code=Canceled grpc.call_duration=61.170986ms
2020-05-07 06:12:16.114 UTC [orderer.consensus.etcdraft] propose -> INFO 05f Created block [6], there are 0 blocks in flight channel=mychannel node=1
2020-05-07 06:12:16.117 UTC [orderer.consensus.etcdraft] writeBlock -> INFO 060 Writing block [6] (Raft index: 8) to ledger channel=mychannel node=1
It seems like that the orderer can't connect to something(maybe the peer node). So I think there's some possible problems:
Maybe the peer node's network is failed, we can't connect to it.
Maybe the NodeJS Fabric SDK is buggy, it's GRPC client can't works well.
Maybe my computer goes wrong.
Could you please help me? Thanks!!!

Resources