2017-02-23 00:21:13 -05:00
|
|
|
package commands
|
|
|
|
|
|
|
|
import (
|
2017-04-28 23:18:38 -04:00
|
|
|
"encoding/json"
|
2017-02-23 00:21:13 -05:00
|
|
|
"fmt"
|
|
|
|
|
|
|
|
"github.com/spf13/cobra"
|
|
|
|
|
|
|
|
"github.com/tendermint/tendermint/types"
|
|
|
|
)
|
|
|
|
|
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) {
|
2017-09-18 22:05:33 -04:00
|
|
|
privValidator := types.GenPrivValidatorFS("")
|
2017-11-27 22:05:55 +00:00
|
|
|
privValidatorJSONBytes, err := json.MarshalIndent(privValidator, "", "\t")
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
2017-02-23 00:21:13 -05:00
|
|
|
fmt.Printf(`%v
|
|
|
|
`, string(privValidatorJSONBytes))
|
|
|
|
}
|