Hyperledger error 500 on REST API : ENDORSEMENT_POLICY_FAILURE

412 Views Asked by At

I followed this tutorial : (https://hyperledger.github.io/composer/latest/tutorials/deploy-to-fabric-multi-org) to deploy a multi-organization network. And when I try to POST a transaction from my REST API, I have the following error :

"Error trying invoke business network. Error: Peer localhost:7051 has rejected transaction 'e12bc56bf4c0af54f7909a976da0c1342ec08a4872bff611eff392635b01cfb1' with code ENDORSEMENT_POLICY_FAILURE"

I do have the same error if I try to POST a transaction from command line.

My endorsement policy is the following :

{
"identities": [
    {
        "role": {
            "name": "member",
            "mspId": "Org1MSP"
        }
    },
    {
        "role": {
            "name": "member",
            "mspId": "Org2MSP"
        }
    }
],
"policy": {
    "2-of": [
        {
            "signed-by": 0
        },
        {
            "signed-by": 1
        }
    ]
 }
}

I know that this means that both organizations have to agree with each transaction but I don't know how am I suppose to make the organizations agree concretely. Does anyone know how to deal with this issue ?

NB : If I try to create an asset or a participant from the REST API it works.

Thank you!

1

There are 1 best solutions below

4
On BEST ANSWER

If you can successfully create an Asset with a POST request, then you are executing a system transaction called AddAsset - and the endorsement works OK.

I would think that in your transaction you have a field that is a Timestamp or Random number or other generated field that is calculated separately on each peer giving a different answer and therefore failing endorsement.