Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BIP39 Wallet #17

Open
arrivets opened this issue Oct 4, 2019 · 1 comment
Open

BIP39 Wallet #17

arrivets opened this issue Oct 4, 2019 · 1 comment
Assignees

Comments

@arrivets
Copy link
Contributor

arrivets commented Oct 4, 2019

Implement a way to backup/restore keys using a seed phrase (BIP39).

BIP39 covers more than seed phrases, it also covers HD wallets (BIP32), which enables generating multiple keys using the same seed-phrase. The same seed-phrase can be used to recover all the keys that were generated with it.

We could do something similar to Cosmos gaiacli:

# produce a seed phrase, generate the fist key following BIP39(index 0),
# prompt password to encrypt key, save encrypted keyfile.
monetd keys add [name] 

# prompt seed phrase, and recover the i'th key
# prompt password to encrypt key, save encrypted keyfile
monetd keys add [name] --recover --index [i]

So for example:

monetd keys add key0
monetd keys add key0-recovered --recover

Produces two identical keys key0 and key0-recovered provided that the seed-phrase given to the second command is the same as the seed-phrase produced by the first command.

Then, create a second key using the same seed-phrase:

monetd keys add key1 --recover --index 1

And recover it:

monetd keys add key1-recovered --recover --index 1

key1-recovered equals key1.

@arrivets arrivets self-assigned this Oct 4, 2019
@arrivets
Copy link
Contributor Author

arrivets commented Oct 4, 2019

If we allow ourselves to deviate from gaiacli's API, we could have:

To generate a new keyfile from a new seed-phrase:

monetd keys new [name]

To generate a new keyfile from an existing seed-phrase (which it prompts for interactively):

monetd keys new [name] --seed

To recover a key from a seed-phrase:

monetd keys recover [name]

At this stage, there would be no support for HD wallets. Only one key per seed-phrase.

Full BIP39 would be implemented in monetcli later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant