当 node.js Fabric-client 应用程序在单独的节点上运行时,背书失败

2024-01-22

我正在运行fabcar 示例 https://github.com/hyperledger/fabric-samples/tree/release-1.4/fabcar来自节点上的结构样本。我的结构网络是第一网络 https://github.com/hyperledger/fabric-samples/tree/release-1.4/first-network(BYFN)在 docker 容器内运行,我想在单独的节点(Raspberry Pi)上使用 node.js 结构客户端应用程序调用链代码。

In 连接-org1.json https://github.com/hyperledger/fabric-samples/blob/release-1.4/first-network/connection-org1.json文件中,我已将本地主机域名(在对等 URL 中)替换为我自己的结构网络运行所在的域名 (mydomain.com)。

我执行调用.js https://github.com/hyperledger/fabric-samples/blob/release-1.4/fabcar/javascript/invoke.js在 Raspberry Pi 上使用以下修改后的网关设置:

await gateway.connect(ccpPath, { wallet, identity: 'user1', discovery: { enabled: true, asLocalhost: false } });

这给了我一条错误消息:

2019-07-04T07:15:30.124Z - error: [Remote.js]: Error: Failed to connect before the deadline URL:grpcs://peer0.org1.example.com:7051
2019-07-04T07:15:30.132Z - warn: [DiscoveryEndorsementHandler]: _build_endorse_group_member >> G0:0 - endorsement failed - Error: Failed to connect before the deadline URL:grpcs://peer0.org1.example.com:7051
2019-07-04T07:15:30.134Z - error: [Remote.js]: Error: Failed to connect before the deadline URL:grpcs://peer0.org2.example.com:9051
2019-07-04T07:15:30.135Z - warn: [DiscoveryEndorsementHandler]: _build_endorse_group_member >> G1:1 - endorsement failed - Error: Failed to connect before the deadline URL:grpcs://peer0.org2.example.com:9051
Failed to submit transaction: Error: Endorsement has failed

我看到背书者的域名是 docker Composer 文件中定义的域名,而不是我的结构网络运行的域 (mydomain.com)。

我应该如何配置 Fabric 网络或 Node.js Fabric 客户端应用程序,以便可以从 Raspberry Pi 节点调用链代码?


我做了一个解决方法,延长了/etc/hosts我的 Raspberry Pi 上的文件。我制作了背书对等域名peer0.org1.example.com and peer0.org2.example.com指向我运行结构网络(docker)的主机的IP地址。

这解决了问题,现在我可以从 Raspberry Pi 主机调用链代码。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

当 node.js Fabric-client 应用程序在单独的节点上运行时,背书失败 的相关文章

随机推荐