You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
555 B

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