Public Parent to Public Child
Public Parent to Public Child
The most powerful feature of BIP32 is the ability to derive Child Public Keys from a Parent Public Key without ever needing the private keys. This enables a wide range of safe, non-custodial financial applications.
1. The Magic Equation
In standard ECDSA, you need the private key ($d$) to find the child private key. But in BIP32, we use a clever mathematical shortcut: $$ChildPubKey = ParentPubKey + [HMAC(ChainCode, ParentPubKey, Index) \times G]$$
-
Notice that only Public Information is used on the right side of the equation.
-
Chain Code: Publicly available in the
xpub. -
Parent PubKey: Publicly available in the
xpub. -
Index: The number of the child you want to generate.
2. Use Case: Merchant Services
Imagine you run an online store.
-
You generate a master
xpubin your secure hardware wallet. -
You export that
xpub(and ONLY thexpub) to your web server. -
When a customer buys something, the server uses the
xpubto generateChild Address #1. -
The next customer gets
Child Address #2. -
Security: Since the server has no private keys, a hacker who compromises the server cannot spend any funds. They can only see your history.
3. Use Case: Auditing
You can give your xpub to an accountant or a tax authority. They can see every transaction you have ever made and every address you own, but they have zero power to move your Bitcoin.
4. The Vulnerability: xpub + Private Key
There is one major security risk. If a thief gets your xpub AND one of your child private keys, they can perform a calculation to find your Master Private Key.
-
This only applies to Normal (Non-Hardened) derivation.
-
To prevent this, high-security wallets use Hardened Derivation for sensitive accounts.
| Requirement | Normal Derivation | Hardened Derivation |
|---|---|---|
| Input | xpub + Index |
xprv + Index |
| Privacy | Public children viewable | Children hidden |
| Safe for Servers? | Yes | No |
In the next section, we will discuss Serialization and Prefixes.
TeachMeBitcoin is an ad-free, open-source educational repository curated by a passionate team of Bitcoin researchers and educators for public benefit. If you found our articles helpful, please consider supporting our hosting and ongoing content updates with a clean donation: