douhuantui6259 2018-04-25 11:27 采纳率: 100%
浏览 229

在HyperLedger Fabric中访问外部Api

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.

  • 写回答

1条回答 默认 最新

  • dpw63348 2018-10-19 02:13
    关注

    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.

    评论

报告相同问题?

悬赏问题

  • ¥100 求数学坐标画圆以及直线的算法
  • ¥100 c语言,请帮蒟蒻写一个题的范例作参考
  • ¥15 名为“Product”的列已属于此 DataTable
  • ¥15 安卓adb backup备份应用数据失败
  • ¥15 eclipse运行项目时遇到的问题
  • ¥15 关于#c##的问题:最近需要用CAT工具Trados进行一些开发
  • ¥15 南大pa1 小游戏没有界面,并且报了如下错误,尝试过换显卡驱动,但是好像不行
  • ¥15 自己瞎改改,结果现在又运行不了了
  • ¥15 链式存储应该如何解决
  • ¥15 没有证书,nginx怎么反向代理到只能接受https的公网网站