hd-keychain
v1.0.1
Published
Manage hierarchical deterministic keychain for bitcoin and altcoins.
Downloads
15
Maintainers
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