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

Generate seed from mnemonic #55

Open
imerkle opened this issue Sep 11, 2018 · 6 comments
Open

Generate seed from mnemonic #55

imerkle opened this issue Sep 11, 2018 · 6 comments
Labels
enhancement New feature or request

Comments

@imerkle
Copy link

imerkle commented Sep 11, 2018

No description provided.

@marvinroger marvinroger added the enhancement New feature or request label Sep 11, 2018
@rokanost
Copy link

I generate my seed with:

 let seedBuffer = bip39.mnemonicToSeed(MNEMONIC_PRIVATE_SEED);
 let seed = Buffer.from(seedBuffer).toString('hex');

However, in new version checkSeed() is failing.
The length of my seed is 128 characters and maximum allowed for deriveSecretKey() is 64 :/

@marvinroger
Copy link
Owner

@rokanost what if you comment that line?

if (!checkSeed(seed)) throw new Error('Seed is not valid');

If it's as simple as feeding the blake2b hash with a 128 chars seed instead of a 64 one, it would be easy to be compatible.

@rokanost
Copy link

I did comment it out and everything seems fine, but tx now fails on publish with “bad work”

@marvinroger
Copy link
Owner

Do you generate the work against the previous block hash? If this is the first block on the account chain, you have to use the account's public key.

@rokanost
Copy link

All good now, had a little bug in my code.

@marvinroger
Copy link
Owner

Alright, so it's a bit more complicated than that.

We can't generate a nano seed from a BIP39 mnemonic phrase. We can however derive private keys from the mnemonic phrase with the BIP39 derivation path 44'/165'/0', 0 being the account index.

See https://github.com/nanocurrency/nano-node/wiki/Mnemonic-Seed

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

No branches or pull requests

3 participants