fbpx

Master Extended Public Keys: Everything about them and more!

If you use a hierarchical deterministic wallet, you would have come across terms like Master Extended Public Keys. Or xpub, ypub, and zpub. But what are these and why are they important? How do you extract them from your wallets? Today we address these questions and more.

Fun stuff we are going to cover

  • What are Master Extended Public Keys?
  • How to get my Master Extended Public Keys?
  • Precautions when dealing with Master Extended Public Keys?

What are Master Extended Public Keys?

Hardware wallets like Ledger or Trezor are hierarchical deterministic in nature. This means an infinite number of private keys can be generated from a single mnemonic seed. The diagram below shows a simplified illustration of how such wallets work.

How HD wallets work
How HD wallets work (click to enlarge)

As should be obvious from the image, graphic design clearly isn’t our forte.

But we hope you got the point of how deterministic wallets work. In short, a single mnemonic seed generates Master Extended Private Keys and Master Extended Public Keys for multiple cryptocurrencies. Each Master Extended Private Key, in turn, gives rise to an infinite number of Child Private Keys which in turn give rise to Child Public Keys and their associated addresses.

Something less obvious though is that the Master Extended Public Keys (orange boxes) allow the viewing of all Child Public Keys (green boxes) and their associated addresses. The Master Extended Public Key is also known as the Extended Public Key or the Master Public Key. We would use these terms interchangeably throughout the article. Thus, possession of the Master Extended Public Key allows you to view all the transactions of a particular wallet. Extracting them is thus useful for the purposes of setting up watch only wallets. How then do you extract them? Read on below for instructions on how to do so.

How to get my Master Extended Public Keys?

The Master Extended Public Key varies with the format of your wallet addresses. The table below summarizes the various Master Extended Public Key types and their address formats.

Address TypeWallet TypeExtended Public KeyAddress Format
Legacy BitcoinLegacy walletXPUBBegins with 1
P2SH-P2WPKHSegWit walletYPUBBegins with 3
P2WPKHSegWit walletZPUBBegins with bc1

Thus, if your wallet address is:

339xN86kVE2DosHZN9D6AnzkGA2KpMLHdQ

Then you should be obtaining a ypub since your address begins with 3.

Below are some examples of how to get your Master Extended Public Key. We provide illustrations for the following HD wallets:

  • Ledger
  • Trezor
  • Electrum

Ledger Extended Public Key

The method for getting your Extended Public Key from Ledger Nano S or Ledger Nano X is the same.

Step 1: You first need to set up your Ledger wallet. If you need a step by step guide on how to do this, see our Ledger Nano S guide for setup procedures.

Step 2: Select Accounts in the left-hand bar, followed by the cryptocurrency account you are interested in. In this instance, we have selected the Bitcoin account.

Select the relevant account in Ledger Live
Select the relevant account in Ledger Live

Step 3: Select the wrench icon in the top right-hand corner.

Select the Wrench icon in Ledger Live
Select the Wrench icon in Ledger Live

Step 4: The following box should pop up. Click Advanced Logs, you would see a long string of characters beginning with xpub. This is your Ledger Extended Public Key.

Select the Advanced Logs button
Select the Advanced Logs button
View your Ledger Extended Public Key (xpub in this instance)
View your Ledger Extended Public Key (xpub in this instance)

Ledger currently has an issue where the Extended Public Keys do not work properly. In other words, even though Ledger addresses begin with 3, the xpub is shown instead of the ypub. This is a known issue which Ledger is currently fixing. There are two workarounds:

Trezor Master Public Key

Step 1: Get your Trezor wallet up and running. See this link for instructions on how to do this.

Step 2: Access the Trezor Bridge.

Step 3: Click on the name of your device, for us it would be WhoTookMyCrypto. After that, select Basic. Finally, select the Show XPUBs button.

Navigate to the Basic menu In Trezor
Navigate to the Basic menu In Trezor

Step 4: A long string of text would appear. In our case, it was the ypub. And that’s how you get your Trezor Master Public Key. Do note that two ypubs are shown in this instance because we had created two Trezor accounts.

View your Trezor Master Public Key (ypub in this instance)
View your Trezor Master Public Key (ypub in this instance)

Electrum wallet Master Public Key

Step 1: Set up your Electrum wallet.

Step 2: Go to Wallet in the menu and then select Information.

Go to Wallet Information in Electrum
Go to Wallet Information in Electrum

Step 3: Your Master Public Key appears in the box. In this instance, it was a zpub.

View your Master Extended Public Key
View your Electrum wallet Master Public Key (zpub in this instance)

Precautions when dealing with Master Extended Public Keys?

Anyone with possession of your Extended Public Key can view your entire transaction history. While they can’t spend your funds, your privacy is greatly compromised. Thus, be careful about the devices or websites you input your Extended Public Key into.

Conclusion

Hopefully, you now understand what Master Extended Public Keys are and how to extract them from your wallets.

Was our article helpful, or do you have any questions for us?

Let us know by leaving a comment below right now.

4 Comments

Leave a Reply

Your email address will not be published.