Question about wallet mnemonic

Using Incognito SDK,

I create wallet:
const wallet = new WalletInstance();
await wallet.init('my-passphrase', 'TEST-WALLET');

I back up wallet:
const backupWalletString = wallet.backup('backup-password');

I import an account:
const importedAccount = await wallet.masterAccount.importAccount('Imported account', 'ABCDEF');

Again I back up wallet:
const backupWalletString2 = wallet.backup('backup-password');

After this, backupWalletString and backupWalletString2 are not the same. Once we add/import another account, backup string changes. This is reasonable.

However, I couldn’t understand why mnemonic exists in the wallet initialization. We use backup string to restore the wallet. Then, what is the functionality of mnemonic in Incognito SDK? Is there any way to restore the wallet by just using mnemonic? Does it remain in SDK incorrectly?

Thanks for help.

1 Like

Not sure what it does, will check for details with dev.

hi @abduraman
The “mnemonic” creates a unique seed. That seed has 12 words, and they will generate all the private keys for that wallet. You can saved this seed instead of saving every single private keys.
More information is here:https://github.com/incognitochain/incognito-chain/tree/master/wallet

3 Likes

Hi @binh , this is what I expect and hope but the problem is that I cannot find any api to restore the wallet via the mnemonics here (https://github.com/incognitochain/sdk-v2)

There is api only for backupwalletstring to restore the wallet. Its problem is that it changes whenever I add a new account to the wallet.

Btw, you mean 12 words, aren’t you?

yep, 12 words.

About restoring the wallet with mnemonics? Do you have any say? :slight_smile:

hey - this is not supported yet. we aim to work on this in august.

3 Likes

this would be really helpful for long term holder!