Skip to main content

Key Generation and Information

The key command provides subcommands for private key generation and inspection. These are the private keys that identify the node on the network and provide validator transaction signing capability.

Generation

To generate a node private key, the basic syntax is:

kwil-admin key gen [--key-file KEY-FILE]

The square brackets around the --key-file flag indicate that it is optional. If you specify a file name, the generated key will be written to that file, otherwise it will be printed to stdout with additional information. The written file is suitable for use as kwild private key file.

Key Information

To display information on a private key:

kwil-admin key info [--key-file KEY-FILE] [PRIVKEY]

This will read the key from a file or as a positional argument (hexadecimal string). If providing the key on the command line, be aware of the security implications, and prefer the --key-file argument when possible.

For example, using a test key generated with the kwil-admin key gen --key-file=./testkey command:

$ kwil-admin key info --key-file ./testkey
Private key (hex): 95c36c2b8abcac958d1c52ea0081c1de13eafaf8d8aa314c20ea69e1aa84f0096ecaca8e9394c939a858c2c7b47acb1db26a96d7ab38bd702fa3820c5034e9d0
Private key (base64): lcNsK4q8rJWNHFLqAIHB3hPq+vjYqjFMIOpp4aqE8AluysqOk5TJOahYwse0essdsmqW16s4vXAvo4IMUDTp0A==
Public key (base64): bsrKjpOUyTmoWMLHtHrLHbJqlterOL1wL6OCDFA06dA=
Public key (cometized hex): PubKeyEd25519{6ECACA8E9394C939A858C2C7B47ACB1DB26A96D7AB38BD702FA3820C5034E9D0}
Public key (plain hex): 6ecaca8e9394c939a858c2c7b47acb1db26a96d7ab38bd702fa3820c5034e9d0
Address (string): FDF22EFD7EDAED3F1E6058A2116604DBB19EABE4
Node ID: fdf22efd7edaed3f1e6058a2116604dbb19eabe4

The derived address and public key may be required to configure a new genesis configuration for a private network with this nodes as an initial validator. The various public key formats and the node ID are also helpful when interpreting node logs.