Understanding Hierarchical Deterministic (HD) Wallets in Ethereum

·

Introduction to HD Wallets

Hierarchical Deterministic Wallets (HD Wallets) are a cryptographic method for generating multiple cryptocurrency addresses from a single master seed. Originally introduced in Bitcoin's BIP-0032, this concept is widely used in Ethereum, where you might encounter strings like m/44'/60'/0'/0—part of a derivation path.

Key Features:

Motivation Behind HD Wallets

Problems with Non-Deterministic Wallets:

Advantages of Deterministic Wallets:

Key Insight: Deterministic wallets allow generating addresses "on-the-fly" while maintaining full control via the master private key.

Technical Specification: Key Derivation

Core Components:

Child Key Derivation (CKD):

  1. Parent Private Key → Child Private Key

    • Uses HMAC-SHA512 with the parent chain code and index i.
    • For hardened keys (i ≥ 2³¹), prepends 0x00 to the parent private key.
    • For normal keys, uses the parent public key.
  2. Parent Public Key → Child Public Key

    • Only works for non-hardened keys (i < 2³¹).
    • Fails if attempting hardened derivation (security feature).
  3. Parent Private Key → Child Public Key

    • Two equivalent methods:

      • Derive child private key first, then compute its public key (N(CKDpriv(...))).
      • Directly derive from parent public key (CKDpub(N(...))).
  4. Parent Public Key → Child Private Key

    • Impossible—ensures security against reverse engineering.

Key Tree Notation:


BIP-44: Multi-Currency HD Wallets

Path Structure:

m / purpose' / coin_type' / account' / change / address_index

Account Discovery Algorithm:

  1. Start with account = 0.
  2. Scan 20 consecutive unused addresses on the external chain.
  3. If transactions exist, increment account and repeat.
Security Note: Prevents unused accounts from cluttering the wallet.

FAQs

Q1: Why use hardened derivation?
A1: Prevents parent private key exposure if a child key is compromised. Non-hardened keys allow deriving siblings if one key is known.

Q2: What’s the purpose of the chain code?
A2: Adds entropy to ensure child keys aren’t predictable solely from the parent key.

Q3: Can I derive Ethereum addresses from a Bitcoin HD wallet?
A3: Yes! Use coin_type = 60' in the derivation path for Ethereum.

Q4: How does BIP-44 improve privacy?
A4: Separates coins/accounts to avoid address reuse, making transactions harder to trace.

👉 Explore advanced HD wallet implementations


Conclusion

HD wallets revolutionize cryptocurrency management by:

For Ethereum developers, mastering paths like m/44'/60'/0'/0 is crucial for secure address generation.

👉 Dive deeper into blockchain security

References: