HD wallet

Hierarchical Deterministic (or HD for short) is way of automatically generating new payment addresses based a series of special calculations.

clamshell with fingers

HD wallets generate a hierarchical tree-like structure of keys which start from the seed master key based on BIP 32. When you restore an HD wallet using the seed key, the wallet goes ahead and drives all the private keys of the tree using BIP 32.

While using an HD wallet, the backing up of the seed key is mandatory and should be kept safe so that you can restore your wallet in case your device is lost or damaged.

And this is the beauty of HD wallets. Taking a backup only once means that all subsequent addresses can easily be re-created mathematically from the algorithm. HD wallets use a one-way SHA-256 hash algorithm which produces this tree of keys without any error if the input (or seed key) is the same.

The hierarchical deterministic key creation and transfer protocol greatly simplifies wallet backups, eliminates the need for repeated communication between multiple programs using the same wallet, permits creation of child accounts which can operate independently, gives each parent account the ability to monitor or control its children even if the child account is compromised, and divides each account into full-access and restricted-access parts so untrusted users or programs can be allowed to receive or monitor payments without being able to spend them.

The HD protocol uses a single root seed to create a hierarchy of child, grandchild, and other descended keys with unlinkable deterministically-generated integer values. Each child key also gets a deterministically-generated seed from its parent, called a chain code, so the compromising of one chain code doesn’t necessarily compromise the integer sequence for the whole hierarchy, allowing the master chain code to continue being useful even if, for example, a web-based public keydistribution program gets hacked.

HD wallet prefixes

Example use Leading symbol(s) Example
BIP32 pubkey xpub xpub661MyMwAqRbcEYS8w7XLSVeEsBXy79zSzH1J8vCdxAZningWLdN3

zgtU6LBpB85b3D2yc8sfvZU521AAwdZafEz7mnzBBsz4wKY5e4cp9LB

BIP32 private key xprv xprv9s21ZrQH143K24Mfq5zL5MhWK9hUhhGbd45hLXo2Pq2oqzMMo63o

StZzF93Y5wvzdUayhgkkFoicQZcP3y52uPPxFnfoLZB21Teqt1VvEHx