github.com/devwanda/aphelion-staking@v0.33.9/cmd/tendermint/commands/gen_validator.go (about)

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