hyperledger-fabric - 调用链码时出错“错误:未知标志:--peerAddresses”Hyperledger Fabric first-network 教程
问题描述
我一直在大致按照http://hyperledger-fabric.readthedocs.io/en/latest/build_network.html#troubleshoot创建我的第一个网络,并执行了涉及安装、实例化、查询链码的步骤。但是,在调用链代码时出现以下错误。
root@5a0be253ef6e:/opt/gopath/src/github.com/hyperledger/fabric/peer# peer chaincode invoke -o orderer.example.com:7050 --tls true --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem -C testhimani123456 -n mycc --peerAddresses peer0.org1.example.com:7051 --tlsRootCertFiles /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt --peerAddresses peer0.org2.example.com:7051 --tlsRootCertFiles /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt -c '{"Args":["invoke","a","b","10"]}'
Error: unknown flag: --peerAddresses
Usage:
peer chaincode invoke [flags]
Flags:
-C, --channelID string The channel on which this command should be executed
-c, --ctor string Constructor message for the chaincode in JSON format (default "{}")
-n, --name string Name of the chaincode
Global Flags:
--cafile string Path to file containing PEM-encoded trusted certificate(s) for the ordering endpoint
--certfile string Path to file containing PEM-encoded X509 public key to use for mutual TLS communication with the orderer endpoint
--clientauth Use mutual TLS when communicating with the orderer endpoint
--keyfile string Path to file containing PEM-encoded private key to use for mutual TLS communication with the orderer endpoint
--logging-level string Default logging level and overrides, see core.yaml for full syntax
-o, --orderer string Ordering service endpoint
--ordererTLSHostnameOverride string The hostname override to use when validating the TLS connection to the orderer.
--tls Use TLS when communicating with the orderer endpoint
--transient string Transient map of arguments in JSON encoding
-v, --version Display current version of fabric peer server
我忽略了有关环境变量的部分。我对在哪里包含它感到困惑。我尝试添加docker-compose-base.yaml文件中不存在的字段,但它在运行命令时给了我错误docker exec -it cli bash
,说没有 cli 容器。所以我决定使用原始文件,完全忽略了这一步。
解决方案
(终于知道怎么用了)感谢朋友,终于找到了解决办法。
“对等链代码调用”没有标志“peerAddresses”。Hyperledger Fabric 教程文档中给出的代码可能已过时或不正确。
这可以在参考文档中看到:https ://hyperledger-fabric.readthedocs.io/en/release-1.1/commands/peerchaincode.html
因此,删除 peerAddresses 并编写类似的内容可能会解决该错误。
peer chaincode invoke -o orderer.example.com:7050 --tls --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem -C $CHANNEL_NAME -n mycc -c '{"Args":["invoke","a","b","10"]}'
推荐阅读
- regex - Powershell 正则表达式 多行正则表达式
- flutter - Flutter 小部件使用 generate 生成值
- namespaces - Rancher - 是否可以在新环境中的一个环境中启动/重新创建可用的整个命名空间
- .net-core - dotnet 核心 3.1 的 dotnet aspnet -codegenerator 失败
- c# - WPF UI在while循环期间保持冻结
- email - 导致 DMARC 退回的电子邮件“发件人”字段
- capl - 如何通过 CAPL 从文件(notepad.txt)读取字符串值到数组中的十六进制值
- java - 简单的银行应用程序 - 存款和取款(使用抽象和构造函数)(JAVA)
- php - 如何使用“with”函数仅从数据透视表中获取指定字段
- snowflake-cloud-data-platform - 时间戳应四舍五入为每两天一次 - 汇总错误