Search code examples
dartethereum

How to generate a private key for Ethereum from the mnemonic?


I generated a new mnemonic using bip39 package: bip39.generateMnemonic(). There is the next step where I need to convert it into 64 characters of hex-string. I can make it using SHA-256 but it looks little weirdly because of I will apply ECDSA-256 and KECCAK-256 to generate a public key.

Is it right way to generate a private key from the mnemonic using SHA-256? Or should I use another hash-function?

P.S. I am a noobie in Ethereum system.


Solution

  • BIP-39 covers only the seed. You also need BIP-32 and BIP-44, as one seed generates several private and public key pairs, also known as hierarchical deterministic wallet.

    You can find more information in this blog post.