Hyperledger/fabric Endorsement policy for one organisation with 5 peers

时间:2018-12-03 13:18:19

标签: hyperledger-fabric hyperledger-fabric-ca

I have developed the network for one organisation with 5 peers using nodejs application but i am bit confused with endorsement policy. I want atleast 3 peers to endorse the the transaction. how should i define if atleast 3 peers have to endorse the transaction.

This is how i am trying to do but its failing. while invoke. can someone please help me with it,

'endorsement-policy': {
    identities: [
       { role: { name: 'peer', mspId: 'Org1MSP' } },
    ],
    policy: {
        '1-of': [ 
            { 'signed-by': 0 }
        ]
   }
}

But the above approach doesnt really work for me. can someone please suggest over this.

1 个答案:

答案 0 :(得分:0)

除非您想write your own endorsement plugin,否则可用于Hyperledger Fabric认可策略的最低粒度是组织。因此,为了使您的示例正常工作,每个对等方都需要处于单独的组织中。使用peer命令CLI语法,该策略将类似于:

OutOf(3, 'Org1.peer', 'Org2.peer', 'Org3.peer', 'Org4.peer', 'Org5.peer')

或者,在JSON中:

'endorsement-policy': {
  identities: [
    { role: { name: 'peer', mspId: ORGS['Org1'].mspid }},
    { role: { name: 'peer', mspId: ORGS['Org2'].mspid }},
    { role: { name: 'peer', mspId: ORGS['Org3'].mspid }},
    { role: { name: 'peer', mspId: ORGS['Org4'].mspid }},
    { role: { name: 'peer', mspId: ORGS['Org5'].mspid }}
  ],
  policy: {
    '3-of': [
      { 'signed-by': 0 }, 
      { 'signed-by': 1 }, 
      { 'signed-by': 2 }, 
      { 'signed-by': 3 }, 
      { 'signed-by': 4 }
    ]
  }
}
相关问题