new HDPublicKey(options)
HDPublicKey
Parameters:
Name | Type | Description | ||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object | Base58String |
Properties
|
Properties:
Name | Type | Description |
---|---|---|
network |
String | |
xpubkey |
Base58String | |
depth |
Number | |
parentFingerPrint |
Buffer | |
childIndex |
Number | |
chainCode |
Buffer | |
publicKey |
Buffer |
- Source:
Members
(static) parseJSON
Handle a deserialized JSON HDPublicKey object.
- Source:
Methods
(static) fromBase58(xkey) → {HDPublicKey}
Instantiate a transaction from a base58 string.
Parameters:
Name | Type | Description |
---|---|---|
xkey |
Base58String |
- Source:
Returns:
- Type
- HDPublicKey
(static) fromJSON(json) → {HDPrivateKey}
Instantiate an HDPrivateKey from a jsonified key object.
Parameters:
Name | Type | Description |
---|---|---|
json |
Object | The jsonified transaction object. |
- Source:
Returns:
- Type
- HDPrivateKey
(static) fromRaw(raw) → {HDPublicKey}
Instantiate key from serialized data.
Parameters:
Name | Type | Description |
---|---|---|
raw |
Buffer |
- Source:
Returns:
- Type
- HDPublicKey
(static) hasPrefix(data) → {NetworkType}
Test whether a buffer has a valid network prefix.
Parameters:
Name | Type | Description |
---|---|---|
data |
Buffer |
- Source:
Returns:
- Type
- NetworkType
(static) isExtended(data) → {Boolean}
Test whether an object is in the form of a base58 xpubkey.
Parameters:
Name | Type | Description |
---|---|---|
data |
String |
- Source:
Returns:
- Type
- Boolean
(static) isHDPublicKey(obj) → {Boolean}
Test whether an object is a HDPublicKey.
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) parseBase58(xkey) → {Object}
Parse a base58 extended public key.
Parameters:
Name | Type | Description |
---|---|---|
xkey |
Base58String |
- Source:
Returns:
- Type
- Object
(static) parseRaw(raw) → {Object}
Parse a raw serialized key.
Parameters:
Name | Type | Description |
---|---|---|
raw |
Buffer |
- Source:
Returns:
- Type
- Object
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 (throws if true). |
- Source:
Throws:
on hardened
Returns:
- Type
- HDPrivateKey
deriveAccount44(accountIndex) → {HDPublicKey}
Derive a BIP44 account key (does not derive, only ensures account key).
Parameters:
Name | Type | Description |
---|---|---|
accountIndex |
Number |
- Source:
Throws:
Error if key is not already an account key.
Returns:
- Type
- HDPublicKey
derivePath(path) → {HDPublicKey}
Derive a key from a derivation path.
Parameters:
Name | Type | Description |
---|---|---|
path |
String |
- Source:
Throws:
-
Error if
path
is not a valid path. -
Error if hardened.
Returns:
- Type
- HDPublicKey
derivePurpose45() → {HDPublicKey}
Derive a BIP45 purpose key (does not derive, only ensures account key).
- Source:
Throws:
Error if key is not already a purpose key.
Returns:
- Type
- HDPublicKey
equal(obj) → {Boolean}
Compare a key against an object.
Parameters:
Name | Type | Description |
---|---|---|
obj |
Object |
- Source:
Returns:
- Type
- Boolean
isAccount44(accountIndexnullable) → {Boolean}
Test whether the key is (most likely) a BIP44 account key.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
accountIndex |
Number |
<nullable> |
- Source:
Returns:
- Type
- Boolean
isMaster() → {Boolean}
Test whether the key is a master key.
- Source:
Returns:
- Type
- Boolean
isPurpose45() → {Boolean}
Test whether the key is a BIP45 purpose key.
- Source:
Returns:
- Type
- Boolean
toBase58(network) → {Base58String}
Serialize key data to base58 extended key.
Parameters:
Name | Type | Description |
---|---|---|
network |
Network | String |
- Source:
Returns:
- Type
- Base58String
toJSON() → {Object}
Convert key to a more json-friendly object.
- Source:
Returns:
- Type
- Object
toRaw(network) → {Buffer}
Serialize the key.
Parameters:
Name | Type | Description |
---|---|---|
network |
Network | NetworkType |
- Source:
Returns:
- Type
- Buffer