hd-keychain

1.0.1 • Public • Published

HD Keychain

npm NPM Downloads Try on RunKit

Manage hierarchical deterministic keychain for bitcoin and altcoins.

Installation

npm i --save hd-keychain

Usage

Create a new keychain with random seed

var keychain = new HDKeychain();

Create a keychain from hex string seed

var keychain = HDKeychain.fromSeedHex(seedHex);

Create a keychain from mnemonic string seed

var keychain = HDKeychain.fromSeedMnemonic(seedMnemonic);

Export seed as hex string

var seedHex = keychain.toSeedHex();
console.log(seedHex);

Export seed as mnemonic string

var seedMnemonic = keychain.toSeedMnemonic();
console.log(seedMnemonic);

Derive a key for bitcoin testnet

var key = keychain.deriveKey(
  'bitcoin',  // coin type
  0,          // account
  false,      // change
  0,          // index
  {testnet: true}
);
console.log(key.address);
console.log(key.privateKey);

License

MIT

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.1
    0
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.1
    0

Package Sidebar

Install

npm i hd-keychain

Weekly Downloads

0

Version

1.0.1

License

MIT

Last publish

Collaborators

  • rscott