new HDPrivateKey(options)
HDPrivateKey
Parameters:
Name | Type | Description | ||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object | Base58String |
Properties
|
Properties:
Name | Type | Attributes | Description |
---|---|---|---|
networkType |
String | ||
xprivkey |
Base58String | ||
xpubkey |
Base58String | ||
seed |
HDSeed |
<nullable> |
|
version |
Number | ||
depth |
Number | ||
parentFingerPrint |
Buffer | ||
childIndex |
Number | ||
chainCode |
Buffer | ||
privateKey |
Buffer | ||
hdPublicKey |
HDPublicKey | ||
isPrivate |
Boolean | ||
isPublic |
Boolean |
- Source:
Methods
(static) _fromJSON(json) → {Object}
Handle a deserialized JSON HDPrivateKey object.
Parameters:
Name | Type | Description |
---|---|---|
json |
Object |
- Source:
Returns:
A "naked" HDPrivateKey (a plain javascript object which is suitable for passing to the HDPrivateKey constructor).
- Type
- Object
(static) _fromSeed(seed, networkTypenullable) → {Object}
Create an hd private key from a seed.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
seed |
HDSeed | ||
networkType |
String |
<nullable> |
- Source:
Returns:
A "naked" key (a plain javascript object which is suitable for passing to the HDPrivateKey constructor).
- Type
- Object
(static) _generate(optionsnullable, networkTypenullable) → {Object}
Generate an hd private key from a key and/or entropy bytes.
Parameters:
Name | Type | Attributes | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object |
<nullable> |
Properties
|
||||||||||||
networkType |
String |
<nullable> |
- Source:
Returns:
A "naked" key (a plain javascript object which is suitable for passing to the HDPrivateKey constructor).
- Type
- Object
(static) _getIndexes() → {Array.<Number>}
Parse a derivation path and return an array of indexes.
Returns:
- Type
- Array.<Number>
(static) fromBase58(xkey) → {HDPrivateKey}
Instantiate a transaction from a base58 string.
Parameters:
Name | Type | Description |
---|---|---|
xkey |
Base58String |
- Source:
Returns:
- Type
- HDPrivateKey
(static) fromJSON(json, passphrasenullable) → {HDPrivateKey}
Instantiate an HDPrivateKey from a jsonified key object.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
json |
Object | The jsonified transaction object. |
|
passphrase |
String |
<nullable> |
- Source:
Returns:
- Type
- HDPrivateKey
(static) fromSeed(options, networkTypenullable) → {HDPrivateKey}
Instantiate a transaction from an HD seed.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
options |
HDSeed | Object | An HD seed or HD seed options. |
|
networkType |
String |
<nullable> |
- Source:
Returns:
- Type
- HDPrivateKey
(static) generate(optionsnullable, networkTypenullable) → {HDPrivateKey}
Generate an hd private key from a key and/or entropy bytes.
Parameters:
Name | Type | Attributes | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object |
<nullable> |
Properties
|
||||||||||||
networkType |
String |
<nullable> |
- Source:
Returns:
- Type
- HDPrivateKey
(static) isExtended(data) → {Boolean}
Test whether an object is in the form of a base58 xprivkey.
Parameters:
Name | Type | Description |
---|---|---|
data |
String |
- Source:
Returns:
- Type
- Boolean
(static) isHDPrivateKey(obj) → {Boolean}
Test an object to see if it is a HDPrivateKey.
Parameters:
Name | Type | Description |
---|---|---|
obj |
Object |
- Source:
Returns:
- Type
- Boolean
(static) isValidPath(path, hardenednullable) → {Boolean}
Test whether a string is a valid path.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
path |
String | ||
hardened |
Boolean |
<nullable> |
- Source:
Returns:
- Type
- Boolean
(static) parse(xkey) → {Object}
Parse a base58 extended private key.
Parameters:
Name | Type | Description |
---|---|---|
xkey |
Base58String |
- Source:
Returns:
- Type
- Object
(static) render(data) → {Base58String}
Serialize key data to base58 extended key.
Parameters:
Name | Type | Description |
---|---|---|
data |
Object | HDPrivateKey |
- Source:
Returns:
- Type
- Base58String
derive(index, hardenednullable) → {HDPrivateKey}
Derive a child key.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
index |
Number | String | Child index or path. |
|
hardened |
Boolean |
<nullable> |
Whether the derivation should be hardened. |
- Source:
Returns:
- Type
- HDPrivateKey
deriveAccount44(accountIndex) → {HDPrivateKey}
Derive a BIP44 account key.
Parameters:
Name | Type | Description |
---|---|---|
accountIndex |
Number |
- Source:
Throws:
Error if key is not a master key.
Returns:
- Type
- HDPrivateKey
derivePath(path) → {HDPrivateKey}
Derive a key from a derivation path.
Parameters:
Name | Type | Description |
---|---|---|
path |
String |
- Source:
Throws:
Error if path
is not a valid path.
Returns:
- Type
- HDPrivateKey
derivePurpose45() → {HDPrivateKey}
Derive a BIP45 purpose key.
- Source:
Returns:
- Type
- HDPrivateKey
isAccount44() → {Boolean}
Test whether the key is (most likely) a BIP44 account key.
- Source:
Returns:
- Type
- Boolean
isPurpose45() → {Boolean}
Test whether the key is a BIP45 purpose key.
- Source:
Returns:
- Type
- Boolean
toJSON(passphrasenullable) → {Object}
Convert key to a more json-friendly object.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
passphrase |
String |
<nullable> |
Address passphrase |
- Source:
Returns:
- Type
- Object
toSecret() → {Base58String}
Convert HDPrivateKey to CBitcoinSecret.
- Source:
Returns:
- Type
- Base58String