docker - 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"]}'
提前致谢
解决方案
在链码实例化期间,您将此链码的背书策略指定为"AND ('Org1MSP.member','Org2MSP.member')"
,这意味着来自两个组织的对等方必须对交易进行背书。
然后你只peer0.org1.example.com:7051
在链码调用期间连接到。
要完成这项工作,您必须将背书策略更改为"OR ('Org1MSP.member','Org2MSP.member')"
,或者在调用链代码时通过添加另一个--peerAddresses ...
条目来连接到两个组织中的对等点。
推荐阅读
- javascript - Highstock 不显示系列中的所有数据
- wordpress - SSH git - 如何从 repo 中提取文件夹,但不删除部署服务器上的其他目录和文件
- c# - 返回 PolicyAuthorizationResult.Forbid() 的结果时从 PolicyEvaluator 返回 403 以外的错误代码
- apache-spark - 为什么火花应用程序崩溃并出现异常 java.net.SocketException:即使在提供足够的内存和分区后连接重置?
- javascript - 无法在 ReactJs 中显示图像列表
- java - 带有 Spark 3.0.1 结构化流的 Kafka:ClassException:org.apache.kafka.common.TopicPartition;类对反序列化无效
- python - 关于双循环和枚举的问题
- r - Google Colab Kernel 范例:R 包的安装具有非零退出状态
- python - 如何抓取首页有机器人检测页面的站点
- python - 如何将像素长度转换为 mm/cm DICOM