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.
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 Type||Wallet Type||Extended Public Key||Address Format|
|Legacy Bitcoin||Legacy wallet||XPUB||Begins with 1|
|P2SH-P2WPKH||SegWit wallet||YPUB||Begins with 3|
|P2WPKH||SegWit wallet||ZPUB||Begins with bc1|
Thus, if your wallet address is:
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 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.
Step 3: Select the wrench icon in the top right-hand corner.
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.
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:
- Use a tool like the xpub converter.
- Or if you are uncomfortable entering information into a live site, you can use Electrum. We have provided instructions for extracting Master Extended Public Keys using Electrum here.
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.
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.
Electrum wallet Master Public Key
Step 1: Set up your Electrum wallet.
Step 2: Go to Wallet in the menu and then select Information.
Step 3: Your Master Public Key appears in the box. In this instance, it was a zpub.
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.
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.
Thanks – the electrum part was very helpful with respect to finding and understanding my Bitcoin Master Public Key
You’re welcome and glad you found the article helpful.
great article. thx!