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


1 Answer 1


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

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