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

Function to generate mnemonic? #34

Closed
kabriel opened this issue Aug 13, 2017 · 9 comments
Closed

Function to generate mnemonic? #34

kabriel opened this issue Aug 13, 2017 · 9 comments

Comments

@kabriel
Copy link

kabriel commented Aug 13, 2017

I don't see a way to generate a mnemonic/seed for the HDNode. Should I just use the bip39 library or am I missing something?

@ricmoo
Copy link
Member

ricmoo commented Aug 13, 2017

Good point, we should add a code snippet to the recipe book for that.

> ethers.HDNode.entropyToMnemonic(ethers.utils.randomBytes(16));
'company comic cage filter pipe scheme stock usual bubble once easily nut'

> ethers.HDNode.entropyToMnemonic(ethers.utils.randomBytes(20));
'gloom lunar consider second empower school salon lift loyal stone attend patient color artist stand'

> ethers.HDNode.entropyToMnemonic(ethers.utils.randomBytes(24));
'library rural mimic quit discover party luggage hint junior flight middle horror brush pizza delay saddle picture culture'

> ethers.HDNode.entropyToMnemonic(ethers.utils.randomBytes(28));
'culture flavor crush lyrics tenant forest amazing second labor clump tilt zebra renew shaft fork resemble other dress era unlock lens'

> ethers.HDNode.entropyToMnemonic(ethers.utils.randomBytes(32));
'wash fuel arrange false sad again theory flame junk actual act advice glue frame tiny layer artwork various dry life exact oyster kangaroo clip'

Most services (including Ethers Wallet) use 16 bytes of entropy. Wallet.createWallet will soon create mnemonic enabled wallets too and will include the same x-ethers data as ethers.objc.

@kabriel
Copy link
Author

kabriel commented Aug 13, 2017

Oh! of course, perfect. Thank you for connecting the dots for me 👍

@rajathongal
Copy link

entropyToMnemonic seems not supported in V5 of ethersjs, is there any workaround?

@alessandromorandi
Copy link

how to create entropyToMnemonic with wordlist?

@GildedHonour
Copy link

GildedHonour commented Jan 6, 2023

v 5.7.2

TypeError: ethers.utils.HDNode.entropyToMnemonic is not a function

What's the bloody matter?

@ricmoo
Copy link
Member

ricmoo commented Jan 6, 2023

@GildedHonour See the docs.

(Sorry, just saw it isn't listed; but it follows the pattern of the other functions; in v6 is it part of the HDNodeWallet class.)

@GildedHonour
Copy link

Could you possibly answer more ambigiously? @ricmoo

@GildedHonour
Copy link

Now I get it

@ricmoo
Copy link
Member

ricmoo commented Jan 6, 2023

@GildedHonour I gave more details (and an example) in the other issue you opened.

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

5 participants