Generated wallet address using:
let mnemonic = request.body.seed;
const wallet = EthHdWallet.fromMnemonic(mnemonic);
let address = wallet.generateAddresses(1);
console.log(wallet, address);
How can I recover wallet address using mnemonic
?
Ethereum Stack Exchange is a question and answer site for users of Ethereum, the decentralized application platform and smart contract enabled blockchain. It only takes a minute to sign up.
Sign up to join this communityYes - except using ethereumjs-wallet
not ethereumjs-utils
. Using the same mnemonic, with either supporting repo produces the same account address here:
const { EthHdWallet } = require('eth-hd-wallet')
var hdkey = require("ethereumjs-wallet/hdkey")
var bip39 = require("bip39");
const mnemonic = bip39.generateMnemonic(); //generates string
console.log(`mnemonic: ${mnemonic}`);
const wallet = EthHdWallet.fromMnemonic(mnemonic);
let address = wallet.generateAddresses(1);
console.log(`EthHdWallet Address: ${address}`);
bip39.mnemonicToSeed(mnemonic).then(seed =>{
// console.log(seed);
var path = `m/44'/60'/0'/0/0`;
var hdwallet = hdkey.fromMasterSeed(seed);
var wallet = hdwallet.derivePath(path).getWallet();
var address2 = "0x" + wallet.getAddress().toString("hex");
var privateKey = wallet.getPrivateKey().toString("hex");
console.log(`ethereumjs-wallet address: ${address2}`);
});
m/44'/60'/0'/0/0
to "m/44'/60'/0'/0/0" may be that effected!