On instantiating the chaincode without specifying the endorsement policy, invocation of functions in chaincode work fine and stored data can be seen on couchdb database. But on explicitly specifying endorsement policy as "AND ('mohaMSP.peer','ecMSP.peer')" during instantiation of chaincode, the invocation of chaincode functions don't show any error, but do not update the couchdb state database. So I checked the logs on peer0.moha.nid.com and it showed the following error:
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]
I have installed the chaincode on peer0.ec.nid.com and peer0.moha.nid.com (i.e. in both organizations) and verified the installation as well. There are three peers joined to the nid-channel - peer0.moha.nid.com, peer1.moha.nid.com, peer0.ec.nid.com as shown by peer channel list
command.
here is docker-compose.yaml file to start the network
here is docker-compose-base.yaml file
I am running fabric 1.2.1 containers and have tagged them as latest.
Chaincode instantiation command:
peer chaincode instantiate -o orderer.nid.com:7050 -n car_reg -v 1 -C nid-channel -c '{"Args":[]}' -P "AND ('ecMSP.peer','mohaMSP.peer')"