Keys, wallets & account abstraction

child key derivation

Child key derivation is the single step at the heart of every HD wallet: taking one parent key and an index number, and producing a specific child key. Repeat it down the levels of a derivation path and you get any address in the tree. The 'deterministic' promise of HD wallets is exactly this — same parent, same index, same child, every time, on every wallet.

There are two flavours, and the distinction is one of the most security-relevant details in all of wallet engineering. Non-hardened (normal) derivation mixes the parent's public key into the computation. Its superpower is that it can be done with only public data: an extended public key alone can roll out every receiving address, so an accounting server or point-of-sale terminal can generate fresh addresses without ever touching a private key. Hardened derivation instead mixes the parent's private key in, and is signalled by indices at or above 2^31 (written with an apostrophe, like 0').

Why bother with hardened keys at all? Because non-hardened derivation has a sharp edge. The same linear math that lets a public key derive child public keys means that if an attacker ever obtains both a parent extended public key and just one non-hardened child private key, they can algebraically subtract their way back to the parent private key — and from there, the whole sub-tree. Hardened derivation deliberately destroys that relationship, so a leak stays contained to the one leaked key. Standards therefore harden the structural levels (purpose, coin, account) and leave only the leaf address levels non-hardened, capturing the watch-only benefit while limiting the blast radius.

A shop runs a watch-only server holding the xpub for m/44'/60'/0'. It can derive m/44'/60'/0'/0/0, /0/1, /0/2 … to show each customer a unique payment address — but because the account level (0') is hardened, even a full compromise of that server cannot climb back up to spend any funds.

Rule of thumb: anything you might ever share as a watch-only xpub should sit below a hardened boundary. The danger is not the xpub by itself, but an xpub combined with a leaked child private key from the same non-hardened branch.

Also called
CKDhardened derivation強化衍生