tendermint/cmd/tendermint/commands/gen_validator.go

29 lines
592 B
Go
Raw Normal View History

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"
)
// 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) {
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))
}