Author

Topic: Does Ledger Give Different Extended Public Keys for Both Segwit and Legacy Addr (Read 165 times)

copper member
Activity: 2856
Merit: 3071
https://bit.ly/387FXHi lightning theory
Yeah it's a really useful tool if it was the right derivation path, it's a bit of a shame it isn't imo.
jr. member
Activity: 34
Merit: 8
@merclyn, that one wont work in this case because it's different derivation paths so it's different public keys from the seed.


Your right, I should have understood the OP's main issue before I posted.

What I thought I was responding to was this scenario:
A Ledger Nano S was setup new with segwit addresses, but it provides a xpub in the log.

According to SLIP-0132 (https://github.com/satoshilabs/slips/blob/master/slip-0132.md) there should be different version byte (or different prefix on that key)
The ledger I tested should have produced a key that started with ypub (P2WPKH in P2SH), but it produced an xpub key.
The Trezor I tested displays the correct extended public key for the address scheme used..

The site I posted earlier would change the Bytes and return a ypub (or zpub if needed).

Thanks for the correction.
copper member
Activity: 2856
Merit: 3071
https://bit.ly/387FXHi lightning theory
@merclyn, that one wont work in this case because it's different derivation paths so it's different public keys from the seed.
jr. member
Activity: 34
Merit: 8
I found a website that will convert the extended public key from xpub to ypub, or zpub. (actually can convert from any to any)

https://jlopp.github.io/xpub-converter/

the git project is at: https://github.com/jlopp/xpub-converter

I converted the core conversion logic to python for another project im working on.  I can post if anyone needs
jr. member
Activity: 107
Merit: 8
HCP
legendary
Activity: 2086
Merit: 4361
Yes...

SegWit uses m/49'/0'/0' derivation path
Legacy uses m/44'/0'/0' derivation path

if you look at: https://iancoleman.io/bip39/

Generate a random 24 word seed... (DO NOT put your Ledger seed in here!) click the BIP44 Tab and look at the "Account Extended Public Key". Then click the "BIP32" tab... set the "client" to "Custom"... and set the derivation path to: m/44'/0'/0' You'll notice that the "BIP32 Extended Public Key" is the same as the "Account Extended Public Key" form the BIP44 tab... this will be the same as the xpub generated by the "Legacy" wallet in Ledger (using the same seed mnemonic)

If you now change the derivation path to: m/49'/0'/0' you'll note that the "BIP32 Extended Public Key" changes... this should be the same as the xpub for a "SegWit" wallet in Ledger (using the same seed mnemonic)
jr. member
Activity: 107
Merit: 8
I want to know if Ledger Gives Different Extended Public Keys for Both Segwit and Legacy Addresses, because i tried exporting my extended public key to recover BCH i mistakenly sent to a segwit address using https://bch.btc.com/docs/help/bch_segwit_recovery, but they said they xpub key is not associated with the address, but when i log in to ledger on chrome, i see the address there.
Jump to: