0

I am trying to access the following Api via hyperLedger Fabric chaincode :http://api.open-notify.org/astros.json.However I come up with following error

panic: Get http://api.open-notify.org/astros.json: proxyconnect tcp: dial tcp: i/o timeout

I have tried multiple ways to resolve proxy but it always times out.

Can anybody suggest a fix ?

Thanks in advance.

Sarageorge
  • 129
  • 9

1 Answers1

0

Generally you are not supposed to call external APIs from within hyperledger as doing so can lead to conflicts between the peer nodes. Assuming every peer needs to perform the request the number of requests exponential increase with the number of nodes involved in your system.

There is how the documentation says external requests should be performed.That being said the documentation on external requests has not been updated for current hyperledger version as far as I can tell. https://hyperledger.github.io/composer/v0.19/integrating/call-out

Consensus considerations when accessing external APIs are noted over here https://hyperledger.github.io/composer/v0.19/integrating/call-out#consensus-considerations

The workaround I have been using is to set up a second docker container which is not running hyperledger to perform api requests on port 3001, collate the results, then send them over to Hyperledger set up with the REST service on port 3000.

Julian Wise
  • 380
  • 1
  • 3
  • 16