1

How to get public and private key of wallet by password and mnemonic in NodeJS.

1 Answers1

0

You can use the function fromMnemonic in ethers.js. The next code snippet is from the docs:

let mnemonic = "radar blur cabbage chef fix engine embark joy scheme fiction master release";
let mnemonicWallet = ethers.Wallet.fromMnemonic(mnemonic);

Then you can access the address and the private key with:

mnemonicWallet.address // "0x..."
mnemonicWallet.privateKey // "0x..."

As I said, it´s all in the docs

Edgar P-Yan
  • 103
  • 2