Accessing External Api in HyperLedger Fabric

0 votes

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 ?

Nov 16, 2018 in Blockchain by Perry
• 17,100 points
618 views

1 answer to this question.

0 votes

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.

answered Nov 16, 2018 by Christine
• 15,810 points

Related Questions In Blockchain

+1 vote
2 answers

Challenge while setting up Hyperledger Fabric 1.0 in Ubuntu 16.04

The rocksdb error you're seeing wouldn't be ...READ MORE

answered Mar 27, 2018 in Blockchain by ned_crew
• 1,620 points

edited Jun 8 by Sirajul 377 views
+1 vote
1 answer
+15 votes
5 answers
+16 votes
4 answers
0 votes
1 answer
+4 votes
2 answers

How do I create a new block in Hyperledger Fabric?

This link might help you: https://github.com/hyperledger/fabric-sample ...READ MORE

answered Oct 11, 2018 in Blockchain by Sahu
923 views