Key management
Generate new key
To generate new key, use the following command:
If you got an error "Error: provided algorithm "eth_secp256k1" is not supported", specify an additional parameter for keyring --keyring-backend test
or --keyring-backend file
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:
Restore key from mnemonic
If you got error "Error: provided algorithm "eth_secp256k1" is not supported", specify an additional parameter for keyring --keyring-backend test
or --keyring-backend file
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:
If you cannot find your key in the output, try to specify --keyring-backend test
or --keyring-backend file
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:
If you encounter the error "Error: <wallet_name>.info: key not found", try specifying either --keyring-backend test
or --keyring-backend file
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