What is xpub, ypub, and zpub? Understand them easily in 3 minutes.

As a Bitcoiner, you’ve probably heard the term “xpub”. But understanding what it means might be tricky. Don’t worry, by the end of this article, you’ll know all about xpub and how to use it.

What is an xpub?

An xpub, or Extended Public Key, is a crucial part of your Bitcoin wallet. It lets you see all your bitcoin transactions and check how much Bitcoin you have without putting your bitcoins at risk.

This key creates all the Bitcoin addresses your wallet will use to receive funds. With the xpub, you can watch your wallet’s activity to make sure everything is okay.

Even though it has “public key” in its name, you should keep your xpub private. While it can’t be used to steal your Bitcoin, if someone knows your xpub, they can see your balance and follow your transactions. So, it’s important for checking your wallet but should be kept just to yourself.

What about ypub and zpub?

To understand ypub and zpub, we need to know there are 3 kinds of Bitcoin addresses:

  1. Legacy Addresses (P2PKH, BIP44): These are the original Bitcoin addresses. They start with the number 1. When you use a legacy address, your Bitcoin transactions might cost more in fees compared to the newer address types.
  2. SegWit Compatible Addresses (P2SH-P2WPKH, BIP49): These addresses offer a balance between the old and new. They start with the number 3. Transactions from these addresses usually cost less than legacy addresses.
  3. SegWit Native Addresses (P2WPKH, BIP84): These are the latest type of addresses. They start with ‘bc1’ and have the lowest transaction fees of the three types.

Most Bitcoin apps can handle all these types. But, each type is different. For example, if your Bitcoin is saved in a P2PKH address, you can’t spend it from a P2WPKH address.

xpub, ypub and zpub for P2PKH, P2SH-P2WPKH and P2WPKH wallets

Because different address types exist, when you add a wallet’s xpub to a Bitcoin app, you need to tell it which type of address to use. To make exporting and importing easier, Bitcoin apps use a smart cryptographic conversion. This generates extended public keys with specific first three characters: “xpub” for Legacy P2PKH addresses, “ypub” for SegWit Compatible P2SH-P2WPKH addresses, and “zpub” for standard SegWit Native P2WPKH addresses. These extended public keys are called xpub, ypub, and zpub, based on their first letters.

This way, when you import an xpub, ypub, or zpub into a different Bitcoin app, it will have all the necessary information. It can correctly build all your wallet addresses and show you the right wallet balance.

One thing to note is that, for convenience, it’s quite common to also refer to ypub and zpub as xpub. When people talk about xpub, they are usually referring to all three forms.

Conclusion

Using xpub, ypub, and zpub allows Bitcoiners to create “watch-only” wallets. These wallets let you check transactions and balances without risking your private keys.

Pairing this with the safety of hardware wallets or multisig wallets for storing your Bitcoin offline offers a strong way to manage your Bitcoin. It gives you the ease of tracking transactions with a watch-only wallet and the peace of mind that your funds are secure offline.

If you haven’t set up “watch-only” wallets yet, download Satsplan today at the iOS App Store or the Android Play Store and create your watch-only wallets — completely FREE of charge!

1 Comment

  1. Hi! I’ve been reading your web site for some time now and finally
    got the bravery to go ahead and give you a shout out from Atascocita Tx!

    Just wanted to say keep up the good job!

Leave a Reply

Your email address will not be published. Required fields are marked *