Change Endorsement Policy in configtx.yaml to use NoutOf rule, so any 2 of the organizations can approve chaincode lifecycle

This commit is contained in:
Ferry Ariawan 2024-06-10 20:07:49 +07:00
parent 16b3eea508
commit 6c074d0361
2 changed files with 19 additions and 14 deletions

View file

@ -207,11 +207,17 @@ Application: &ApplicationDefaults
Type: ImplicitMeta
Rule: "MAJORITY Admins"
LifecycleEndorsement:
Type: ImplicitMeta
Rule: "MAJORITY Endorsement"
# Type: ImplicitMeta
# Rule: "MAJORITY Endorsement"
Type: Signature
Rule: "OutOf(2, 'FarmerMSP.peer', 'PulperMSP.peer', 'HullerMSP.peer', 'ExportMSP.peer')"
# Rule: "OR('FarmerMSP.peer', 'PulperMSP.peer', 'HullerMSP.peer', 'ExportMSP.peer')"
Endorsement:
Type: ImplicitMeta
Rule: "MAJORITY Endorsement"
# Type: ImplicitMeta
# Rule: "MAJORITY Endorsement"
Type: Signature
Rule: "OutOf(2, 'FarmerMSP.peer', 'PulperMSP.peer', 'HullerMSP.peer', 'ExportMSP.peer')"
# Rule: "OR('FarmerMSP.peer', 'PulperMSP.peer', 'HullerMSP.peer', 'ExportMSP.peer')"
Capabilities:
<<: *ApplicationCapabilities
################################################################################

View file

@ -78,10 +78,10 @@ infoln "Install chaincode on peer0.farmer..."
installChaincode farmer
infoln "Install chaincode on peer0.pulper..."
installChaincode pulper
infoln "Install chaincode on peer0.huller..."
installChaincode huller
infoln "Install chaincode on peer0.export..."
installChaincode export
#infoln "Install chaincode on peer0.huller..."
#installChaincode huller
#infoln "Install chaincode on peer0.export..."
#installChaincode export
resolveSequence
@ -104,22 +104,21 @@ approveForMyOrg pulper
checkCommitReadiness farmer "\"FarmerMSP\": true" "\"PulperMSP\": true"
checkCommitReadiness pulper "\"FarmerMSP\": true" "\"PulperMSP\": true"
approveForMyOrg huller
approveForMyOrg export
#approveForMyOrg huller
#approveForMyOrg export
## now that we know for sure both orgs have approved, commit the definition
commitChaincodeDefinition farmer pulper huller export
commitChaincodeDefinition farmer pulper #huller #export
## query on both orgs to see that the definition committed successfully
queryCommitted farmer pulper huller export
queryCommitted farmer pulper #huller #export
## Invoke the chaincode - this does require that the chaincode have the 'initLedger'
## method defined
if [ "$CC_INIT_FCN" = "NA" ]; then
infoln "Chaincode initialization is not required"
else
chaincodeInvokeInit farmer pulper huller export
chaincodeInvokeInit farmer pulper #huller #export
fi
exit 0