调用chaincode时出错:签名集不满足策略

问题描述 投票:0回答:1

我在Hyperledger Fabric 1.4中有一个小网络,它与示例中的基本网络非常相似。它有:

一个orderer组织与orderer peer One Hospital组织有两个同行。医院同行所在的单一渠道。

我试着编写一个非常简单的演示智能合约/链代码并调用它。 (智能合约叫做bananascc)

从与peer0.hospital1.health.com对等体关联的docker container cli / bin / bash运行,我成功安装并实例化:

peer chaincode install -n bananascc -v 1.0 -l node -p /opt/gopath/src/github.com/chaincode/chaincode_bananas/node

peer chaincode instantiate -o orderer.health.com:7050 --tls --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/health.com/orderers/orderer.health.com/msp/tlscacerts/tlsca.health.com-cert.pem -C hospital1channel -n bananascc -l node -v 1.0 -c '{"Args":["init","edo","100"]}' -P "OR ('Hospital1MSP.admin', 'Hospital1MSP.peer' )"

随着政策-P "OR ('Hospital1MSP.admin', 'Hospital1MSP.peer' )"

但是当我尝试调用链代码时,事务成功发送但操作没有执行,因为我得到了一个

peer0.hospital1.health.com    | 2019-03-06 10:36:44.525 UTC [vscc] Validate -> ERRO 07e VSCC error: stateBasedValidator.Validate failed, err validation of endorsement policy for chaincode bananascc in tx 6:0 failed: signature set did not satisfy policy

peer0.hospital1.health.com    | 2019-03-06 10:36:44.525 UTC [committer.txvalidator] validateTx -> ERRO 07f VSCCValidateTx for transaction txId = d6726e0b2daf11d0e3ef24e86fa0e7a5530f2d98dcc4ad1f0d266ca642be1ee3 returned error: validation of endorsement policy for chaincode bananascc in tx 6:0 failed: signature set did not satisfy policy

我认为必须根据有效的签名集来评估事务,但我无法理解我可以在哪里指定它,或者根据VSCC它应该是错误的原因。

如果有人能帮助我搞清楚,我会很高兴。我已经广泛地寻找了一个我没有找到的答案。

如果您需要有关该问题的其他信息,请与我们联系。

非常感谢你。

hyperledger-fabric hyperledger blockchain hyperledger-chaincode
1个回答
0
投票

问题可能是由实例化策略的顺序引起的。

你能简单地将声明交换到:

peer chaincode instantiate -o orderer.health.com:7050 --tls --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/health.com/orderers/orderer.health.com/msp/tlscacerts/tlsca.health.com-cert.pem -C hospital1channel -n bananascc -l node -v 1.0 -c '{"Args":["init","edo","100"]}' -P "OR ('Hospital1MSP.peer','Hospital1MSP.admin')"

为了避免这种缺陷,应在策略标识规范中从最大特权到最小特权指定标识,并且签名应从签名集中的最小特权到最特权排序。

在这里阅读:https://hyperledger-fabric.readthedocs.io/en/release-1.4/policies.html


0
投票

如果只有一个组织,那么政策的需要是没有意义的(仅在组织之间使用),所以我删除了它并且它有效!

我的代码行:

peer chaincode instantiate -o orderer.orgX.com:7050 --tls $CORE_PEER_TLS_ENABLED --cafile $ORDERER_CA -C $CHANNEL_NAME -n mycc -l ${LANGUAGE} -v 1.0 -c '{"Args":["init","a","100","b","200"]}'  >&log.txt
© www.soinside.com 2019 - 2024. All rights reserved.