Endorsement policy

The next step is to frame an endorsement policy for our chaincode that will be committed to the ledger during the instantiation. This endorsement policy dictates how many peers, belonging to what roles and organizations, need to endorse a ledger commitment transaction (or invocation). In the sample code, different endorsement policies are listed in constants.js, which contains various settings and keywords used by our middleware. The one that we will employ is ALL_FOUR_ORG_MEMBERS:

var FOUR_ORG_MEMBERS_AND_ADMIN = [
{ role: { name: 'member', mspId: 'ExporterOrgMSP' } },
{ role: { name: 'member', mspId: 'ImporterOrgMSP' } },
{ role: { name: 'member', mspId: 'CarrierOrgMSP' } },
{ role: { name: 'member', mspId: 'RegulatorOrgMSP' } },
{ role: { name: 'admin', mspId: 'TradeOrdererMSP' } }
];
var ALL_FOUR_ORG_MEMBERS = {
identities: FOUR_ORG_MEMBERS_AND_ADMIN,
policy: {
'4-of': [{ 'signed-by': 0 }, { 'signed-by': 1 }, { 'signed-by': 2 }, { 'signed-by': 3 }]
}
};

The list of principals is specified in the identities attribute of the policy and refers to member (or ordinary) users of the four peer organizations, as well as administrator users of the orderer organization. The policy attribute here states that an endorsement is required from a member of each of the four peer organizations; in all, four signatures will be required.

The variable TRANSACTION_ENDORSEMENT_POLICY is set to ALL_FOUR_ORG_MEMBERS in constants.js by default, and will be used to configure the channel endorsement policy later in this section.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset