func ShowValidatorCmd(ctx *Context) *cobra.Command {
	cmd := cobra.Command{
		Use:   "show-validator",
		Short: "Show this node's tendermint consensus pubkey",
		RunE: func(cmd *cobra.Command, args []string) error {
			cfg := ctx.Config
			privValidator := pvm.LoadOrGenFilePV(cfg.PrivValidatorKeyFile(), cfg.PrivValidatorStateFile())
			valPubKey := privValidator.GetPubKey()
			if viper.GetBool(FlagJson) {
				return printlnJSON(valPubKey)
			}
			bz := btypes.MustConsensusPubKeyString(valPubKey)
			fmt.Println(string(bz))
			return nil
		},
	}
	cmd.Flags().Bool(FlagJson, false, "get machine parseable output")
	return &cmd
}
ShowValidator - ported from Tendermint, show this node's validator info
package server
import (
	"fmt"
	"github.com/spf13/cobra"
	"github.com/spf13/viper"
	btypes "github.com/QOSGroup/qbase/types"
	tcmd "github.com/tendermint/tendermint/cmd/tendermint/commands"
	"github.com/tendermint/tendermint/p2p"
	pvm "github.com/tendermint/tendermint/privval"
)
const (
	FlagJson = "json"
)
func ShowNodeIDCmd(ctx *Context) *cobra.Command {
	return &cobra.Command{
		Use:   "show-node-id",
		Short: "Show this node's ID",
		RunE: func(cmd *cobra.Command, args []string) error {
			cfg := ctx.Config
			nodeKey, err := p2p.LoadOrGenNodeKey(cfg.NodeKeyFile())
			if err != nil {
				return err
			}
			fmt.Println(nodeKey.ID())
			return nil
		},
	}
}