You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

32 lines
594 B

package commands
import (
"encoding/json"
"fmt"
"github.com/spf13/cobra"
"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 := json.Marshal(nodeKey)
if err != nil {
return fmt.Errorf("nodeKey -> json: %w", err)
}
fmt.Printf(`%v
`, string(bz))
return nil
}