code: func instantiate(cmd *cobra.Command, cf *ChaincodeCmdFactory) (*protcommon.Envelope, error) {
  	spec, err := getChaincodeSpec(cmd)
  	if err != nil {
  		return nil, err
  	}
  
  	cds, err := getChaincodeDeploymentSpec(spec, false)
  	if err != nil {
  		return nil, fmt.Errorf("error getting chaincode code %s: %s", chaincodeName, err)
  	}
  
  	creator, err := cf.Signer.Serialize()
  	if err != nil {
  		return nil, fmt.Errorf("error serializing identity for %s: %s", cf.Signer.GetIdentifier(), err)
  	}
  
  	prop, _, err := utils.CreateDeployProposalFromCDS(channelID, cds, creator, policyMarshalled, []byte(escc), []byte(vscc), collectionConfigBytes)
  	if err != nil {
  		return nil, fmt.Errorf("error creating proposal  %s: %s", chainFuncName, err)
  	}
  
  	var signedProp *pb.SignedProposal
  	signedProp, err = utils.GetSignedProposal(prop, cf.Signer)
  	if err != nil {
  		return nil, fmt.Errorf("error creating signed proposal  %s: %s", chainFuncName, err)
  	}
  
  	// instantiate is currently only supported for one peer
  	proposalResponse, err := cf.EndorserClients[0].ProcessProposal(context.Background(), signedProp)
  	if err != nil {
  		return nil, fmt.Errorf("error endorsing %s: %s", chainFuncName, err)
  	}
  
  	if proposalResponse != nil {
  		// assemble a signed transaction (it's an Envelope message)
  		env, err := utils.CreateSignedTx(prop, cf.Signer, proposalResponse)
  		if err != nil {
  			return nil, fmt.Errorf("could not assemble transaction, err %s", err)
  		}
  
  		return env, nil
  	}
  
  	return nil, nil
  }
docs: //instantiate the command via Endorser