首页 > 解决方案 > Hyperledger Fabric 错误:签名集不满足策略

问题描述

我创建了一个包含 2 个组织的网络配置,每个组织都有 1 个对等点和 CA。我已经在两个对等点上成功安装并实例化了我的链码但是在调用事务后,两个对等点都会发生此错误:

peer0.org1.example.com|2020-01-27 21:32:00.531 UTC [committer.txvalidator] validateTx -> ERRO 047 VSCCValidateTx for transaction txId = d18ad9c8c5e6aada47b7c8677676b4d748bf2ae16256c093ae8f9dfb0bf17779 returned error: VSCC error: endorsement policy failure, err: signature set did not satisfy policy
peer0.org2.example.com|2020-01-27 21:32:00.531 UTC [committer.txvalidator] validateTx -> ERRO 069 VSCCValidateTx for transaction txId = d18ad9c8c5e6aada47b7c8677676b4d748bf2ae16256c093ae8f9dfb0bf17779 returned error: VSCC error: endorsement policy failure, err: signature set did not satisfy policy

这就是我在两个节点上安装链码的方式:

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

这就是我实例化合同的方式

peer chaincode instantiate -o orderer.example.com:7050 --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/cacerts/ca.example.com-cert.pem -C $CHANNEL_NAME -n mycc -l node -v 1.0 -c '{"Args":[]}' -P "AND ('Org1MSP.member','Org2MSP.member')"

这就是我调用事务的方式

peer chaincode invoke -o orderer.example.com:7050 --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/ca/ca.example.com-cert.pem -C mychannel -n mycc --peerAddresses peer0.org1.example.com:7051 --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/ca/ca.org1.example.com-cert.pem -c '{"Args":["createMyAsset","001","Model X"]}'

提前致谢

标签: dockerhyperledger-fabrichyperledgerhyperledger-chaincodechaincode

解决方案


在链码实例化期间,您将此链码的背书策略指定为"AND ('Org1MSP.member','Org2MSP.member')",这意味着来自两个组织的对等方必须对交易进行背书。

然后你只peer0.org1.example.com:7051在链码调用期间连接到。

要完成这项工作,您必须将背书策略更改为"OR ('Org1MSP.member','Org2MSP.member')",或者在调用链代码时通过添加另一个--peerAddresses ...条目来连接到两个组织中的对等点。


推荐阅读