Key management
Generate new key
To generate new key, use the following command:
swisstronikcli keys add <key_name>NOTE: This command will generate a mnemonic for a new key, therefore, you should save it in a secure place.
The command above will output the following:
- address: swtr156pzc2rj2xka9cu0gpgkmz3vmal544nlu9mwj7
name: debug
pubkey: '{"@type":"/ethermint.crypto.v1.ethsecp256k1.PubKey","key":"AyJHdeTNCnjV4v5ZJEbyFS5UtzBQk1ThkZB4G7QR3Cb6"}'
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.
picnic explain flower snack lava town marriage search approve increase display angry express peanut peanut mouse noise knock address situate hope pelican advance ratherRestore key from mnemonic
If you already have a mnemonic and want to restore a key from it, use the following command:
It will prompt you for your mnemonic. Once you input your mnemonic, your output should look like:
List all accounts
To show all stored accounts, use the following command:
This command should output the following:
Export ETH private key
Since swisstronikcli operates with eth_secp256k1 private keys, all keys stored in the keyring are Ethereum-compatible private keys. You can export Ethereum private key (for example, to use it in MetaMask) by using the following command:
The command above should output your Ethereum private key, for example:
Convert address
swisstronikcli can work only with bech32-encoded (swtr1) addresses, so if you want to convert your Ethereum address to bech32 format (and vice versa), you can use the following command:
It should output the converted address:
Last updated