Interactive teaching aid for understanding hash functions, key derivation, and HD wallets
Before diving into the cryptographic details, this visual metaphor captures the essential properties of a Bitcoin wallet:
All balances are visible on the blockchain. Anyone can query an address's UTXO set.
The address (derived from public key) allows anyone to send funds — a one-way operation.
Only the holder of the 256-bit private key can sign transactions to spend the funds.
Addresses are not inherently linked to identities. Ownership is proven cryptographically, not administratively.
In Bitcoin, SHA-256 is the core hash function. It takes any input and produces a fixed 256-bit output that appears completely random, yet is entirely deterministic.
Imagine putting fruit into a sealed industrial blender and pressing blend for exactly 10 seconds. You get a smoothie. Now add one grain of salt and blend again for the same time. You don't get a "slightly different" smoothie — you get something completely unrecognisable from the first. Hash functions are designed to behave exactly like this.
Throw a bucket of paint at a wall. Now move your hand just 1mm to the left and throw again. The final splatter pattern is totally different, even though your starting motion barely changed. This is the avalanche effect — tiny input changes cause massive output changes.
Green = same bit, Red = different bit
In Bitcoin, your funds are controlled by a private key. From this single secret number, we can mathematically derive a public key, and from that, a Bitcoin address.
Think of your private key as a unique key that fits a special lock. Anyone can look at the lock (public key) and verify it's yours, but only you can open it. The mathematical relationship is like a lock that's trivially easy to close but practically impossible to pick.
Your private key is like a unique rubber stamp with an intricate pattern. You can stamp documents (sign transactions) and everyone can verify the stamp matches your registered pattern (public key), but no one can recreate your stamp just by looking at the impressions it leaves.
Public Key = Private Key × GAddress = Base58Check(version + RIPEMD160(SHA256(publicKey)))A Hierarchical Deterministic (HD) wallet starts with one master seed and can derive thousands of private keys. Each key is cryptographically isolated — knowing one reveals nothing about the others.
Imagine a magic book where:
You can regenerate every page from page 1, but from any single page you cannot infer the others. That's an HD wallet.
The seed is the root. Each child key is derived using the parent key, an index number, and a hash function. Because hashing has the avalanche effect:
| Benefit | Explanation |
|---|---|
| Privacy | Observers cannot tell that two addresses belong to the same wallet |
| Backup Simplicity | One seed phrase (12-24 words) backs up ALL your keys forever |
| Security | Leaking one private key does not compromise the others |
| Organisation | Keys can be organised hierarchically (accounts, purposes, etc.) |
Notice how each key looks completely unrelated to the others, despite coming from the same seed.
| Property | Hash Functions | Key Derivation | HD Wallets |
|---|---|---|---|
| Deterministic | Yes - same input = same output | Yes - same private key = same public key | Yes - same seed = same keys |
| Avalanche Effect | ~50% bits flip with tiny change | Different private key = unrelated public key | index 1 vs index 2 = unrelated keys |
| Appears Random | Output indistinguishable from random | Public keys appear random | Derived keys appear unrelated |
| One-Way (Irreversible) | Cannot find input from output | Cannot find private from public | Cannot find seed from single key |