【发布时间】:2019-06-22 10:33:55
【问题描述】:
在没有指定背书策略的情况下实例化链码时,链码中的函数调用工作正常,并且可以在 couchdb 数据库中看到存储的数据。但是在链码实例化过程中明确指定背书策略为“AND ('mohaMSP.peer','ecMSP.peer')”时,链码函数的调用不会显示任何错误,但不会更新 couchdb 状态数据库。所以我检查了 peer0.moha.nid.com 上的日志,它显示了以下错误:
2019-01-29 09:46:00.851 UTC [valimpl] preprocessProtoBlock -> WARN cac6 Channel [nid-channel]: Block [7] Transaction index [0] TxId [bfed301afcaae5ad2ee8885c3cdbd39521827b25cabe92d6cf03f931da4ea391] marked as invalid by committer. Reason code [ENDORSEMENT_POLICY_FAILURE]
我已经在 peer0.ec.nid.com 和 peer0.moha.nid.com 上安装了链码(即在两个组织中)并验证了安装。如peer channel list 命令所示,共有三个节点加入了 nid 通道 - peer0.moha.nid.com、peer1.moha.nid.com、peer0.ec.nid.com。
here is docker-compose.yaml file to start the network
here is docker-compose-base.yaml file
我正在运行 fabric 1.2.1 容器并将它们标记为最新。
链码实例化命令:
peer chaincode instantiate -o orderer.nid.com:7050 -n car_reg -v 1 -C nid-channel -c '{"Args":[]}' -P "AND ('ecMSP.peer','mohaMSP.peer')"
【问题讨论】:
-
你使用哪个命令来调用?
-
对等链码调用 -o orderer.nid.com:7050 -C nid-channel -n car_reg -c '{"Args":["createCar","1","bmw"," gtx","blue","me"]}'
-
在使用“AND”时尝试使用命令 - peer chaincode invoke -o orderer.example.com:7050 -C mychannel -n mycc --peerAddresses peer0.org1.example.com:7051 --peerAddresses peer0.org2.example.com:7051 -c '{"Args":["invoke","...."]}'
-
是的,您必须这样做,如果您指定“AND”策略,则必须在命令中提供背书节点。检查 BYFN 我们在调用期间也指定了 --peeradd
-
@Harshit 是的,我忽略了它。现在它正在工作。谢谢
标签: docker hyperledger-fabric hyperledger ibm-blockchain