我一直在大致关注http://hyperledger-fabric.readthedocs.io/en/latest/build_network.html#troubleshoot来创建我的第一个网络,并执行了涉及安装,异化,查询链代码的步骤。但是,在调用chaincode时出现以下错误。
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的容器。所以我决定使用原始文件,完全忽略了这一步。
答案 0 :(得分:1)
(最终知道如何使用它)实际感谢朋友帮助找到了解决方案。
“对等链码调用”没有标志“ peerAddresses”。 Hyperledger架构教程文档中提供的代码可能已过时或不正确。
这可以在参考文档中找到: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"]}'
答案 1 :(得分:0)
通过改变"和"来改变链码实例化,解决了问题。到"或"。 由于我跳过了环境变量步骤,因此默认为peer0.org1(即org1MSP)。没有为org2MSP设置任何内容。因此,它首先无权授予权限。
$('.datepicker').datepicker();
$.fn.datepicker.defaults.format = 'dd/mm/yyyy';
$.fn.datepicker.defaults.startDate = "0";
$.fn.datepicker.defaults.language = "es";
$.fn.datepicker.defaults.autoclose = true;
$.fn.datepicker.defaults.todayHighlight = true;
$.fn.datepicker.defaults.todayBtn = true;
$.fn.datepicker.defaults.weekStart = 1;