I'm trying to convert a Segwit YPUB address I got from a Ledger Wallet to a Legacy XPUB address in order to query the transactions from the wallet. I've yet to find a reliable API that supports YPUB and I'm using Blockchain.info to fetch the information for Bitcoin.

While I've tried multiple methods to convert a YPUB to XPUB (getting the same addresses with every method I've found - changing the header with the network specific magic key), I don't see the balance on the resulted XPUB address. It shows 0 balance.

Is it possible that a converted address would display the balance of the original address?

Thanks, Rares


2 Answers 2


It's not possible access funds in SegWit addresses (actually UTXOs) as if they were in legacy addresses. A SegWit address and a legacy address with the same public key map to different addresses, hence they don't share the same funds.

  • You can use an explorer like blockonomics that supports segwit xpubs and also has an API
  • If you want to use blockchain.info only, you need to derive the segwit addresses from the ypub and then lookup these addresses to get the balance. Here is a script. Converting ypub to xpub won't work because bc.info will still generate legacy P2PKH addresses from xpub, whereas it should generating segwit in P2SH addresses.

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.