A Gentle Introduction To Hierarchical Deterministic (HD) Wallets

October 27, 2022
Newton Team
October 27, 2022
A Gentle Introduction To Hierarchical Deterministic (HD) Wallets

Quick Answer: 

A crypto wallet is a device or piece of software that holds private keys. Contrary to what the name implies, a crypto wallet does not hold the coins, but rather the private keys needed to access the coins. Therefore, a more accurate name for a crypto wallet should be a “keychain.” 

 

A hierarchical deterministic (HD) wallet is a type of wallet that is used to store multiple sets of private keys. A seed phrase is what is used to create a set of private keys in a crypto wallet. It is called a seed “phrase” because it is a sequence of 12 or 24 English words chosen from a specific list, in a particular order. With a seed phrase, one can control and manage an arbitrarily large number of private keys with a single seed phrase.

 

Seed phrases are also referred to as a “mnemonic phrase” or a “recovery phrase”. The only purpose of a seed phrase is to cater to the human mind. It is far easier for a person to memorize a series of 12 or 24 English words than it is to memorize a long hexadecimal string of alphanumeric characters.

What is a Crypto Wallet?

 

In the physical world, your wallet holds your bills and money. In the crypto world, the blockchain holds the coins, and your wallet holds the private keys that allow you to interact with the coins on the blockchain. 

 

Except, that analogy is not entirely accurate. Let’s take a deeper dive. 

 

The term “wallet” is a misnomer when it comes to the world of crypto. Instead, more accurately, the term should be “keychain”. 

 

In the crypto world, all information surrounding transactions and balances is stored on the blockchain. So, for example, if you hold 1 BTC, that BTC is held at a specific Bitcoin address – this info exists only on the blockchain. To spend that bitcoin, one needs to sign the transaction using the private key for that address. A private key is a unique number that must be kept secret by the crypto holder, and every crypto address has its own private key. 

 

The coins themselves are on the blockchain – a coin (or any fraction of a coin) is a balance that is associated with a crypto address or a series of crypto addresses. 

 

For the sake of convention though, we will still refer to a crypto wallet as a wallet. 

 

Specifically, a crypto wallet is a device or software that holds the private keys to specific addresses where the coins are held, but the coins themselves are not in the wallet. 

 

A great way to visualize this would be to imagine the blockchain as a bank vault with billions upon billions of safety deposit boxes, each locked with a different key – the key being held in your crypto “wallet”.

Why Use HD Wallets?

In modern times, certain technologies have been developed to ease the burden on crypto holders when it comes to storing and managing their crypto assets. In the early days of crypto, there were countless stories of people losing their crypto because they accidentally deleted their private keys, or damaged or lost a hard drive that contained the only copy of their private keys. 

 

Although crypto itself may be decentralized, if a crypto holder only possesses a single copy of their private key on a single device, this still represents a single point of failure. This would then defeat the whole ethos of decentralized cryptocurrencies. 

 

Each crypto address comes with a unique private key. This means that the most basic way to store crypto is if a crypto holder had 15 addresses, they would need to store 15 private keys. If one ran a crypto company with 100,000 users, where a unique address is necessary for each user for 15 different crypto assets, one can see how the logistics of private key management quickly spirals out of control. 

 

Lastly, since private keys are, in essence, just very large numbers, they may be easy for computers to deal with but practically impossible for humans to memorize. For example, for Bitcoin, private keys are 256 bits in length. Represented in hexadecimal, the private key is 64 characters long. 

 

 

What if there was a way to solve all these problems? What if we can make a wallet that lets you easily store a whole series of private keys and allow for backup copies of the private keys that are human-readable and memorizable? In comes hierarchical deterministic (HD) wallets. 

How HD Wallets Work

Hierarchical Deterministic Wallets work by generating private keys in a way that establishes a tree structure. A single master key derived from a “seed phrase” is created, and every private key subsequently generated by the wallet is derived from that one single master key. 

 

The term “hierarchical” implies that there exists a specific order in which keys are generated. It describes having so-called “child keys” which, as mentioned, are derived from the master key. These child keys can also be used to generate their own child keys and so on. 

 

 

The term “deterministic” means that the same seed phrase will always generate the same master key, which will always generate the same child keys. A seed phrase is a list of 12 or 24 English words in a specific order that are selected at random from a special list of 2048 possible words. 

 

Since each private key is generated through a series of calculations beginning with the seed phrase, the crypto holder is not required to store every private key– any private key on the tree structure can be re-generated at will using the master seed phrase. This “deterministic” property of HD wallets means that we can shift the entire task of private key storage to just memorizing or storing one single master seed phrase. 

 

Therefore, whether one wants to store 15 private keys or 1500 private keys, both tasks can be accomplished with the same level of complexity. 

Hardware Wallets

Hardware wallets are devices that are specially designed to store crypto, and often resemble a USB key. While HD wallets can be software-based (a mobile or desktop app), the most common implementation of HD wallets is through a hardware wallet.

 

The advantage of using an HD wallet is that the seed phrase will provide the crypto holder with a way to restore access to their private keys even if their hardware device is lost or damaged. If a user needs to restore their wallet, all that is required is for the user to get a new device and restore their private keys using the seed phrase. The underlying technology of HD wallets prevents crypto holders from losing their crypto due to a lost or damaged hard drive. 

What is BIP-39?

As we already learned, all seed phrases are generated off a list of 2048 possible words, but where did these words come from? The answer is “Bitcoin Improvement Proposal 39", or BIP-39 for short.

 

 

 

 

The list of words that generate seed phrases is a group of 2048 words – the full list is public and can be found here. Some unique properties of these words include the purposeful avoidance of similar words on the list such as “quick” versus “quickly” or “women'' versus “woman”. Further, each word on the list is uniquely identifiable just by the first 4 letters. 

But how secure is a seed phrase?

Initially, it may seem like seed phrases aren’t all that secure. As you’re probably aware by now, anyone who has access to the seed phrase can re-generate all the private keys that are derived from that seed phrase at will and pretty much instantly. 

 

If you’re using online banking, you’re most likely securing that account using a password which can be any combination of words and characters. And yet, when it comes to crypto, you might be thinking “I’m supposed to secure my entire fortune with only 12 or 24 words? What if someone randomly guesses my seed phrase? What if someone accidentally generates the same seed phrase as me?”

 

To address those concerns, it’s worth exploring the mathematics that’s used to create seed phrases.

 

For reference, the total number of particles in the universe is estimated to be around 1080 particles according to Popularmechanics.com. For a 24-word seed phrase, the number of possibilities is 204824, which, doing a quick approximation, is 204824 ≈ 2.96428 x 1079.

 

Therefore, for a 24-word seed phrase, the possible combinations of a 24-word seed phrase are only slightly less, in relative terms, to the total number of particles in the universe. The chances of someone randomly being able to guess a given seed phrase is incredibly small. Even a 12-word seed phrase that works out to be 204812 possible combinations is considered “sufficiently secure” by cybersecurity experts. 

‍

Closing Thoughts: The field of crypto security and wallet technology is vast. But, there are some great tools out there to make sure that you’re able to store your crypto safely.

‍

‍

No items found.
Newton Team
Follow Newton on LinkedIn
Follow Newton on YouTube
Follow Newton on LinkedIn
Follow Newton on Twitter

BACK TO BLOG
join our research group