【问题标题】:Error when invoking chaincode: signature set did not satisfy policy调用链码时出错:签名集不满足策略
【发布时间】:2019-03-06 10:53:24
【问题描述】:

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

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

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

从与 peer0.hospital1.health.com 对等点关联的 docker 容器 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 应该是错误的。

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

如果您需要有关此问题的其他信息,请告诉我。

非常感谢。

【问题讨论】:

  • 我还尝试了不同的策略,例如“AND/OR (.peer, .admin)”、“AND (.admin)”、“AND (.peer, .peer)”、“AND (.同行)”,没有一个工作。但我确实成功地使用策略“AND (.member)”和“OR (.member)”运行了所有内容我是否遗漏了有关指定成员、同行、管理员的内容?
  • 还有 AND (.member, .member) 失败

标签: hyperledger-fabric hyperledger blockchain hyperledger-chaincode


【解决方案1】:

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

您可以简单地将声明交换为:

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

【讨论】:

  • 您好 kajuken,感谢您抽出宝贵时间回答我的问题。在实例化链码时,我确实尝试过切换对等方和管理员,但结果是一样的。我指定了一个策略 -P "OR ('Hospital1MSP.peer','Hospital1MSP.admin')" 但它再次以调用链码结束但不执行操作,因为“签名集不满足策略”
【解决方案2】:

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

我的代码行:

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

【讨论】:

  • 这并没有提供问题的答案,您应该将其发布在评论部分。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-05-26
  • 2020-11-05
  • 1970-01-01
  • 2021-03-12
相关资源
最近更新 更多