As Bitcoin wallets have advanced in technology and usability, the methods for generating, storing, and recovering addresses have also improved. Extended public keys (xPub) are a significant part of this evolution.

Essentially, an xPub, or extended public key, is derived from the master private key and acts as the root for generating all other public keys. This feature is crucial for maintaining privacy and security, as the xPub operates independently of private keys, eliminating the need for direct interaction between them.

In practice, this makes the extended public key particularly useful for creating watch-only wallets, which allow users to view transactions without exposing the associated private keys.

If you want to learn more about how an xPub works and what it is used for, read this article to the end!

Hierarchical Deterministic Wallets

To better understand the function and importance of the extended public key, it’s important to understand hierarchical deterministic wallets or HD wallets.

In the early days of Bitcoin, private keys were generated randomly, and each private key was associated with a public key (address).

Whenever a new public address was needed, a new private key had to be created. This meant that users had to back up all addresses individually or repeatedly use the same address.

Therefore, from the perspective of usability and security, this solution was neither very secure nor practical.

Hierarchical deterministic wallets (HD wallets) emerged as a solution through the BIP32 improvement protocol. HD wallets can generate multiple addresses from a single seed phrase.

This way, it is no longer necessary to back up all addresses; just back up the seed phrase.

The BIP32 protocol organizes private keys in a hierarchical structure, similar to a tree, which is why the wallets are called ‘hierarchical.‘ Thus, the extended public key, or xPub, acts as a ‘master’ or ‘parent’ key that generates ‘child’ public keys.

Understanding this hierarchical system highlights the importance of xPubs, which were introduced with the implementation of HD wallets.

What are xPubs?

xPubs are master public keys that generate sequences of public keys in hierarchical deterministic wallets, allowing the creation of multiple addresses without exposing private keys.

Essentially, xPubs, or extended public keys, are generated from the master private keys. They enable the creation of an infinite number of public addresses in a wallet without having access to the private keys. This capability simplifies the process of creating new addresses for the same wallet, which is crucial since reusing public addresses is not recommended as it can compromise privacy.

Since the xPub does not derive from any private key, if your xPub address is shared somehow, your balance will not be compromised, as there will be no access to it.

However, your privacy might be somewhat compromised, as it would be possible to identify your public addresses.

Therefore, xPubs are ideal for generating watch-only wallets. These wallets do not share private addresses but allow balance control and transaction monitoring, enhancing security and usability.

xPubs and watch-only wallets

As mentioned earlier, extended public keys are essential for creating watch-only wallets.

But what exactly are watch-only wallets?

Watch-only wallets enable you to view the balance and transactions of specific Bitcoin addresses. However, they do not grant access to the private keys needed to transfer or spend the bitcoins.

Who is xPub ideal for?

xPub and watch-only wallets are particularly suited for users with a hardware wallet who wish to monitor their balance and view transactions without constantly connecting the wallet to an internet-connected device. This is especially useful since hardware wallets, often used for long-term storage of large amounts, are cold wallets. Constant internet connectivity is not advisable as it increases the risk of attacks.

Furthermore, it’s possible to set up a watch-only wallet in mobile wallets like Blue Wallet. To do this, you need the extended public key of the wallet. The xPub, as the master key for the public addresses, retrieves all wallet information such as balance and transactions without needing to connect to the private key.

Therefore, in watch-only wallets, it is impossible to spend Bitcoin since a private key, which is not accessible in this setup, is required to authorize transactions.

xPub, yPub, and zPub

In some discussions, you might encounter terms like “ypub” and “zpub,” along with other variants such as “tpub,” “upub,” and “vpub.” All these variations represent extended addresses compatible with different Bitcoin address formats.

As Bitcoin wallets have evolved, so have the address formats. Consequently, there is a specific extended key format tailored to each type of address.

Ultimately, all these are variations of the extended public key.

See below:

  • xpub: extended key formats used in legacy wallets, which start with “1…”
  • ypub: format belonging to wallets with the BIP49 standard, compatible with P2SH-P2WPKH addresses.
  • zpub: is basically the same as ypub. However, it is compatible with segwit addresses.

There are also other variations, which are described in the table below:

xPub variations

How to find your wallet’s xPub?

You might be curious about where to find your wallet’s xPub, right?

Generally, hardware wallets support extended public keys, and you can typically locate it within the settings under the addresses section.

Here’s an example of how to find your xPub in your Trezor wallet:

Connect your Trezor and access suite.trezor.io or open the Trezor Suite desktop app. Go to the “accounts” tab and select the desired account in the sidebar.

Trezor suite

Click the “account” tab next to “overview“:

Accessing xPub on Trezor

Click on “show public key“:

Public key (xPub) on Trezor

Your xPub will be displayed, along with a QR code and text. You can then copy and paste this information into any device that accepts it.

xPub generated in QR Code and text format.

Conclusion

Throughout this article, we’ve explored how the evolution of Bitcoin wallets has corresponded with changes in address formats and their applications.

The xPub is a highly practical and secure method for backing up public addresses and can also facilitate the management of coins via watch-only wallets.

If you’re not using a Trezor wallet, the steps to locate your xPub are generally similar and can usually be found in the settings or wallet details tab of your hardware wallet.

I hope this article has helped you understand more about xPub and its importance for wallets and Bitcoiners.

Until next time, take care!

Share on your social networks:

Written by
Image of author
Carol Souza

One of the leading Bitcoin educators in Brazil and the founder of Area Bitcoin, one of the largest Bitcoin schools in the world. She has participated in Bitcoin and Lightning developer seminars by Chaincode (NY) and is a regular speaker at Bitcoin conferences around the world, including Adopting Bitcoin, Satsconf, Bitcoin Atlantis, Surfin Bitcoin, and more.

Ícone do X

Enjoyed this article? Donate some sats so we can grab a cup of coffee and keep writing. ☕