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

sscd keys add <keyname>

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

sscd keys add mykey1

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.

- address: saga1nlv6stt25sdest7fl2fxxp3lncxruegfwqsmw0
  name: mykey1
  pubkey: '{"@type":"/cosmos.crypto.secp256k1.PubKey","key":"A923CFCYWYBK58XocadjTaEm+F2g6iebyf2F9lZ1vMF7"}'
  type: local


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

tornado smile planet skin guard differ blood glory wreck guitar sport normal shaft all flame away mix renew run wrap travel vehicle evolve chimney

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

sscd keys add test3 --keyring-backend test

This will create a key in the test keyring.

- address: saga1wv8shjt2hvvg9w0c556lv37c25twt5uhyqtzvw
  name: test3
  pubkey: '{"@type":"/cosmos.crypto.secp256k1.PubKey","key":"A6AbCvRiZdVmBZNISExHzSwE2Aqyx0jskLAGYCxVru7M"}'
  type: local


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

hurdle lock typical ocean isolate benefit garment claw winner kid lonely above trash rely dirt slot capital peace finish tree vibrant network sudden soldier

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:

sscd keys add <keyname> --recover

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

sscd keys add test1 --recover

This will prompt you to enter the BIP39 mnemonic.

$ sscd keys add test1 --recover
> Enter your bip39 mnemonic
friend account warrior undo biology elevator crime hole skull nuclear age beef census arena kind canvas prison visual popular love brush bicycle ecology task

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

- address: saga1z0uscdcprxcun2mlnyrz5kelemmjw768sdrgz5
  name: test1
  pubkey: '{"@type":"/cosmos.crypto.secp256k1.PubKey","key":"A+u4iLJZWZHHcRIEbme8ppbmk1jYTpZVio8anPqAIQ31"}'
  type: local

Last updated