Skip to content

Instantly share code, notes, and snippets.

@Deeptiman
Last active December 22, 2019 04:25
Show Gist options
  • Save Deeptiman/061f306d52a2e2c0f03d155e4f92e1c2 to your computer and use it in GitHub Desktop.
Save Deeptiman/061f306d52a2e2c0f03d155e4f92e1c2 to your computer and use it in GitHub Desktop.
cfg := []*cb.CollectionConfig{ collCfg1, collCfg2}
policy = "OR ('Org1MSP.member','Org2MSP.member','Org3MSP.member','Org4MSP.member')"
// here this policy is a completely separate entity, it relates to the all organization's peers following an endorsing policy to validate all the blocks in the network consistently.
ccPolicy, _ := cauthdsl.FromString(policy) // cauthdsl will convert the policy string to Policy object
resp, err := s.Resmgmt.InstantiateCC(
s.ChannelID,
resmgmt.InstantiateCCRequest{
Name: s.ChaincodeId,
Path: s.ChaincodePath,
Version: s.ChainCodeVersion,
Args: [][]byte{[]byte("init")},
Policy: ccPolicy,
CollConfig: cfg,
},resmgmt.WithRetry(retry.DefaultResMgmtOpts), resmgmt.WithTargets(orgPeers[0], orgPeers[1]))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment