terrad keys add
Add an encrypted private key (either newly generated or recovered), encrypt it, and save to <name>
file.
This command generates a public and private key pair for an account.
Example
For security purposes, run this command on an offline computer.
Usage
Specify <your-key-name>
as the name of the account. It references the account number used to derive the key pair from the mnemonic. When you want to send a transaction, you will use this name to identify your account.
To specify the path (0
, 1
, 2
, ...) you want to use to generate your account, you can append the optional --account
flag. By default, account 0
is generated.
The command generates a 24-word mnemonic and saves the private and public keys for account 0
simultaneously. You are prompted to specify a passphrase that is used to encrypt the private key of account 0
on disk. Each time you want to send a transaction, this password is required. If you lose the password, you can always recover the private key by using the mnemonic phrase.
To prevent theft or loss of funds, ensure that you keep multiple copies of your mnemonic and store it in a secure place and that only you know how to access it. If someone is able to gain access to your mnemonic, they are able to gain access to your private keys and control the accounts associated with them.
After you have triple-checked your mnemonic and safely stored it, you can delete bash history to ensure no one can retrieve it.
_2history -c_2rm ~/.bash_history
Generate more accounts from the same mnemonic
To generate more accounts from the same mnemonic, run:
_1terrad keys add <your-key-name> --recover --account 1
You are prompted to specify a passphrase and your mnemonic. To generate a different account, change the account number.
Do not use the same passphrase for multiple keys. Do not lose or share your mnemonic with anyone.
Recover your key
In some cases, you might need to recover your key. If you have the mnemonic that was used to generate your private key, you can recover it and re-register your key. Issuing the following command will prompt you to enter your 24-word mnemonic.
_1terrad keys add <yourKeyName> --recover
Multisig
For information about generating multisignature accounts and signing transactions, see Sign with a multisig account.
Options
Optionally, you can specify a BIP39
mnemonic, a BIP39
passphrase to further secure the mnemonic, and a BIP32
HD path to derive a specific account. The key will be stored under the given name and encrypted with the given password. The only input that is required is the encryption password.
If run with -i
, it will prompt the user for BIP44
path, BIP39
mnemonic, and passphrase.
The flag --recover
allows one to recover a key from a seed passphrase.
If run with --dry-run
, a key will be generated (or recovered) but not stored to the local keystore.
Use the --pubkey
flag to add arbitrary public keys to the keystore for constructing multisig transactions.
You can create and store a multisig key by passing the list of key names stored in a keyring and the minimum number of signatures required through --multisig-threshold
. The keys are sorted by address, unless the flag --nosort
is set.
Options inherited from parent commands
See also
- terrad keys - Manage your application's keys.