func gen(args []string) error {
	var raw []byte
	var err error
	fmt.Printf("Generate public parameters for [%s]...\n", driver)
	switch driver {
	case "dlog":
		raw, err = dlogGen(args)
	default:
		errors.Errorf("Invalid crypto type, expected 'dlog', got [%s]", driver)
	}
	if err != nil {
		return err
	}
	if cc {
		fmt.Println("Generate chaincode package...")
		if err := genChaincodePackage(raw); err != nil {
			return err
		}
	}
	fmt.Println("Generation done.")
	return nil
}
gen read topology and generates artifacts
package pp
import (
	"bytes"
	"encoding/base64"
	"fmt"
	"io"
	"io/ioutil"
	"path/filepath"
	"strings"
	"text/template"
	"github.com/pkg/errors"
	"github.com/spf13/cobra"
	"github.com/hyperledger-labs/fabric-smart-client/integration/nwo/fabric/packager"
	"github.com/hyperledger-labs/fabric-token-sdk/token/core/zkatdlog/crypto"
)
const (
	IdemixConfigDirMsp              = "msp"
	IdemixConfigFileIssuerPublicKey = "IssuerPublicKey"
)
var driver string
var idemixMSPDir string
var output string
var base int64
var exponent int
var cc bool
func Cmd() *cobra.Command {
	flags := cobraCommand.Flags()
	flags.StringVarP(&driver, "driver", "d", "dlog", "driver (dlog)")
	flags.StringVarP(&idemixMSPDir, "idemix", "i", "", "idemix msp dir")
	flags.StringVarP(&output, "output", "o", ".", "output folder")
	flags.Int64VarP(&base, "base", "b", 100, "max token quantity")
	flags.IntVarP(&exponent, "exponent", "e", 2, "max token quantity")
	flags.BoolVarP(&cc, "cc", "", false, "generate chaincode package")
	return cobraCommand
}
var cobraCommand = &cobra.Command{
	Use:   "gen",
	Short: "Gen zkat artifacts.",
	Long:  `Generates zkat artifacts.`,
	RunE: func(cmd *cobra.Command, args []string) error {
		if len(args) != 0 {
			return fmt.Errorf("trailing args detected")
		}
		cmd.SilenceUsage = true
		return gen(args)
	},
}