Skip to content

xpub input should ask for address type (Legacy/SegWit/Taproot) to avoid wrong derivation #48

@4rkad

Description

@4rkad

Problem

When a user inputs an xpub to analyze wallet privacy, the tool derives Legacy (P2PKH) addresses starting with 1. However, many wallets (Bitcoin Core, Sparrow, etc.) export xpub for all script types — the address type is determined by the derivation path, not the prefix.

This means a user with a Native SegWit wallet (bc1q...) who exports their key as xpub (instead of zpub) will get no results or incorrect analysis, because the tool derives Legacy addresses instead of SegWit ones.

Background: xpub vs zpub vs ypub

Trezor introduced SLIP-132 to encode the script type in the extended key prefix:

Prefix Address type Starts with BIP Path
xpub Legacy (P2PKH) 1... 44 m/44'/0'
ypub Nested SegWit (P2SH-P2WPKH) 3... 49 m/49'/0'
zpub Native SegWit (P2WPKH) bc1q... 84 m/84'/0'

But not all wallets adopted this convention. Bitcoin Core, Sparrow and others use xpub for all script types — the derivation path determines the address format, not the prefix.

With Taproot (bc1p..., path m/86'/0'), there is no widely adopted prefix convention either.

Proposed solutions

Option A — Ask the user: When an xpub is entered (not ypub/zpub), show a dropdown asking which address type to derive: Legacy / Nested SegWit / Native SegWit / Taproot.

Option B — Auto-detect: Try deriving all address types and check which ones have on-chain activity. This is more user-friendly but slower.

Option C — Hybrid: Default to the most common type (Native SegWit) but let the user switch if results look wrong.

Note: ypub and zpub inputs already imply the correct address type, so this only affects xpub inputs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementImprove something that worksuiComponents, layout, styling, responsiveness

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions