i am starting to learn how to create a Dapp and i am trying to create a way for users to login without having to use metamask.

I am using truffle-hdwallet-provider which works fine for creating an account but i don't think i understand how it works.

I can create a new instance of a provider using:

const provider = new HDWalletProvider(mnemonic, network);

It will create an address no matter what string value i use for mnemonic. if a wallet can be created with any string value, then why does metamask enforce a 12 word mnemonic?

If an account can be created with a mnemonic, why does metamask ask for the private key if i want to import an account?

What is the functional difference between the mnemonic and the private key if both can get the same address?

Is it possible to use a private key to create an account on my app using HDWalletProvider i cant find any examples or documentation explaining this.

^^^ I have asked a few questions because i am new to this, any answers to any of the questions is appreciated.


The Mnemonic creates and extended private key (root key), that can create many private keys. https://iancoleman.io/bip39/ An extended private key can deterministicly generate millions of private keys, so that you can regenerate all those same addresses in the future as long as you have the extended private key or your mnemonic seed.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.