Skip to content

Manage hierarchical deterministic keychain for bitcoin and altcoins.

License

Notifications You must be signed in to change notification settings

reckscott/hd-keychain

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Manage hierarchical deterministic keychain for bitcoin and altcoins.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages