diff --git a/cmd/zetaclientd/gen_pre_params.go b/cmd/zetaclientd/gen_pre_params.go new file mode 100644 index 0000000000..c797a9f206 --- /dev/null +++ b/cmd/zetaclientd/gen_pre_params.go @@ -0,0 +1,40 @@ +package main + +import ( + "encoding/json" + "fmt" + "os" + "time" + + "github.com/binance-chain/tss-lib/ecdsa/keygen" + "github.com/spf13/cobra" +) + +func init() { + RootCmd.AddCommand(GenPrePramsCmd) +} + +var GenPrePramsCmd = &cobra.Command{ + Use: "gen-pre-params ", + Short: "Generate pre parameters for TSS", + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) error { + startTime := time.Now() + preParams, err := keygen.GeneratePreParams(time.Second * 300) + if err != nil { + return err + } + + file, err := os.OpenFile(args[0], os.O_RDWR|os.O_CREATE, 0600) + if err != nil { + return err + } + defer file.Close() + err = json.NewEncoder(file).Encode(preParams) + if err != nil { + return err + } + fmt.Printf("Generated new pre-parameters in %v\n", time.Since(startTime)) + return nil + }, +}