This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const bip39 = require("bip39"); // mnemonic generator | |
| const hdkey = require("hdkey"); // wallet lib | |
| const ethUtil = require("ethereumjs-util"); // Used here for public address and public key generation | |
| const mnemonic = bip39.generateMnemonic(); // generates string | |
| const seed = bip39.mnemonicToSeedSync(mnemonic).toString('hex'); // creates seed for wallet | |
| const root = hdkey.fromMasterSeed(seed); | |
| const masterPrivateKey = root.privateKey.toString('hex'); |