I'm trying to create an ethereum account using web3-js by providing a mnemonic + passphrase (created with BIP39-js) but can't seem to find an implementation of web3.eth.accounts.create() that accepts both the mnemonic and the passphrase.

Is it not supported or am I missing something on how to implement it?

4 Answers 4


Do it with ethers:

const ethers = require('ethers');
const mnemonic = await ethers.HDNode.entropyToMnemonic(ethers.utils.randomBytes(16));
const wallet = ethers.Wallet.fromMnemonic(mnemonic);


Here is a community you can find ask more questions about it:

  • 1
    In the meantime it is: ethers.utils.HDNode.entropyToMnemonic
    – heinob
    Feb 17, 2019 at 5:41
  • OP mentioned mnemonic + passphrase: there's no passphrase in there. how is this the accepted answer ?
    – Syffys
    Jan 12 at 13:49

Just in case someone comes here later, in the recent version of ethers, HDNODE has been moved to the utils method. So, in modification to @George's answer above;

const ethers = require('ethers');
const mnemonic = await ethers.utils.HDNode.entropyToMnemonic(ethers.utils.randomBytes(16));
const wallet = ethers.Wallet.fromMnemonic(mnemonic);

You can use ethers Lib: https://www.npmjs.com/package/ethers

import { ethers } from "ethers";

newWallet = async () => {
    let password = prompt("Password");

    if (password) {
      var randomSeed = ethers.Wallet.createRandom();


      function callback(progress) {
        console.log("Encrypting: " + parseInt(progress * 100) + "% complete");

      let encryptPromise = randomSeed.encrypt(password, callback);

      encryptPromise.then(function (json) {

you can create a wallet & restore from mnemonic with ethers:

this is updated code

const ethers = require("ethers");
const wallet = ethers.Wallet.createRandom();

console.log("address:", wallet.address);
console.log("mnemonic:", wallet.mnemonic.phrase);
console.log("privateKey:", wallet.privateKey);

const accountFromMnemonic = ethers.Wallet.fromMnemonic(wallet.mnemonic.phrase);
console.log("accountFromMnemonic", accountFromMnemonic.address);
  • As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.
    – Community Bot
    Jun 24 at 5:57

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.