"xpub": "tpub-big-long-key-that-starts-with-tpub",
  "index": 1,
  "freshAddressPath": "84'/1'/1'/0/0",
  "id": "libcore:1:bitcoin_testnet:tpub-big-long-key-that-starts-with-tpub:native_segwit",
  "blockHeight": 2097540

When I copy the "xPub" from a Ledger Nano S Bitcoin Testnet wallet I find exactly this (key obviously obfuscated). I'm confused because in my novice research my understanding is that the derivation path 84'/1'/1'/0/0 is for zpub keys and segwit wallets. Indeed, my wallets in my ledger are labeled "segwit". But here the extended key is labeled "xpub" and the key starts with "xpub", or in the case of the Bitcoin Testnet, it starts with a "tpub". Why?

Can somebody explain to me why this seems mixed up? Is this key an xpub or a zpub? Is a tpub and an xpub the same thing? Should I use Bip32, Bip44 or Bip84 to derive child keys (and thus addresses) that will match my ledger nano?

I have found a clever python class that will convert xpub to zpub. Is this the correct thing to do in this case?


Thanks in advance! This is my very first question (don't worry, I have more) on this Stack Exchange and I really appreciate any support or advice I can get.

1 Answer 1


BIP 32 specifies a serialization format for extended public keys. This format has the prefix xpub and is generic for all public keys that can be used with BIP 32, regardless of the address type or the derivation path.

BIP 84 added an additional serialization which results in the prefix zpub to indicate that keys derived from that extended public key should only be used in native segwit addresses.

It is correct for a wallet to output xpubs for keys used in segwit addresses. It is also correct for a wallet to output zpubs for the same keys. It just depends on the implementation. The serialization is only used for some metadata to the wallet, the derived keys will all be the same. In order to get the same addresses, you need a wallet which will derive the keys and use them in the address type that you are expecting.

tpub is a prefix used for extended public keys that were created in a testnet wallet.

  • Thank you for this answer but now I must ask, how would I know how my Nano is deriving keys? I assume it's using Bip84, no? Should I assume it's using Bip32 since the key is an xpub? If so, why would the derivation path start with 84? Should I be converting this "xpub" to a "zpub" and use Bip84??
    – mike-a
    Commented Oct 4, 2021 at 20:14
  • xpub and zpub are different encodings of the same key zpub encodes the additional information that the specific key should be used to derive a P2WPKH address (you can also derive P2PKH address from it if you want). Ledger uses bip84 to derive the keys/addresses but it doesnt bother to encode it to zpub it uses the more generic xpub.
    – Mike D
    Commented Oct 4, 2021 at 20:34
  • @mike-a BIP 32 is the only derivation method. It specifies the way to derive keys and how derivation paths work. It does not specify any specific derivations paths. BIP 84 only specifies specific derivation paths to use, in addition to zpub. Your device is using both bips - it is using BIP 32 to derive keys specified with the BIP 84 derivation path.
    – Ava Chow
    Commented Oct 5, 2021 at 2:17
  • @AndrewChow Thanks for this answer! Do you know of an API where I could fetch the total balance of a zpub address? bitcoin.stackexchange.com/questions/116038/… Thanks.
    – Ryan
    Commented Nov 20, 2022 at 1:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.