Author

Topic: Importing Ledger nano s xpub into Electrum (Read 347 times)

HCP
legendary
Activity: 2086
Merit: 4361
December 24, 2018, 01:31:13 AM
#14
In that case, you actually need to have the device connected every time you open the watch-only wallet.

If OP wants to be able to check his wallet (watch-only) anywhere without having to connect his Nano S to the PC and unlock it, he can do the method above, then go to Wallet -> Information -> Copy the ypub, then import it to create a new independent watch-only wallet  (not linked to the Nano S device).
TryNinja, you are spot on. The reason why I did not want to follow HCP's method is that it required the hardware wallet to access. Is there an easier way to implement the tool you mentioned?
That's not completely true...

You ONLY need the hardware device connected to check the wallet IF the wallet file is encrypted:


If you don't use encryption, you can open the watching wallet without the device connected. This isn't really a security concern as such, as no private keys or seeds etc are held in the wallet file. So, it only really has privacy implications, insofar that if your wallet file is somehow compromised/stolen, the thief will have access to your YPUB, addresses and transaction history. They can't spend your coins.
legendary
Activity: 2758
Merit: 6830
December 22, 2018, 10:44:11 AM
#13
Can I confirm one more thing. If I set it up using the hardware wallet initially, my private key never leaves my device correct?
That's correct. You only compromise your hardware wallet if you write your backup seed somewhere (a website, a text file, import your wallet with it, etc...).
jr. member
Activity: 49
Merit: 23
December 22, 2018, 09:34:46 AM
#12
TryNinja, you are spot on. The reason why I did not want to follow HCP's method is that it required the hardware wallet to access. Is there an easier way to implement the tool you mentioned?
If you do the other steps I mentioned above, you will only need the hardware wallet once (to set up the watch-only and get the ypub). Afterwards, you won't need it anymore.

Can you try that?

Oops, I missed that part, let me go try it out. thank you!
 
Can I confirm one more thing. If I set it up using the hardware wallet initially, my private key never leaves my device correct?
legendary
Activity: 2758
Merit: 6830
December 22, 2018, 09:02:09 AM
#11
TryNinja, you are spot on. The reason why I did not want to follow HCP's method is that it required the hardware wallet to access. Is there an easier way to implement the tool you mentioned?
If you do the other steps I mentioned above, you will only need the hardware wallet once (to set up the watch-only and get the ypub). Afterwards, you won't need it anymore.

Can you try that?
jr. member
Activity: 49
Merit: 23
December 22, 2018, 08:50:49 AM
#10
Note that by connecting the Nano S to Electrum and using the "New -> Standard Wallet -> Use a Hardware Device" method... you're effectively just importing the YPUB and creating a watching only wallet anyway (it doesn't import the seed or private keys etc)... so it is probably the best way to achieve what you appear to be trying to achieve Wink

There is no reason to import any PUBs from Ledger to Electrum with a reason to create watch-only wallets because you can get same thing by doing what HCP write above, and only thing you need to pay attention is derivation paths. For Segwit you need to choose m/49'/0'/0' and for Legacy account
m/44'/0'/0' .
In that case, you actually need to have the device connected every time you open the watch-only wallet.

If OP wants to be able to check his wallet (watch-only) anywhere without having to connect his Nano S to the PC and unlock it, he can do the method above, then go to Wallet -> Information -> Copy the ypub, then import it to create a new independent watch-only wallet  (not linked to the Nano S device).

Thanks, Lucius and TryNinja.

TryNinja, you are spot on. The reason why I did not want to follow HCP's method is that it required the hardware wallet to access. Is there an easier way to implement the tool you mentioned?
legendary
Activity: 2758
Merit: 6830
December 22, 2018, 08:19:29 AM
#9
Note that by connecting the Nano S to Electrum and using the "New -> Standard Wallet -> Use a Hardware Device" method... you're effectively just importing the YPUB and creating a watching only wallet anyway (it doesn't import the seed or private keys etc)... so it is probably the best way to achieve what you appear to be trying to achieve Wink

There is no reason to import any PUBs from Ledger to Electrum with a reason to create watch-only wallets because you can get same thing by doing what HCP write above, and only thing you need to pay attention is derivation paths. For Segwit you need to choose m/49'/0'/0' and for Legacy account
m/44'/0'/0' .
In that case, you actually need to have the device connected every time you open the watch-only wallet.

If OP wants to be able to check his wallet (watch-only) anywhere without having to connect his Nano S to the PC and unlock it, he can do the method above, then go to Wallet -> Information -> Copy the ypub, then import it to create a new independent watch-only wallet  (not linked to the Nano S device).
legendary
Activity: 3234
Merit: 5637
Blackjack.fun-Free Raffle-Join&Win $50🎲
December 22, 2018, 06:20:18 AM
#8
Thanks for the reply. Apart from using the tool you linked, is there an easier way for non-technical people? Thank you.

I think you do not need to complicate the situation with YPUB/XPUB, everything is quite well explained and you need only listen to advice from HCP :

Note that by connecting the Nano S to Electrum and using the "New -> Standard Wallet -> Use a Hardware Device" method... you're effectively just importing the YPUB and creating a watching only wallet anyway (it doesn't import the seed or private keys etc)... so it is probably the best way to achieve what you appear to be trying to achieve Wink

There is no reason to import any PUBs from Ledger to Electrum with a reason to create watch-only wallets because you can get same thing by doing what HCP write above, and only thing you need to pay attention is derivation paths. For Segwit you need to choose m/49'/0'/0' and for Legacy account
m/44'/0'/0' .
jr. member
Activity: 49
Merit: 23
December 22, 2018, 12:30:26 AM
#7
Try importing it with this prefix:
p2wpkh-p2sh:your_xpub_here

(P.S: This probably only works with private-keys - I probably also don't know what I'm talking about)


It really doesn't work. I found this from Ledger's CTO:
XPUBs do not work properly for Segwit yet - we're looking for a standard that'd make that possible

Edit:
try to use this tool to convert your xpub to the p2wpkh-p2sh format: https://github.com/AbdussamadA/electrum-convert-key

Thanks for the reply. Apart from using the tool you linked, is there an easier way for non-technical people? Thank you.
HCP
legendary
Activity: 2086
Merit: 4361
December 16, 2018, 04:59:59 PM
#6
1) Why did you say "So, I believe that the Ledger SegWit wallet should be giving a "ypub"". Why couldn't this have been the zpub?
As already explained by TryNinja... YPUBs are for the "3"-type SegWit (aka P2SH-P2WPKH) addresses... whereas the ZPUBs are for the "bc1" (aka bech32) addresses... and Ledger does not generate bech32 addresses at this time.


Quote
2) You also mentioned the use of m/0 as the derivation path. What exactly is this? Reading this link (https://medium.com/bitcraft/hd-wallets-explained-from-high-level-to-nuts-and-bolts-9a41545f5b0), it means that you are setting the purpose' to 0? Why is this so?
It is because, in this instance, the XPUB that you see is NOT actually the Master Public Key for your wallet... instead, it is the Extended Public Key for the particular account within the Ledger wallet. In other words, it is already at the "m/49'/0'/0'" derivation level... so you just need to use "m/0" to start deriving addresses from this point.

If you were to specify the "full" derivation path (ie. m/49'/0'/0'/0) with this particular XPUB, you'd actually be deriving addresses at the starting point: "m/49'/0'/0'/49'/0'/0'/0"  Shocked

You can test this by experimenting with the Ian Coleman website:
- generate a random seed... DO NOT USE YOUR ACTUAL SEED!
- Click on BIP49...
- Copy the "Account Extended Public Key" and check the first address (path = m/49'/0'/0'/0/0)
- Paste the "Account Extended Public Key" into the "BIP32 Root Key" section at the top
- Click BIP141 tab
- Make sure the BIP32 derivation path = m/0 and that the Script Type is "P2WPKH nested in P2SH".
- Check the first address... (path = m/0/0)... it *SHOULD* be the same address as the one in step 3.

It works the same for legacy accounts from Ledger... (you just use BIP44 tab instead of BIP49... and BIP32 tab instead of BIP141 on the Ian Coleman website)
legendary
Activity: 2758
Merit: 6830
December 16, 2018, 08:25:08 AM
#5
1) Why did you say "So, I believe that the Ledger SegWit wallet should be giving a "ypub"". Why couldn't this have been the zpub?
From the same post by HCP:

Basically:
- xpub = Legacy wallet (legacy Bitcoin addresses)
- ypub = SegWit wallet (P2SH-P2WPKH addresses)
- zpub = SegWit wallet (P2WPKH addresses)

Which means that:
- ypub is for nested Segwit address (segwit addresses starting with a 3) - which are the one Ledger uses.
- zpub is for native Segwit wallets (segwit addresses starting with bc1) - Ledger doesn't use those.
jr. member
Activity: 49
Merit: 23
December 16, 2018, 04:07:22 AM
#4
It seems they still haven't fixed this "bug" on the Ledger... I wrote about it here: https://bitcointalksearch.org/topic/m.29497443

Basically, you should be getting a YPUB, but for some reason, Ledger is still giving out XPUBs for the SegWit wallets Sad

The only method I currently know of to get the YPUB, is as outlined in the post I've linked... that is to say, you need to connect your Ledger Nano S to Electrum, and import the wallet using "New -> Standard Wallet -> Use a Hardware Device" and then specify the correct derivation path... once you've successfully created that wallet, if you use "Wallet -> Information", Electrum will display your YPUB.

Note that by connecting the Nano S to Electrum and using the "New -> Standard Wallet -> Use a Hardware Device" method... you're effectively just importing the YPUB and creating a watching only wallet anyway (it doesn't import the seed or private keys etc)... so it is probably the best way to achieve what you appear to be trying to achieve Wink

Hi HCP thank you very much for the detailed explanation. With regards to the link you posted, could you please explain the following. I am new to this so apologies in advance. Have tried to google but can't find good explanations.

1) Why did you say "So, I believe that the Ledger SegWit wallet should be giving a "ypub"". Why couldn't this have been the zpub?

2) You also mentioned the use of m/0 as the derivation path. What exactly is this? Reading this link (https://medium.com/bitcraft/hd-wallets-explained-from-high-level-to-nuts-and-bolts-9a41545f5b0), it means that you are setting the purpose' to 0? Why is this so?

Thank you.
HCP
legendary
Activity: 2086
Merit: 4361
December 15, 2018, 03:09:27 PM
#3
It seems they still haven't fixed this "bug" on the Ledger... I wrote about it here: https://bitcointalksearch.org/topic/m.29497443

Basically, you should be getting a YPUB, but for some reason, Ledger is still giving out XPUBs for the SegWit wallets Sad

The only method I currently know of to get the YPUB, is as outlined in the post I've linked... that is to say, you need to connect your Ledger Nano S to Electrum, and import the wallet using "New -> Standard Wallet -> Use a Hardware Device" and then specify the correct derivation path... once you've successfully created that wallet, if you use "Wallet -> Information", Electrum will display your YPUB.

Note that by connecting the Nano S to Electrum and using the "New -> Standard Wallet -> Use a Hardware Device" method... you're effectively just importing the YPUB and creating a watching only wallet anyway (it doesn't import the seed or private keys etc)... so it is probably the best way to achieve what you appear to be trying to achieve Wink
legendary
Activity: 2758
Merit: 6830
December 15, 2018, 02:19:23 PM
#2
Try importing it with this prefix:
p2wpkh-p2sh:your_xpub_here

(P.S: This probably only works with private-keys - I probably also don't know what I'm talking about)


It really doesn't work. I found this from Ledger's CTO:
XPUBs do not work properly for Segwit yet - we're looking for a standard that'd make that possible

Edit:
try to use this tool to convert your xpub to the p2wpkh-p2sh format: https://github.com/AbdussamadA/electrum-convert-key
jr. member
Activity: 49
Merit: 23
December 15, 2018, 12:55:30 PM
#1
Hey everyone,

I am following the instructions on this site to import my xpub: https://bitcoinelectrum.com/creating-a-watch-only-wallet/

However, after importing the xpub, when I go to the Receive view on Electrum, it shows an address of 12zaX4EnQGZvzT2q3pzWceaEUqASHju69g. According to Ledger Live, my first address should be 339xN86kVE2DosHZN9D6AnzkGA2KpMLHdQ.

Is there a reason for this?

I think the issue is that the script type is incorrect. When I go to Wallet Information I see that the script type is p2pkh. Is there anyway to change it to p2wpkh-p2sh.

Thank you.
Jump to: