How to handle xpub keys with AnuBitux

In previous posts we have seen how to use xpub keys to create view-only wallets and how to obtain them form our wallets.

Handling our xpub keys we have surely noticed that some clients are only using keys starting with "xpub" and others are also using keys starting with "ypub" and "zpub".

This may seem a bit confusing!

 This is because some clients are only accepting xpub keys and want us to specify the derivation path to manage the addresses in the format we want. For instance, we could specify:

  • m/44'/0'/0'/0 for legacy Bitcoin addresses;
  • m/49'/0'/0'/0 for segwit Bitcoin addresses;
  • m/84'/0'/0'/0 for native segwit Bitcoin addresses (bech32).

Other clients, instead, are not allowing us to specify the derivation path since they are able to recognize it from the format of the master public key (like Electrum). For instance they are using:

  • keys starting with xpub for legacy addresses;
  • keys starting with ypub for segwit addresses;
  • keys starting with zpub for native segwit addresses.

We could use the right client depending on what kind of key we have but we do not want that! We want to use the client we feel comfortable with!

Convert public keys

To fix this, we can use the Xpub-converter tool, by Jameson Lopp, that can be found in the "WalletTools" section of the AnuBitux menu.

We simply have to select the format of the key we want to obtain, paste the key in the proper box and here it is! We have obtained a master public key in the desired format and now we can use it with our favourite client. In this example we have obtained an xpub key from a zpub one.

An example

Let's assume we have our Sparrow that is giving us an xpub key with the m/84'/0'/0' derivation path.

If we want to set up a view-only wallet using the Electrum client, we won't be able to specify the derivation path to use with our xpub key and so we are going to obtain a view-only wallet with legacy addresses.

To correctly set up our view-only wallet with Electrum, we first need to convert our master public key in the proper format. We can perform that with the Xpub-converter tool, chosing the zpub key format.  

Now we can create a new view-only wallet with Electrum, using the obtained zpub key.

As we can see, we obtained the same addresses in both wallets.

This article was updated on 15 May 2024