5

I am trying to install hyperledger and run chain code. I followed all the steps as directed here. But getting error

error: [client-utils.js]: sendPeersProposal - Promise is rejected: Error: Connect Failed

while running the query.js. enter image description hereI have following active docker runningenter image description here Before running the node query.js, when i am running npm install its giving following warning : npm WARN fabcar@1.0.0 No repository field. Is this the problem. Can any one please help me out about where it is going wrong.

Subhankar
  • 692
  • 7
  • 25

4 Answers4

2

I have met the same error during run sample, it failed to connect. I fixed it with following steps:

  1. get machine IP address with: ifconfig
  2. replace localhosts in query.js with IP in #1

Example:

@@ -12,7 +12,7 @@ var options = {
     user_id: 'PeerAdmin',
     channel_id: 'mychannel',
     chaincode_id: 'fabcar',
-    network_url: 'grpc://localhost:7051',
+    network_url: 'grpc://****:7051',
};
J-Alex
  • 6,881
  • 10
  • 46
  • 64
Angela
  • 21
  • 1
2

Addition to Angela's answer:

To anyone having this issue and using Docker Toolbox, do docker-machine ls and copy the IP adress at the URL column of your ACTIVE machine and paste the IP adress to every localhost in both query.js and invoke.js files.

thefrogking
  • 31
  • 1
  • 7
  • Wait for upto 90 seconds, it will work. For me after 90 seconds i got chaincode installation failed. I started again it worked. [Screenshot] (https://imgur.com/a/DbO708o) – abdul rashid Jun 05 '18 at 07:36
0

I have seen that error occur when datasources.json specifies that the network addresses start with grpcs://, but the network is not set up to use TLS. Try changing them to start with grpc://.

Styx
  • 9,863
  • 8
  • 43
  • 53
mamta
  • 1
  • 2
0

Do docker-machine ls

Output:

$ docker-machine ls NAME ACTIVE DRIVER STATE URL SWARM DOC default virtualbox Running tcp://192.168.99.100:2376 v17

  • copy the ip address mentioned , like : 192.168.99.100
  • go to \fabric-samples\fabcar\query.js
  • replace the localhost with the IP address
GeralexGR
  • 2,973
  • 6
  • 24
  • 33
asif
  • 16