HD wallets - A Breakdown of HD wallets illustrated via a mini Rust app
Last updated
Last updated
The goal of this article to help you
Install and Setup your rust environment
Learn how to build a very simple rust CLI app to help us understand Bitcoin HD wallet
Learn about HD wallets
Advantages and Disadvantages of HD wallets
Learn a bit about Bip32 and a few it's underlying standards and improvements
Bip39
Bip44
Create a HD wallet using the rust CLI app
Some understanding of the Bitcoin ecosystem
A working installation of
Some basic basic knowledge of the Rust Language
The rust installed and configured on your machine
Machine: HP elite book
Operating System: Ubuntu 22.04.4 LTS
terminal: Gnome Terminal
shell: ZSH
Editor: Neovim
So you recently came across HD wallets and you're a bit curious as to why they are so awesome. furthermore, you're the kind of guy looking for a mini pet rust project to get your hands dirty with some bitcoin rust development. If that sounds like you then you've come to to the right place.
Now to bootstrap a new rust project run the command below from a convenient directory
Let's open up and run the app
Hierarchical Deterministic wallets as defined by the Bip32 standard are a kind of cryptocurrency wallet that allows for generation of keys from a single seed or mnemonic phrase
The BIP39 standard works by generating a group of 12,18 or 24 random easy-to-remember words called a mnemonic or seed phrase from a random number which is mostly around a length of 128 to 256-bit.
Quick Note: the more the bits, the stronger the mnemonic phrase and the more words you have in the phrase generated.

The BIP44 standard is an improvement on the BIP32 protocol by implementing a Multi-Account Hierarchy for Deterministic Wallets
Let's look at the structure of the BIP44 derivation path below:
m / purpose’ / coin’ / account’ / change / address_index
m: This is the master private key and represents the root node of your HD wallet.
purpose': This is set to 44' for BIP44 enabled wallets.
coin': This value represents the type of cryptocurrency. e.g
Bitcoin = 0'
Ethereum = 60'
account': This number represents an account in a BIP44 wallet
change: This is either 0 for external/receiving addresses or 1 for internal/change addresses.
address_index: Represents the individual addresses generated under each account.
Let's create a new HD wallet using the rust app
Now that we know what we have some idea of what HD wallets are, let's look at some advantages
HD wallets enable the creation of as many addresses as needed, all tied to a single wallet via a child addresses to wallet chain relationship.
HD wallets provide security and protection via the master seed i.e a 12, 18 or 24 word mnemonic phrase from which all the wallet`s private keys are derived.
One really cool thing about HD wallets is that they can be restored on different devices and wallet applications by simply entering your seed phrase unlike other types of wallets but the only condition is they must support both BIP-39 and BIP-44 standards.
A wise totally real Bitcoin philosopher once said...
"Whoever possesses the private keys owns the wallet."
This is valid because all public keys and addresses can be generated from the private keys.
On big and obvious concern of working with HD wallets is the fact that the security of your seed or mneomonic phrase getting compromised would naturally imply the lost of ownership to your wallet
In this aticle we have touched on just 3 out of 389 existing Bips to give you a general view of some of the improvements that have gone into HD wallets over the years to make them more efficient and secure
setting up rust on your machine can be done via and is as easy as running the command bellow and following through the prompts if you are on an ubuntu machine or a Mac
source
source: