Find answers instantly with AI search. Start typing your prompt below and let AI do the digging for you!

Adding Keys

Command Overview

Before you can interact with the Saga Security Chain (SSC), you will need to add a public/private keypair (aka key) to sscd. You have the option to either create a new key, or import a key you have already created previously.

All of the keys are created using the secp256k1 elliptical curve and are securely held in a keyring managed by sscd. However, you also have several different options to create your keys e.g. use a different algorithm than the default of secp256k1.

A full list of options with which to add keys can be viewed by the following command:

$ sscd keys add --help
Usage:
  sscd keys add <name> [flags]

Flags:
      --account uint32           Account number for HD derivation (less than equal 2147483647)
      --coin-type uint32         coin type number for HD derivation (default 118)
      --dry-run                  Perform action, but don't add key to local keystore
      --hd-path string           Manual HD Path derivation (overrides BIP44 config)
  -h, --help                     help for add
      --index uint32             Address index number for HD derivation (less than equal 2147483647)
  -i, --interactive              Interactively prompt user for BIP39 passphrase and mnemonic
      --key-type string          Key signing algorithm to generate keys for (default "secp256k1")
      --ledger                   Store a local reference to a private key on a Ledger device
      --multisig strings         List of key names stored in keyring to construct a public legacy multisig key
      --multisig-threshold int   K out of N required signatures. For use in conjunction with --multisig (default 1)
      --no-backup                Don't print out seed phrase (if others are watching the terminal)
      --nosort                   Keys passed to --multisig are taken in the order they're supplied
      --pubkey string            Parse a public key in JSON format and saves key info to <name> file.
      --recover                  Provide seed phrase to recover existing key instead of creating

Global Flags:
      --home string              The application home directory (default "/home/ashish/.ssc")
      --keyring-backend string   Select keyring's backend (os|file|kwallet|pass|test|memory) (default "test")
      --keyring-dir string       The client Keyring directory; if omitted, the default 'home' directory will be used
      --log_format string        The logging format (json|plain) (default "plain")
      --log_level string         The logging level (trace|debug|info|warn|error|fatal|panic) (default "info")
      --output string            Output format (text|json) (default "text")
      --trace                    print out full stack trace on errors     

Creating a New Key using sscd

To create a new key using the default keyring and algorithm, simply type

So, for instance, if you want to generate a new key and call it mykey1, then you will type

Keep in Mind: If this is your first time creating a key in sscd, you will also be prompted for a password for the os keyring, that secures the keys using this password. Provide a strong password to secure the keyring.

This will generate the following output, and store the key in the default keyring, which is os.

You will notice that the key mykey1 has been generated and allocated an address, which in this case is saga1nlv6stt25sdest7fl2fxxp3lncxruegfwqsmw0. Additionally, from the output above, we can see that this key was generated using the secp256k1 algorithm.

To create a key in a different keyring (other than the default os keyring), you can specify the --keyring-backend flag.

For example, to create a key in the test keyring, type

This will create a key in the test keyring.

Please bear in mind that not all keyrings are secure. For more information about supported keyrings and their security features, please refer to Key Management Overview.

Import an Existing Key into sscd

You may have keys that you already use that you want to use with sscd. To do so, you will need to import your existing key into sscd.

You will need to have access to the BIP39 mnemonic phrase associated with the key you are trying to import.

As long you have the mnemonic phrase, you can import an existing key by:

For example, if you want to import an existing key called test1 into sscd, you would type

This will prompt you to enter the BIP39 mnemonic.

The new key is generated and saved to the default keyring, and its address is echoed to the screen.

Last updated