You can add an endorsement policy when you instantiate a chaincode. An endorsement policy specifies the members with peers that must approve, or properly endorse, a chaincode transaction before it’s added to a block and submitted to the ledger.
Endorsement guarantees the legitimacy of a transaction. When you instantiate a chaincode on a channel, you can specify an endorsement policy. If you don’t specify an endorsement policy, then the default endorsement policy is used. The default endorsement policy gets an endorsement from any peer on the network.
A member’s endorsing peers must have ReaderWriter permissions on the channel. When a transaction is processed, each endorsing peer returns a signed read-write set. After the client has enough endorsements to meet the endorsement policy requirements, then the client bundles the common read-write set with the signature from the endorsing peers and sends everything to the ordering service, which orders and commits the transactions into blocks and then to the ledger.
You can go to the Channels tab to view an instantiated chaincode’s endorsement policy. See View an Endorsement Policy. You can’t modify an instantiated chaincode's endorsement policy. If you need to change an endorsement policy, then you must reinstantiate the chaincode or upgrade it to another version and specify a different endorsement policy.
You must be an administrator to perform this task.
- Go to the console and select the Chaincodes tab.
- Locate the chaincode that you want to instantiate and begin the instantiation process.
- Expand the Endorsement Policy section. Click Add Identity to add members to the policy as needed.
Field Description MSP ID From the dropdown menu, select the endorser peer’s organization. Role Select the corresponding peer role required by the endorsement policy. Usually this will be member. You can find a peer’s role by viewing its configuration information. Policy Expression Mode In most cases, you’ll use Basic. Select Advanced to provide an expression string. See the Hyperledger Fabric documentation for information about how to write a valid expression string. Signed By Select how many members with endorsing peers (peers with ReaderWriter permissions) on the channel must endorse the chaincode transactions to make them valid.
- Complete the other fields on the Instantiate Chaincode page as needed.
- Click Instantiate.