Hierarchical Deterministic Wallets

I’m a little tripped up over this line of code… what does this string mean exactly? Is it the standard default mnemonic string, or is it just a silly example?

const mnemonic = ‘abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about’;

Oh i see we are actually passing this string var to a function:

const wallet = Wallet.generateWalletFromMnemonic(mnemonic);

I would like to learn more about how this function generates a random wallet. Can someone link me to the file in which I can find the functions logic? I will be looking until then, thanks!

This is a valid mnemonic, as described by BIP39.

This mnemonic represents a seed via 11 words. Each word is unique and contains some bits of entropy. The final and 12th word is a checksum, which BIP39 uses for error checking. In this case, abandon is the first word in the word list, representing 0 bytes, so this is essentially a seed comprised of 0 bits.

A good tool to play with BIP39 and mnemonics is available here: https://iancoleman.io/bip39/.


Nice thank you! This resource is really cool.

A mnemonic is a representation of a seed. Calling

const wallet = Wallet.generateWalletFromMnemonic(mnemonic);

with the same mnemonic will yield the same Wallet object.

If you’d like to generate a random wallet, you should call:

const generationResult = Wallet.generateRandomWallet()
const newWallet = generationResult.wallet   // A new wallet object
const mnemonic = generationResult.mnemonic // A randomly generated mnemonic
const derivationPath = generationResult.derivationPath // The derivation path used to generate the random wallet. 

Under the hood, this function is implemented here:

1 Like

Solid! I appreciate you taking your time out to help. This is really exciting stuff.

1 Like