2017-02-23 00:21:13 -05:00
|
|
|
package commands
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
|
|
|
|
"github.com/spf13/cobra"
|
|
|
|
|
2018-06-01 19:17:37 +02:00
|
|
|
"github.com/tendermint/tendermint/privval"
|
2017-02-23 00:21:13 -05:00
|
|
|
)
|
|
|
|
|
2017-09-13 00:18:07 +02:00
|
|
|
// GenValidatorCmd allows the generation of a keypair for a
|
|
|
|
// validator.
|
2017-08-30 22:21:32 +02:00
|
|
|
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) {
|
2018-06-01 19:17:37 +02:00
|
|
|
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
|
|
|
}
|