首页 文章

错误Chaincode实例化Hyperledger(带节点)

提问于
浏览
0

我正在学习如何开发链代码,我正在尝试修改fabcar教程中的链代码以使用集合 . 我正在尝试使用链代码的节点版本 .

我设置了一个 config.json 文件来保存集合配置 . 我做了一个简单的(基本上是大理石教程的副本):

[
  {
       "name": "car",
       "policy": "OR('Org1MSP.member', 'Org2MSP.member')",
       "requiredPeerCount": 0,
       "maxPeerCount": 3,
       "blockToLive":1000000
  },
  {
       "name": "privateCar",
       "policy": "OR('Org1MSP.member')",
       "requiredPeerCount": 0,
       "maxPeerCount": 3,
       "blockToLive":1000000
  }
]

我更新了文件 startFabric.sh 以传递collections-config标志,如:

docker exec -e "CORE_PEER_LOCALMSPID=Org1MSP" -e "CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp" cli peer chaincode instantiate -o orderer.example.com:7050 -C mychannel - -n fabhealth -l "$LANGUAGE"  -v 1.0  -c '{"Args":[""]}' -P "OR ('Org1MSP.member','Org2MSP.member')" --collections-config $CC_SRC_PATH/config_old.json

但是当我尝试实例化链代码时,我收到了这个错误:

错误:无法汇编事务,错误提案响应未成功,错误代码500,msg无效的参数数量为lscc:7

我尝试像其他一些教程建议的那样更新 configtx.yaml 来更新Cappabilities.Application部分,但它不起作用 .

我想知道我是否遗漏了一些东西以便实例化链码 .

提前致谢!

2 回答

  • 0

    您的错误是由于来自以下代码的lscc的无效参数

    // the maximum number of arguments depends on the capability of the channel
    if (!ac.Capabilities().PrivateChannelData() && len(args) > 6) ||
        (ac.Capabilities().PrivateChannelData() && len(args) > 7) {
        return shim.Error(InvalidArgsLenErr(len(args)).Error())
    }
    

    尝试更改 configtx.yaml 中的功能,而不必传递 --collections-config 参数 .

  • 0

    我非常感谢其他评论的hellp . 事实上,我更新了congigtx.yaml,这确实是必需的 . 我缺少的是我需要运行 configtxgen 命令才能在再次设置网络时显示更新 .

    在这之后,我能够使用私有数据集合 .

相关问题