Keys Migrate

The keyfile (private key) of irishub v0.16.x uses db storage. The new version v1.0+ will offer a new way to store user private keys. In order to support the migration of the old keyfile to the new version, there are two solutions provided.


This way is suitable for users who have mnemonic words. When creating a new account, the system will randomly assign a mnemonic phrase to the user, and use this mnemonic phrase to recover the user's private key. Regardless of the v0.16.x version, or v1.0+, the mnemonic phrase remains unchanged. You can use the add command with the --recover flag to restore the account, for example:

iris keys add n2 --recover


This way is suitable for users who have lost the mnemonic but saved the db file of the keys, or the keystore file of the keys. The format of the keystore file of irishub v0.16.x is similar to that of Ethereum, and v1.0+ is also fully compatible with a new format. Therefore, the user can export the old private key using the keystore, and then use the v1.0+ version of irishub to import the keystore to complete the key migration.The operation process is as follows:

1. Use irishub v0.16.x to export keystore file

iriscli keys export test1 --output-file=key.json --home ./iriscli_test 



**2. Use irishub v1.0.1 to import keystore file**

iris keys import n2 key.json --keyring-backend file 

3. Verify the imported key information

iris keys show n2 --keyring-backend file


Enter keyring passphrase:
- name: n2
type: local
address: iaa1k2j3ws7ghwl9qha36xdcmwuu4rend2yr9tw05q
pubkey: iap1addwnpepqgrj4yshwmq7v7akp04empq9rrn6w26e8q6gpl7jkfjaexk93deq2pwa3m6
mnemonic: ""
threshold: 0
pubkeys: []

The output account address is consistent with the address in the keystore file, and the migration is successful.