I am struggling with Node.js Hyperledger Fabric client library on this particular error:
I've got my blockchain network (Hyperledger Fabric 1.4) deployed on one server with IP and all needed ports visible from another server. All the examples / samples available in documentation are referring to network via localhost.
How it's possible to start the client application and point it to the IP address of the network instead of localhost or peer container names (e.g. peer0.org1.example.com)?
Does each client application have to enroll admin and user into its local persistence store or it can be done only once by the network itself (and probably mounted from network to application in later stage)? We talk here about Dockerized network on one host and client application (Dockerized as well) on another.
And also, how to start the application and connect to e.g. ordered via GRCPS if it requires the .pem certificate file being present when calling createPeer
method?
I will be very thankful for any help provided here.
EDIT, 12.03.2020:
I am using the basic-network sample with changes to my network to create 3 organizations with 3 peers each and 5 Raft orderers. I've copied the connection-org1.json file, changed localhost to my external server IP and I got the following error:
2020-03-12T12:45:31.503Z - error: [SingleQueryHandler]: evaluate: message=No peers available to query. Errors: ["14 UNAVAILABLE: DNS resolution failed","14 UNAVAILABLE: DNS resolution failed","14 UNAVAILABLE: DNS resolution failed"], stack=FabricError: No peers available to query. Errors: ["14 UNAVAILABLE: DNS resolution failed","14 UNAVAILABLE: DNS resolution failed","14 UNAVAILABLE: DNS resolution failed"]
at SingleQueryHandler.evaluate ((...)/network_files/javascript/node_modules/fabric-network/lib/impl/query/singlequeryhandler.js:44:17), name=FabricError
Failed to evaluate transaction: FabricError: No peers available to query. Errors: ["14 UNAVAILABLE: DNS resolution failed","14 UNAVAILABLE: DNS resolution failed","14 UNAVAILABLE: DNS resolution failed"]
I was able to successfully enroll and register admin and user on my local machine using the network hosted on external IP. But I cannot query the chaincode with the connection profile.
Here's my connection profile:
{
"name": "first-network-org1",
"version": "1.0.0",
"client": {
"organization": "Org1",
"connection": {
"timeout": {
"peer": {
"endorser": "300"
}
}
}
},
"organizations": {
"Org1": {
"mspid": "Org1MSP",
"peers": [
"peer0.org1.example.com",
"peer1.org1.example.com",
"peer2.org1.example.com"
],
"certificateAuthorities": [
"ca.org1.example.com"
]
}
},
"peers": {
"peer0.org1.example.com": {
"url": "grpcs://<IP>:7051",
"tlsCACerts": {
"pem": "<CERT>"
},
"grpcOptions": {
"ssl-target-name-override": "peer0.org1.example.com",
"hostnameOverride": "peer0.org1.example.com"
},
"endorsingPeer": true,
"chaincodeQuery": true,
"ledgerQuery": true,
"eventSource": true
},
"peer1.org1.example.com": {
"url": "grpcs://<IP>:8051",
"tlsCACerts": {
"pem": "<CERT>"
},
"grpcOptions": {
"ssl-target-name-override": "peer1.org1.example.com",
"hostnameOverride": "peer1.org1.example.com"
}
},
"peer2.org1.example.com": {
"url": "grpcs://<IP>:9051",
"tlsCACerts": {
"pem": "<CERT>"
},
"grpcOptions": {
"ssl-target-name-override": "peer2.org1.example.com",
"hostnameOverride": "peer2.org1.example.com"
}
}
},
"certificateAuthorities": {
"ca.org1.example.com": {
"url": "https://<IP>:7054",
"caName": "ca-org1",
"tlsCACerts": {
"pem": "<CERT>"
},
"httpOptions": {
"verify": false
}
}
}
}