Replies: 1 comment 1 reply
-
If you have those hex generated by secure practices, you can convert them into mnemonic phrase using following: const hex = '0x...' // 16 bytes for 12 words, and 32 bytes for 24 words
const mnemonic = ethers.utils.entropyToMnemonic(hex); The length of hex string should be multiples of 4 bytes (8 hex chars). Minimum allowed is 16 bytes and max 32 bytes. Also be careful with your source of the hex string, as it should be uniformly random. You may use const hex = '0x...'
const hash = ethers.utils.keccak256(hex);
const mnemonic = ethers.utils.entropyToMnemonic(hash); // 24 words. for 12 words hash.slice(0,2+32) |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Here is an example of generating wallet in doc:
The mnemonic above is a string of words. Can mnemonic be a string of random hex characters (12 of them) as below and be used in code above?
mnemonic = "eb530fb00acbd1b7 baab994a81f08fbd 9c326342f8dde6b7 a2e8622f73bbb377 115afb3e9f9c0064 870569acc4720bf6 92fce241ab441df2 c6e21aa5ba9fc60f 6eee70d7512667d9 aa611d4468ef9b7e 90937280d6c0721f ba10315078901fad"
Beta Was this translation helpful? Give feedback.
All reactions