错误链码实例化Hyperledger(带节点)
Error Chaincode Instantiate Hyperledger (with node)
我正在学习如何开发链代码,并且正在尝试修改 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
但是当我尝试实例化链代码时,我收到了这个错误:
Error: could not assemble transaction, err Proposal response was not successful, error code 500, msg invalid number of arguments to lscc: 7
我尝试按照其他一些教程的建议更新 configtx.yaml 以更新 Cappabilities.Application 部分,但没有成功。
我想知道我是否遗漏了一些东西来实例化链码。
提前致谢!
您的错误是由于以下代码中 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 参数。
非常感谢其他评论的帮助。事实上,我更新了 congigtx.yaml 这确实是必需的。我缺少的是我需要 运行 configtxgen 命令以便在再次设置网络时使更新可见。
这样做之后,我就可以使用私有数据集合了。
我正在学习如何开发链代码,并且正在尝试修改 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
但是当我尝试实例化链代码时,我收到了这个错误:
Error: could not assemble transaction, err Proposal response was not successful, error code 500, msg invalid number of arguments to lscc: 7
我尝试按照其他一些教程的建议更新 configtx.yaml 以更新 Cappabilities.Application 部分,但没有成功。
我想知道我是否遗漏了一些东西来实例化链码。
提前致谢!
您的错误是由于以下代码中 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 参数。
非常感谢其他评论的帮助。事实上,我更新了 congigtx.yaml 这确实是必需的。我缺少的是我需要 运行 configtxgen 命令以便在再次设置网络时使更新可见。
这样做之后,我就可以使用私有数据集合了。