Converted Segwit address (YPUB) to Legacy (XPUB), but balances differ

1

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

Rares H.

Posted 2018-06-26T12:24:05.317

Reputation: 13

To prevent confusion, in this question YPUB stands for BIP 49 Derivation scheme for P2WPKH-nested-in-P2SH based accounts

MCCCS 2018-06-26T15:35:18.253

Answers

1

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.

MCCCS

Posted 2018-06-26T12:24:05.317

Reputation: 5 827

0

  • 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.

dark knight

Posted 2018-06-26T12:24:05.317

Reputation: 1 532