HD Wallet Accounts
Last updated 2 years ago by techbubble .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install hdwallet-accounts 
SYNC missed versions from official npm registry.


The Hierarchical Deterministic (HD) key creation and transfer protocol (BIP32), allows creating child keys from parent keys in a hierarchy. Wallets using the HD protocol are called HD wallets.

When using such a wallet for development of Ethereum Smart Contracts, it is often necessary to test code using multiple accounts to simulate different users. In such situations, HDWalletAccounts can be used to quickly get an array of accounts and their corresponding public and private keys.


$ npm install hdwallet-accounts

General Usage

You can use this package in any Javascript app where Ethereum account generation is required. If you are using Truffle and Ganache, then this package is useful in test scripts because the commonly used HDWalletProvider will only return one account (the first, unless you override it in truffle.js).

let HDWalletAccounts = require("hdwallet-accounts");

// 12 word mnemonic
let mnemonic = "myth slice august trophy letter display elephant accuse absorb enjoy hawk course"; 

// Generate 10 accounts using the mnemonic
let walletAccounts = HDWalletAccounts(10, mnemonic);

// Or, alternatively skip the mnemonic and have one auto-created
let walletAccounts = HDWalletAccounts(10);
console.log('Mnemonic:', walletAccounts.mnemonic);
console.log('Account-00 Address:', walletAccounts.accounts[0].address);
console.log('Account-00 Private Key:', walletAccounts.accounts[0].privateKey);
console.log('Account-00 Public Key:', walletAccounts.accounts[0].publicKey);


  • count: number. Number of accounts to generate. Defaults to 10.
  • mnemonic: string. 12-word mnemonic from which accounts are created. Auto-generated if not specified.

Truffle Usage

You can easily use this within a Truffle configuration. In fact, this package was created to make Ganache accounts available in Truffle test scripts.


let HDWalletAccounts = require("hdwallet-accounts");
let walletAccounts = HDWalletAccounts(10, web3.currentProvider.mnemonic);

Current Tags

  • 0.0.1                                ...           latest (2 years ago)

1 Versions

  • 0.0.1                                ...           2 years ago
Maintainers (1)
Today 0
This Week 1
This Month 2
Last Day 0
Last Week 1
Last Month 4
Dependencies (2)
Dev Dependencies (0)

Copyright 2014 - 2017 © taobao.org |