Files
tendermint/cmd/tendermint/commands/gen_node_key.go
T
Sam KleinmanandGitHub d8642a941e cmd: remove deprecated snakes (#6854)
just following up on a deprecation.
2021-08-24 16:06:27 +00:00

33 lines
632 B
Go

package commands
import (
"fmt"
"github.com/spf13/cobra"
tmjson "github.com/tendermint/tendermint/libs/json"
"github.com/tendermint/tendermint/types"
)
// GenNodeKeyCmd allows the generation of a node key. It prints JSON-encoded
// NodeKey to the standard output.
var GenNodeKeyCmd = &cobra.Command{
Use: "gen-node-key",
Short: "Generate a new node key",
RunE: genNodeKey,
}
func genNodeKey(cmd *cobra.Command, args []string) error {
nodeKey := types.GenNodeKey()
bz, err := tmjson.Marshal(nodeKey)
if err != nil {
return fmt.Errorf("nodeKey -> json: %w", err)
}
fmt.Printf(`%v
`, string(bz))
return nil
}