github.com/adoriasoft/tendermint@v0.34.0-dev1.0.20200722151356-96d84601a75a/cmd/tendermint/commands/gen_validator.go (about) 1 package commands 2 3 import ( 4 "fmt" 5 6 "github.com/spf13/cobra" 7 8 tmjson "github.com/tendermint/tendermint/libs/json" 9 "github.com/tendermint/tendermint/privval" 10 ) 11 12 // GenValidatorCmd allows the generation of a keypair for a 13 // validator. 14 var GenValidatorCmd = &cobra.Command{ 15 Use: "gen_validator", 16 Short: "Generate new validator keypair", 17 Run: genValidator, 18 } 19 20 func genValidator(cmd *cobra.Command, args []string) { 21 pv := privval.GenFilePV("", "") 22 jsbz, err := tmjson.Marshal(pv) 23 if err != nil { 24 panic(err) 25 } 26 fmt.Printf(`%v 27 `, string(jsbz)) 28 }