Alright, something that might sound like gibberish but is actually pretty ***** important: hardened key derivation in HD wallets. If you’re not familiar with these terms, don’t worry we’ll break it down for ya.
First, what the ***** are HD wallets? Well, they’re a fancy way of saying that your cryptocurrency wallet can generate new keys on demand without having to store them all in one place. This is great because it makes backups and transfers much easier you don’t have to worry about losing or forgetting any private keys!
But here’s the catch: if someone gains access to your parent key (which generates all of your child keys), they can potentially steal everything in your wallet. That’s where hardened key derivation comes in. By using a different index number for each child key, we can create “hardened” keys that are much more difficult to guess or brute-force.
So how does it work? Let’s say you have a parent private key (which is just a long string of numbers) and a chain code (another long string). You want to generate a child key for your cousin Bob, who lives in California. Here’s what happens:
1. Calculate the hash of the concatenated strings “parent private key” + “chain code” using SHA-256. This gives us a 256-bit number (which is just another long string).
2. Take that hash and split it into two halves: the first four bytes are your new chain code for Bob’s child keys, and the remaining 32 bytes are his private key index.
3. Calculate the hash of “parent private key” + “new chain code” using SHA-256 again. This gives us a new 256-bit number (which is just another long string).
4. Take that hash and split it into two halves: the first four bytes are your new chain code for Bob’s child keys, and the remaining 32 bytes are his private key index… but this time, we add a “1” to the end of the index number (to make it hardened).
5. Repeat steps 3-4 as many times as you need to generate all of your cousin’s child keys!
The beauty of this system is that even if someone gets their hands on Bob’s private key, they can’t use it to steal anything from his other accounts (unless they also have access to the parent chain code). And since each child key has its own unique index number and chain code, you can easily keep track of which keys belong to whom.
It might sound complicated at first, but once you get the hang of it, it’s actually pretty simple (and much more secure than traditional wallet systems).