Basic Key Management

Create, import, export and delete keys using the CLI keyring.

Create a new key

keys add <wallet_name>

You can create a new key with the name Default as in the following example:

Example: Create a new address
$ sged keys add Default
- name: Default
  type: local
  address: sge1quw5r22pxy8znjtdkgqc65atrm3x5hg6vycm5n
  pubkey: sgepub1addwnpepqdct05khsxvtaaj0stuvayrpw0j8t6styr7vu05k3y63d5540ftuz8x6tsq
  mnemonic: ""
  threshold: 0
  pubkeys: []

**Important** write this mnemonic phrase in a safe place.
It is the only way to recover your account if you ever forget your password.

spare leopard potato hospital series salt model myself bronze print despair please mutual rival battle lumber crater brain food artwork goose west talent ritual

The key comes with a "mnemonic phrase", which is serialized into a human-readable 24-word mnemonic. User can recover their associated addresses with the mnemonic phrase.

Restore existing key by seed phrase

keys add <key_name> --recover

You can restore an existing key with the mnemonic.

Example: Restore an existing key
$ sged keys add Default_restore --recover
#Enter your bip39 mnemonic

List your keys

Multiple keys can be created when needed. You can list all keys saved under the storage path.

Example: List all of your keys

Retrieve key information

You can retrieve key information by its name:

Example: Retrieve key information - Account Address and its public key
Example: Retrieve key information - Validator Address and its public key
Example: Retrieve key information - Consensus nodes Address and its public key

Delete a key

You can delete a key in your storage path.

Example: Remove a key

Export private keys

You can export and backup your key by using the export subcommand:

Example: Export your keys

The keyring-backend option

Interacting with a node requires a public-private key pair. Keyring is the place holding the keys. The keys can be stored in different locations with specified backend type.

os backend

The default os backend stores the keys in operating system's credential sub-system, which are comfortable to most users, yet without compromising on security.

Here is a list of the corresponding password managers in different operating systems:

file backend

The file backend stores the encrypted keys inside the app's configuration directory. A password entry is required every time the user access it, which may also occur multiple times of repeated password prompts in one single command.

test backend

The test backend is a password-less variation of the file backend. It stores unencrypted keys inside the app's configuration directory. It should only be used in testing environments and never be used in production.

Last updated