tendermint/cmd/tendermint/commands/gen_validator.go

28 lines
499 B
Go
Raw Normal View History

2017-02-23 00:21:13 -05:00
package commands
import (
"fmt"
"github.com/spf13/cobra"
"github.com/tendermint/tendermint/privval"
2017-02-23 00:21:13 -05:00
)
// GenValidatorCmd allows the generation of a keypair for a
// validator.
var GenValidatorCmd = &cobra.Command{
2017-02-23 00:21:13 -05:00
Use: "gen_validator",
Short: "Generate new validator keypair",
Run: genValidator,
}
func genValidator(cmd *cobra.Command, args []string) {
pv := privval.GenFilePV("")
2018-04-05 22:05:30 -07:00
jsbz, err := cdc.MarshalJSON(pv)
2017-11-27 22:05:55 +00:00
if err != nil {
panic(err)
}
2017-02-23 00:21:13 -05:00
fmt.Printf(`%v
2018-04-05 22:05:30 -07:00
`, string(jsbz))
2017-02-23 00:21:13 -05:00
}