#
HD Wallet

TODO: Explain BIP32 BIP-39 and whatnot here...

##
Types

###
Constants
source

ethers . utils . defaultPath ⇒ "m/44'/60'/0'/0/0"

The default path for Ethereum in an HD Wallet

###
Mnemonic

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`.

mnemonic . path ⇒ string

The HD path for this mnemonic.

mnemonic . locale ⇒ string

The language of the wordlist this mnemonic is using.

##
HDNode
source

###
Creating Instances

ethers . HDNode . fromMnemonic ( phrase [ , password [ , wordlist ] ] ) ⇒ HDNode
source

Return the HDNode for phrase with the optional password and wordlist.

ethers . HDNode . fromSeed ( aBytesLike ) ⇒ HDNode
source

Return the HDNode for the seed aBytesLike.

ethers . HDNode . fromExtendedKey ( extendedKey ) ⇒ HDNode
source

Return the HDNode for the extendedKey. If extendedKey was neutered, the HDNode will only be able to compute addresses and not private keys.

###
Properties

hdNode . privateKey ⇒ string<DataHexstring< 32 > >

The private key for this HDNode.

hdNode . publicKey ⇒ string<DataHexstring< 33 > >

The (compresses) public key for this HDNode.

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.

hdNode . parentFingerprint ⇒ string<DataHexstring< 4 > >

The fingerprint of the parent node. See fingerprint for more details.

Most developers will not need to use this.

hdNode . address ⇒ string<Address>

The address of this HDNode.

hdNode . mnemonic ⇒ Mnemonic

The mnemonic of this HDNode, if known.

hdNode . path ⇒ string

The path of this HDNode, if known. If the mnemonic is also known, this will match `mnemonic.path`.

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.

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.

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.

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.

###
Methods

hdNode . neuter ( ) ⇒ HDNode
source

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.

hdNode . derivePath ( path ) ⇒ HDNode
source

Return a new HDNode which is the child of hdNode found by deriving path.

##
Other Functions

ethers . utils . mnemonicToSeed ( phrase [ , password ] ) ⇒ string<DataHexstring< 64 > >
source

Convert a mnemonic phrase to a seed, according to BIP-39.

ethers . utils . mnemonicToEntropy ( phrase [ , wordlist ] ) ⇒ string<DataHexstring>
source

Convert a mnemonic phrase to its entropy, according to BIP-39.

ethers . utils . isValidMnemonic ( phrase [ , wordlist ] ) ⇒ boolean
source

Returns true if phrase is a valid mnemonic phrase, by testing the checksum.

The content of this site is licensed under the Creative Commons Attribution 4.0 International License.