mirror of
https://github.com/fluencelabs/tendermint
synced 2025-06-14 13:51:21 +00:00
This example shows how a user of the tendermint library can build their own node and supply it with its own commands. It includes two todos in order to make it easier for library users to use tendermint.
24 lines
479 B
Go
24 lines
479 B
Go
package commands
|
|
|
|
import (
|
|
"encoding/json"
|
|
"fmt"
|
|
|
|
"github.com/spf13/cobra"
|
|
|
|
"github.com/tendermint/tendermint/types"
|
|
)
|
|
|
|
var GenValidatorCmd = &cobra.Command{
|
|
Use: "gen_validator",
|
|
Short: "Generate new validator keypair",
|
|
Run: genValidator,
|
|
}
|
|
|
|
func genValidator(cmd *cobra.Command, args []string) {
|
|
privValidator := types.GenPrivValidator()
|
|
privValidatorJSONBytes, _ := json.MarshalIndent(privValidator, "", "\t")
|
|
fmt.Printf(`%v
|
|
`, string(privValidatorJSONBytes))
|
|
}
|