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.
User key tools are provided bykwil-cli
.
Generation
To generate a node private key, the basic syntax is:
kwild 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:
kwild 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 kwild key gen --key-file=./nodekey.json
command:
$ kwild key info --key-file ./nodekey.json
Key type: secp256k1
Private key (hex): 48fbabf1665364a86d9ba0d0095f61a479912646b09fa7289fa79f80c3213147
Public key (plain hex): 021151a30b883806ef8b6f7f4545332c297774315c9608fccb65e1c24367c9cb08
Equivalent User Address: 0x48274DFA65350b18Ced29ECFA1484dbE763f437D
The derived 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.
As a convenience for testing, the equivalent user address (in Ethereum format)
is also displayed. This is helpful when bringing up a testnet where a db_owner
in
genesis.json is required. In this scenario, the private key may be used with
kwil_cli
, which identifies the user on Kwil as an Ethereum user with this address.
This may also be obtained with the kwil-cli account id
command using this private key.
The node on the other hand is identified exclusively by its public key.