/* Author: Robert Lie (mobilefish.com) More information about this file, see: https://www.mobilefish.com/developer/blockchain/blockchain_quickguide_ethereum_tools.html Usage: - Generate the public addresses and private keys based on the mnemonic words. - Rename this file to bip44_mnemonic_example2.js - Run this script, type: bip44_mnemonic_example2.js */ var Mnemonic = require('bitcore-mnemonic'); var EthereumBip44 = require('ethereum-bip44'); var secret = "venture around leisure ocean census obey theory spring buzz stick donor broom"; var code = new Mnemonic(secret, Mnemonic.Words.ENGLISH); console.log(code.toString()); var HDPrivateKey = code.toHDPrivateKey(); // create the hd wallet var wallet = EthereumBip44.fromPrivateSeed(HDPrivateKey.toString()); // output the first address and private key console.log("Public address 0: " + wallet.getAddress(0)); console.log("Private key 0: " + wallet.getPrivateKey(0).toString('hex')); // output the second address and private key console.log("Public address 1: " + wallet.getAddress(1)); console.log("Private key 1: " + wallet.getPrivateKey(1).toString('hex'));