I have implemented fabric sdk to install and instantiate the chaincode. Everything is working fine, but not able to figure out the correct to implement endorsement in fabric nodesdk
Here is the endorsement policy which i have used while using command:
peer chaincode ${CHAINCODE_ACTION} -o orderer.google.com:7050 \
--tls --cafile ${ORDERER_CA} -C $CHANNEL_NAME \
-n ${CHAINCODE_NAME} -l ${LANG} -v "$CHAINCODE_VERSION" \
-c '{"Args":[]}' \
-P "AND (OR('Org1MSP.peer', 'Org1MSP.client','Org1MSP.member','Org1MSP.admin'),
OR ('Org2MSP.peer', 'Org2MSP.client', 'Org2MSP.member', 'Org2MSP.admin'))"
If I want to implement the same in nodesdk, below is the reference I got it from balance transfer example:
const request = {
targets: [peer],
chaincodeId: 'cc1',
chaincodeType: 'java',
chaincodeVersion: '7.0',
txId: tx_id,
// Use this to demonstrate the following policy:
// The policy can be fulfilled when members from both orgs signed.
'endorsement-policy': {
identities: [
{role: {name: 'member', mspId: 'Org1MSP'}},
{role: {name: 'member', mspId: 'Org2MSP'}}
],
policy: {'2-of': [{'signed-by': 0}, {'signed-by': 1}]}
}
};
I understand that 2-of in nothing but AND condition between the orgs. signed by 0 and 1 are the indexes of identities. But how can we add OR condition with in Org member, client, admin, peer?
I dont find any documentation to dig more into this. Any help will be much appreciated.