A Developer's Guide to Change Addresses & HD Wallets
📌 Introduction
As I'm currently developing my own Bitcoin wallet application in Rust, I began to wonder — why do wallets often generate multiple addresses instead of reusing the same one? This curiosity led me to explore the underlying design principles of modern wallets. In this post, I want to share what I’ve learned in a friendly and practical way, especially from a developer’s perspective.
If you're building a Bitcoin wallet — CLI, GUI, or embedded — one thing might surprise you:
Wallets often generate a new address for every transaction, even though the wallet belongs to the same user.
Why not just reuse the same address over and over?
In this post, we'll break down the technical and security reasons behind that choice. We’ll explore:
- What are change addresses, and why are they essential?
- What are HD (Hierarchical Deterministic) wallets, and how do they work?
- Why using multiple addresses is standard best practice in wallet architecture
🪙 1. Why Use Multiple Addresses?
Modern wallets use many addresses because:
Reason | Why it matters |
---|---|
🔐 Privacy | Prevents others from linking all transactions to a single identity |
🤁 Change Handling | Bitcoin UTXOs must be fully spent; leftover funds go to a change address |
📉 HD Wallets | Wallets can generate unlimited secure addresses from one seed |
🔍 Organization | Devs can label addresses for different purposes (donations, savings, etc.) |
🤁 2. What Is a Change Address?
When you spend Bitcoin, you can’t just “partially spend” a UTXO.
💡 Example:
Let’s say you have this UTXO:
- 📥 Input:
0.5 BTC
And you want to send:
- 💸 0.2 BTC to someone else
Your wallet does this:
INPUT: 0.5 BTC
↓
OUTPUTS:
• 0.2 BTC → Recipient address
• 0.299 BTC → 🔐 New internal change address
• 0.001 BTC → Miner fee
The 0.299 BTC is sent back to you, but not to the same address — instead, to a new one your wallet creates internally.
🧠 Why?
- Prevents blockchain analysis from easily linking all your UTXOs
- Adds a layer of privacy and improves wallet hygiene
- Keeps each UTXO clearly isolated
🌱 3. What Is an HD Wallet?
HD (Hierarchical Deterministic) wallets generate many addresses and private keys from one seed phrase.
🔐 How it works:
- You create a 12- or 24-word mnemonic phrase (BIP-39)
- That seed generates a master private key
- From this, you can deterministically derive:
- 🔑 Multiple accounts
- 📧 External receiving addresses
- 🤁 Internal change addresses
🔗 Standards used:
- BIP-32: HD key structure
- BIP-39: Mnemonic generation
- BIP-44: Multicoin/multi-account paths
🧬 Tree example:
m/44'/0'/0'/0/0 ← 1st receiving address
m/44'/0'/0'/1/0 ← 1st change address
m/44'/0'/0'/0/1 ← 2nd receiving address
With HD wallets, you only need to back up one seed phrase to recover everything.
🌍 Why They Are the Industry Standard
Today, most modern wallets — including hardware wallets (Ledger, Trezor), mobile wallets (BlueWallet, Muun), and full-featured clients (Electrum, Sparrow) — all use HD wallet architecture.
The benefits include:
- Easier wallet backup and recovery
- Better privacy from address reuse
- Compatibility with wallet import/export tools
- Scalability for wallets that manage hundreds or thousands of addresses
If you're building for real-world usage, supporting HD wallets is not just recommended — it's essential.
✨ Note on Cardano HD Wallets
Cardano also uses HD wallets, but with its own extended format tailored for its architecture. Its path is:
m / 1852' / 1815' / account' / role / index
-
1852'
: Purpose (Cardano HD Wallet v2) -
1815'
: Coin type for Cardano (SLIP-0044) -
role
: 0 = external, 1 = internal (change) - Like Bitcoin, it uses BIP-32 and BIP-39, but also introduces enhancements for delegation and staking.
Cardano's HD wallet structure allows secure, recoverable, and scalable wallet systems just like Bitcoin, and is widely supported in wallets like Yoroi, Daedalus, and hardware wallets.
✅ Conclusion
Multiple addresses aren't just a cosmetic choice — they are a security and privacy design feature.
By understanding change addresses and HD wallets, you:
- Write safer, smarter wallet code
- Follow Bitcoin best practices
- Prepare your app for production-level use
🧠 my curiocity
- Generate HD wallet addresses from a seed
- Implement change address logic in your CLI
- Load/save wallet data to a file
- Explore how Cardano handles staking and delegation in its HD structure