我正在尝试使用 Fabric SDK 访问本地托管的 Hyperledger Fabric。 我从本地计算机调用事务没有问题。但是,当我尝试从同一网络中的另一台计算机使用 Fabric SDK 运行脚本时,我不断收到错误。
我在 config.json 中指定了我的本地 IP 地址
{
"channel_name": "mychannel",
"smart_contract_name": "smartcontract",
"connection_file": "local_fabric_connection.json",
"appAdmin": "admin",
"appAdminSecret": "adminpw",
"orgMSPID": "Org1MSP",
"caName": "ipaddress:port",
"userName": "user1",
"gatewayDiscovery": { "enabled": true, "asLocalhost": false }
}
我还尝试通过将连接文件中的 localhost 更改为我的 IP 地址来使用我的本地 IP 地址:
"organizations": {
"Org1": {
"mspid": "Org1MSP",
"peers": [
"peer0.org1.example.com"
],
"certificateAuthorities": [
"ca.org1.example.com"
]
}
},
"peers": {
"peer0.org1.example.com": {
"url": "grpc://ipaddress:17051"
}
},
"certificateAuthorities": {
"ca.org1.example.com": {
"url": "http://ipaddress:17054",
"caName": "ca.org1.example.com"
}
}
是否需要更改任何不同的设置才能从不同的计算机访问 Fabric?
我正在使用 VSCode 中的 IBM Blockchain Extension 来开发智能合约。
当我运行脚本“query.js”时,我不断收到此错误:
[Remote.js]: Error: Failed to connect before the deadline URL:grpc://peer0.org1.example.com:17051
最佳答案
我通过从 config.json 中删除 gatewayDiscovery 解决了该问题
关于javascript - 从本地网络访问本地托管的 Hyperledger Fabric,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56379025/