How to convert seeds into private key?

1.5k Views Asked by At

how to convert bip39 mnemonic seed phrase into private key without any libraries like web3 or ethers.js
basically I'm trying to replicate my metamasks wallets private key

so I would like to write a function that takes my seed words as my input and return the private key for ethereum based wallets

privateKey = function([seed_1, seed_2, ..., seed_12]);

Where do I get started?

1

There are 1 best solutions below

0
On

@elangovan you can use dart's BIP32 implementation and follow below steps

  1. Convert Mnemonic(12 words) to seed using bip32.mnemonicToSeed
  2. Seedto HD Master Node using bip32.BIP32.fromSeed
  3. Derive child node at desired HD path(m/44'/0')

However, you can derive public and private keys from the child node.