我创建了一个具有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"]}'
提前感谢
在链码实例化期间,您将此链码的背书策略指定为"AND ('Org1MSP.member','Org2MSP.member')"
,这意味着两个组织的同级都必须背书交易。
然后您仅在调用链码期间连接到peer0.org1.example.com:7051
。>>
为了使这项工作有效,您必须将背书策略更改为"OR ('Org1MSP.member','Org2MSP.member')"
,或者通过添加另一个--peerAddresses ...
条目来在调用链码的同时连接到两个组织中的对等实体。