untitled notebook

node v8.11.1
version: master
endpointsharetweet
// ----------------------------------- // Creates a wallet. // Returns (1) Public key (2) Secret password/word list // ----------------------------------- const HDWalletProvider = require("truffle-hdwallet-provider"); const hdkey = require("ethereumjs-wallet/hdkey"); const bip39 = require("bip39"); const hdWalletPath = `m/44'/60'/0'/0`; require("bignumber.js") let words = bip39.generateMnemonic(); let seed = bip39.mnemonicToSeed(words, ''); let hdWallet = hdkey.fromMasterSeed(seed); let rootWallet = hdWallet.derivePath(hdWalletPath); let wallet = rootWallet.deriveChild(0).getWallet(); let address = wallet.getAddressString(); console.log(`Address 0: ${address.toString('hex')}`);
Loading…

no comments

    sign in to comment