ENDORSEMENT_POLICY_FAILURE error on on invocation of chaincode functions

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

here is peer-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')"

I was missing the --peerAddresses arguments during invocation of chaincode function. Now it's solved. Thanks to @Harshit 's comment

peer chaincode invoke -o orderer.nid.com:7050 -C nid-channel -n car_reg --peerAddresses peer0.moha.nid.com:7051 --peerAddresses peer0.ec.nid.com:7051 -c '{"Args":["createCar","1","bmw","tx","blue","me"]}'

Endorsement Policy Failure in Hyperledger Fabric while invoking a , Endorsement Policy Failure in Hyperledger Fabric while invoking a Failed to invoke chaincode. cause:Error: The invoke chaincode transaction was invalid, call for service discovery function of Fabric v1.2, but I got these errors: 2018-12-​12  create stores the chaincode in state on successful init invocation; execute accepts wasm chaincode name, function to invoke and parameters(to be passed to wasm) execute retrieves the wasm chaincode bytes from state and execute it in wasm vm; execute dynamically invokes the function from wasm chaincode whose name it accepted as a parameter


  1. If you did not specify endorsement policy during instantiation, the endorsement policy defaults to "any member of the organizations in the channel". i.e) "OR ('mohaMSP.member','ecMSP.member')"

  2. When you specify endorsement policy "AND ('mohaMSP.peer','ecMSP.peer')" explicitly, it requests one signature from each Org (mohaMSP, ecMSP) peers. So check whether both Org has endorsing peers..

For more info, setting-chaincode-level-endorsement-policies

Deploying a smart contract to a channel, By default, endorsement policies are specified in the chaincode definition, which is Any invoke of the chaincode that writes data to the ledger will need to be For keys that are part of Private data in a collection the following functions apply: DelOrgs(organizations string) error // ListOrgs returns an array of channel orgs  chaincode: Chaincode name. chaincodeVer: Version of the chaincode. Note: Reserved for future use, not used in current version. channel: Channel name. method: Method defined in the chaincode. nonce: Set a nonce for the transaction. payloadType: Specify the response payload type.


Try this:

-P "AND ('ecMSP.member','mohaMSP.member')"

Maybe your peers has not the "peer" role.

Check this documentation: Endorsement policy Identity Classification

Endorsement policies, We use lifecycle chaincode functions to make the application chaincode useable. Org1 performs a chaincode invoke on set() with a key/value pair. and the error message shows it is due to the endorsement policy failure. The general format to invoke a chaincode is as follows: stub.InvokeChaincode(chaincodeName, queryArgs, channelName) But this is used to invoke another chaincode. So if you want to invoke the function by the chaincode itself, you have to modify the above code. If you want to call the chaincode in same channel, leave the channelName parameter empty.


Illustrating Endorsement Policy in Lifecycle Chaincode (Hyperledger , When I try to invoke chaincode from 1st or 2nd organization then it's working fine But when I invoke a transaction from org3, I am getting the following error. invoke - The transaction was invalid, code = ENDORSEMENT_POLICY_FAILURE" What is new features in Javascript ES2020 ECMAScript 2020. Example of using mockstub to test go chaincode. Contribute to clydedacruz/fabric-chaincode-tests development by creating an account on GitHub.


Modify existing endorsement policy (Hyperledger Fabric), peer lifecycle chaincode approveformyorg --channelID mychannel --name simple2 --version committed with status (ENDORSEMENT_POLICY_FAILURE) at The endorsement error also pops up if you try to commit a different Error: proposal failed with status: 500 - Failed to authorize invocation due to  Your chaincode may contain one or more functions for transactions. Use this endpoint to invoke those functions asynchronously where the transaction ID is returned immediately independently of the transaction completing, and the status is queried seperately.


chaincode 2.0 problems, FAB-17784: Clarify error message when legacy chaincode install fails during build. When a The LookPath function, when provided with a relative path, will look for the presence of the executable and Support for invoking system chaincodes from user chaincodes. Reason code [​ENDORSEMENT_POLICY_FAILURE]". You can use the chaincode definition to require the invocation of the Init function to initialize the chaincode. If the invocation of the Init function is requested, the first invoke of the chaincode must be a call to the Init function. The invoke of the Init function is subject to the chaincode endorsement policy.