Everything You Need to Know About HD Wallets

Everything You Need to Know About HD Wallets

xPub yPub zPub Knowledge

Crypto APIs Team

Feb 2, 2022 • 5 min

Before we get into the nitty-gritty of what an HD Wallet is and why they are important, let’s start with what crypto wallets are. The term “wallet” is a bit misleading since a crypto wallet doesn’t store any coins. In fact, cryptocurrency never actually leaves the blockchain.  

What crypto wallets do store is a key pair— a public and private key, that use cryptography to enable the secure management of your digital assets and transactions on the blockchain. 

The public key can be shared with other people in the form of a public address (a hashed version of the public key). Think of it as your bank account IBAN number. With the public key, a person can send digital assets to you, but they can’t access any tokens therein.  

That is done only with the private key which as the name suggests, should be kept private. The whole blockchain is built on the premise that the owner of the private key owns the funds.  

Not Your Key, Not Your Coins

When you make a cryptocurrency transaction there is no movement of crypto coins in the same way fiat currency is transferred from one bank account to another.  

Instead, when you use your private key to approve a transaction it generates a signature that is broadcast to the blockchain network. The network then adds your transaction to the public ledger to reflect the new balance on your address. 

It used to be that with every blockchain transaction, a new private and public key was generated which were unrelated to the previous keys. This meant that users had to back up their key and wallet information after every single transaction. 

As the blockchain has grown, there have been many improvements to this “Just a Bunch of Keys” system. But the real breakthrough came with BIP32 (Bitcoin Improvement Proposal), which introduced Hierarchical Deterministic Wallets and extended keys. 

So, What Are Hierarchical Deterministic Wallets? 

A Hierarchical Deterministic Wallet, or HD wallet for short, is a privacy-centered wallet for address generation, key management, and recovery.  

What makes it different from other wallets is the type of key pair management that allows generating  multiple new addresses from a root seed, which is essentially a long string of data. This data is formatted into 12-24 words (seed phrase or mnemonic phrase) to make it more user-friendly.  

The seed automatically generates a tree-like structure of child private and public keys that are derived from a master key pair— otherwise known as an extended private key (xPriv) and an extended public key (xPub).  


The “hierarchical” aspect of the HD wallet comes from the fact that each child key can generate its own child keys, which can generate their own, and so on and so forth, thus creating a system of hierarchy. 

The “deterministic” part means that a given master key will always generate the exact same tree, with the exact same keys in the exact same way.  

These two main characteristics are what allow users to back up billions of keys as long as they have the single seed phrase.  

Extended Public Keys (xPriv) Explained 

While the xPriv generates all child private keys, the xPub allows you to derive new public addresses without ever needing access to any private key. 

The xPub doesn’t contain any information about private keys and it will not give you access to funds or any spending ability. It basically gives you “read-only” access.  

Even so, it is highly risky to share the xPub with anyone as with it a person can view your entire transaction history and see all associated public addresses and balances. 

After X comes Y and Z

With HD wallet developments such as SegWit (Segregated Witnesses) and newly adopted Bitcoin Improvement Proposals, yPubs and zPubs have appeared. 

These are also extended public keys and act in the same way as Xpub, except that yPub follows BIP49 and zPub follows the BIP84 standard.

Each type of wallet comes with its own set of advantages, usually in regard to transaction fees. But for now, let’s concentrate on the benefits of Hierarchical Deterministic Wallets.

The Benefits of an HD Wallet 

Although HD wallets were developed by Bitcoin, they are now a standard wallet structure supporting multiple currencies. They are particularly useful for custody companies, software companies, and accounting as they can provide a quick and easy view of every single account and transaction. 

  • Easy Backup and Recovery: The deterministic and hierarchical system means the wallet can be easily regenerated and recovered in its entirety with the use of a single seed phrase.  
  • Blockchain Agnostic: An unlimited number of unique addresses can be created for multiple cryptocurrencies. 
  • Greater Privacy: A user can generate different keys for each transaction so transaction history and exact overall balance are hidden from public view. 
  • Security: The private key is always stored offline, meaning no risk from hacking or other cyberattacks. 
  • Convenience and Efficiency: No need to back up every address after every transaction. Using the seed phrase, you back up only the extended keys once, and every child key and their associated addresses come with it.  

Get xPub, yPub, and zPub Data with Crypto APIs 

For exchanges or enterprises trading with crypto, managing HD wallets alone can get confusing. With Crypto APIs businesses can receive complete and accurate HD Wallet data (from xPub, yPub, and zPub) including balance, transactions, change and receiving addresses, as well as UTXOs data.   

You might also be interested in:

Related articles