Package Exports
- hd-keychain
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (hd-keychain) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
HD Keychain
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