github.com/ari-anchor/sei-tendermint@v0.0.0-20230519144642-dc826b7b56bb/cmd/tendermint/commands/gen_node_key.go (about) 1 package commands 2 3 import ( 4 "fmt" 5 6 "github.com/spf13/cobra" 7 8 tmjson "github.com/ari-anchor/sei-tendermint/libs/json" 9 "github.com/ari-anchor/sei-tendermint/types" 10 ) 11 12 // GenNodeKeyCmd allows the generation of a node key. It prints JSON-encoded 13 // NodeKey to the standard output. 14 var GenNodeKeyCmd = &cobra.Command{ 15 Use: "gen-node-key", 16 Short: "Generate a new node key", 17 RunE: genNodeKey, 18 } 19 20 func genNodeKey(cmd *cobra.Command, args []string) error { 21 nodeKey := types.GenNodeKey() 22 23 bz, err := tmjson.Marshal(nodeKey) 24 if err != nil { 25 return fmt.Errorf("nodeKey -> json: %w", err) 26 } 27 28 fmt.Printf(`%v 29 `, string(bz)) 30 31 return nil 32 }