github.com/vipernet-xyz/tm@v0.34.24/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/vipernet-xyz/tm/libs/json"
     9  	"github.com/vipernet-xyz/tm/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  	Aliases: []string{"gen_validator"},
    17  	Short:   "Generate new validator keypair",
    18  	PreRun:  deprecateSnakeCase,
    19  	Run:     genValidator,
    20  }
    21  
    22  func genValidator(cmd *cobra.Command, args []string) {
    23  	pv := privval.GenFilePV("", "")
    24  	jsbz, err := tmjson.Marshal(pv)
    25  	if err != nil {
    26  		panic(err)
    27  	}
    28  	fmt.Printf(`%v
    29  `, string(jsbz))
    30  }