Hyperledger fabric 调用链码时出错;错误:未知标志--peeradresses";Hyperledger结构第一网络教程

Hyperledger fabric 调用链码时出错;错误:未知标志--peeradresses";Hyperledger结构第一网络教程,hyperledger-fabric,hyperledger,hyperledger-composer,Hyperledger Fabric,Hyperledger,Hyperledger Composer,我大致按照以下步骤创建了我的第一个网络,并执行了包括安装、显示和查询链码的步骤。但是,在调用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/fabri

我大致按照以下步骤创建了我的第一个网络,并执行了包括安装、显示和查询链码的步骤。但是,在调用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容器。因此,我决定使用原始文件,完全忽略该步骤。

通过将“and”改为“or”来更改链码实例化,从而解决了该问题。 因为我跳过了环境变量步骤,所以默认值是peer0.org1(即org1MSP)。没有为org2MSP设置任何内容。因此,它首先无法授予权限

peer chaincode instantiate -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 -v 1.0 -c '{"Args":["init","a", "100", "b","200"]}' -P "OR ('Org1MSP.peer','Org2MSP.peer')"
(终于知道如何使用了)多亏了一位朋友,才真正找到了解决方案

“对等链码调用”没有标记“peeradresses”。Hyperledger fabric教程文档中给出的代码可能已过时或不正确

这可以在参考文档中看到:

因此,删除PeeradAddress并编写类似的内容可能会解决此错误

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"]}'

不,这不是问与主要问题相关的问题的正确方式。您需要发布一个更新的解决方案,或者尝试从搜索得到的解决方案中解决问题