126 lines
4.2 KiB
Plaintext
126 lines
4.2 KiB
Plaintext
|
_section: HD Wallet
|
||
|
|
||
|
TODO: Explain [BIP32](link-bip-32) [BIP-39](link-bip-39) and whatnot here...
|
||
|
|
||
|
_subsection: Types
|
||
|
|
||
|
_heading: Constants @<hdnode-defaultpath> @SRC<hdnode:defaultPath>
|
||
|
|
||
|
_property: ethers.utils.defaultPath => "m/44'/60'/0'/0/0"
|
||
|
The default path for Ethereum in an HD Wallet
|
||
|
|
||
|
|
||
|
_heading: Mnemonic @<hdnode-mnemonic>
|
||
|
|
||
|
_property: mnemonic.phrase => string
|
||
|
The mnemonic phrase for this mnemonic. It is 12, 15, 18, 21 or 24 words long
|
||
|
and separated by the whitespace specified by the ``locale``.
|
||
|
|
||
|
_property: mnemonic.path => string
|
||
|
The HD path for this mnemonic.
|
||
|
|
||
|
_property: mnemonic.locale => string
|
||
|
The language of the wordlist this mnemonic is using.
|
||
|
|
||
|
|
||
|
_subsection: HDNode @<hdnode> @SRC<hdnode:class.HDNode>
|
||
|
|
||
|
_heading: Creating Instances
|
||
|
|
||
|
_property: ethers.HDNode.fromMnemonic(phrase [, password [, wordlist ] ]) => [[hdnode]] @SRC<hdnode>
|
||
|
Return the [[hdnode]] for //phrase// with the optional //password//
|
||
|
and //wordlist//.
|
||
|
|
||
|
_property: ethers.HDNode.fromSeed(aBytesLike) => [[hdnode]] @SRC<hdnode>
|
||
|
Return the [[hdnode]] for the seed //aBytesLike//.
|
||
|
|
||
|
_property: ethers.HDNode.fromExtendedKey(extendedKey) => [[hdnode]] @SRC<hdnode>
|
||
|
Return the [[hdnode]] for the //extendedKey//. If //extendedKey// was
|
||
|
neutered, the **HDNode** will only be able to compute addresses and not
|
||
|
private keys.
|
||
|
|
||
|
|
||
|
_heading: Properties
|
||
|
|
||
|
_property: hdNode.privateKey => string<[[datahexstring]]<32>>
|
||
|
The private key for this HDNode.
|
||
|
|
||
|
_property: hdNode.publicKey => string<[[datahexstring]]<33>>
|
||
|
The (compresses) public key for this HDNode.
|
||
|
|
||
|
_property: hdNode.fingerprint => string<[[datahexstring]]<4>>
|
||
|
The fingerprint is meant as an index to quickly match parent and
|
||
|
children nodes together, however collisions may occur and software
|
||
|
should verify matching nodes.
|
||
|
|
||
|
Most developers will not need to use this.
|
||
|
|
||
|
_property: hdNode.parentFingerprint => string<[[datahexstring]]<4>>
|
||
|
The fingerprint of the parent node. See //fingerprint// for more
|
||
|
details.
|
||
|
|
||
|
Most developers will not need to use this.
|
||
|
|
||
|
_property: hdNode.address => string<[[address]]>
|
||
|
The address of this HDNode.
|
||
|
|
||
|
_property: hdNode.mnemonic => [[hdnode-mnemonic]]
|
||
|
The mnemonic of this HDNode, if known.
|
||
|
|
||
|
_property: hdNode.path => string
|
||
|
The path of this HDNode, if known. If the //mnemonic// is also known,
|
||
|
this will match ``mnemonic.path``.
|
||
|
|
||
|
_property: hdNode.chainCode => string<[[datahexstring]]<32>>
|
||
|
The chain code is used as a non-secret private key which is then used
|
||
|
with EC-multiply to provide the ability to derive addresses without
|
||
|
the private key of child non-hardened nodes.
|
||
|
|
||
|
Most developers will not need to use this.
|
||
|
|
||
|
_property: hdNode.index => number
|
||
|
The index of this HDNode. This will match the last component of
|
||
|
the //path//.
|
||
|
|
||
|
Most developers will not need to use this.
|
||
|
|
||
|
_property: hdNode.depth => number
|
||
|
The depth of this HDNode. This will match the number of components
|
||
|
(less one, the ``m/``) of the //path//.
|
||
|
|
||
|
Most developers will not need to use this.
|
||
|
|
||
|
_property: hdNode.extendedKey => string
|
||
|
A serialized string representation of this HDNode. Not all properties
|
||
|
are included in the serialization, such as the mnemonic and path, so
|
||
|
serializing and deserializing (using the ``fromExtendedKey`` class
|
||
|
method) will result in reduced information.
|
||
|
|
||
|
|
||
|
_heading: Methods
|
||
|
|
||
|
_property: hdNode.neuter() => [[hdnode]] @SRC<hdnode>
|
||
|
Return a new instance of //hdNode// with its private key removed
|
||
|
but all otehr properties preserved. This ensures that the key
|
||
|
can not leak the private key of itself or any derived children,
|
||
|
but may still be used to compute the addresses of itself and
|
||
|
any non-hardened children.
|
||
|
|
||
|
_property: hdNode.derivePath(path) => [[hdnode]] @SRC<hdnode>
|
||
|
Return a new [[hdnode]] which is the child of //hdNode// found
|
||
|
by deriving //path//.
|
||
|
|
||
|
|
||
|
|
||
|
_subsection: Other Functions
|
||
|
|
||
|
_property: ethers.utils.mnemonicToSeed(phrase [ , password]) => string<[[datahexstring]]<64>> @SRC<hdnode>
|
||
|
Convert a mnemonic phrase to a seed, according to [BIP-39](link-bip-39).
|
||
|
|
||
|
_property: ethers.utils.mnemonicToEntropy(phrase [ , wordlist ]) => string<[[datahexstring]]> @SRC<hdnode>
|
||
|
Convert a mnemonic phrase to its entropy, according to [BIP-39](link-bip-39).
|
||
|
|
||
|
_property: ethers.utils.isValidMnemonic(phrase [ , wordlist ]) => boolean @SRC<hdnode>
|
||
|
Returns true if //phrase// is a valid mnemonic phrase, by
|
||
|
testing the checksum.
|