Bitcoin Forum

Bitcoin => Bitcoin Technical Support => Topic started by: 22bits on November 04, 2020, 05:52:58 AM



Title: Using Electrum as a Backup to Ledger
Post by: 22bits on November 04, 2020, 05:52:58 AM
I wanted to back up my ledger prior to installing new firmware.  I wanted to check that I did indeed have the correct seed.  So I attempted to set up a electrum wallet to see all was good using the create from seed option.  Once you key in the 24 word seed you must check the BIP39 address option.  I was having some problems and googled it, seemed the main issue people were having was the derivation path.  The most important thing for me to get it working was to try the electrum various wallet types with the recommended derivation paths until I found the correct one.  For me it was selecting p2sh-segwit with the recommended derivation path of m/49'/0'/0'.  It depends on the type of wallet you have on the ledger. 

Getting it to work:
1.)  Create from Existing Seed
2.)  Once seed entered select BIP39 address type.
3.)  There will be options for wallet types; legacy, p2sh-segwit, native segwit.  Each wallet type selected will give a different suggested derivation path. 

For my wallet that I wanted to see it was p2sh-segwit with the suggested derivation of m/49'/0'/0'.  You may have a different wallet type.

You may have to try each wallet types until your electrum wallet syncs the bitcoin balance.  The problem I was having initially must have been not selecting the p2sh-segwit wallet type. 



Title: Re: Using Electrum as a Backup to Ledger
Post by: nc50lc on November 04, 2020, 06:42:35 AM
You may have to try each wallet types until your electrum wallet syncs the bitcoin balance.  The problem I was having initially must have been not selecting the p2sh-segwit wallet type.
That will defeat the purpose of using a hardware wallet since you've already typed your seed phrase on an online machine.
If you really need to, just do it on an Air-gap computer; if you want to see the balance, get the "master public key" from the wallet information and create a watch-only wallet on an online machine.
You can easily compare the addresses by opening the address tab (View->Show Addresses).

For my wallet that I wanted to see it was p2sh-segwit with the suggested derivation of m/49'/0'/0'.  You may have a different wallet type.
You don't have to guess which wallet type, you just have to check any address with balance from your ledger and check the first character.
If it starts with '1' - select legacy; if '3' - p2sh-segwit; if bc1 - native-segwit.


Title: Re: Using Electrum as a Backup to Ledger
Post by: 22bits on November 04, 2020, 07:34:07 AM
Quote
If it starts with '1' - select legacy; if '3' - p2sh-segwit; if bc1 - native-segwit.
Ah ha!  Thanks for the info, I was missing this piece :) 


Title: Re: Using Electrum as a Backup to Ledger
Post by: mocacinno on November 04, 2020, 07:46:39 AM
Quote
If it starts with '1' - select legacy; if '3' - p2sh-segwit; if bc1 - native-segwit.
Ah ha!  Thanks for the info, I was missing this piece :)  

What actually matters is if you missed this piece:

--snip--
That will defeat the purpose of using a hardware wallet since you've already typed your seed phrase on an online machine.
--snip--

Once you've typed your seed on an online machine, you should consider your wallet to be compromised...

My advice for you would be to create a new seed phrase with your hw wallet and move all your funds from your compromised wallet to the freshly generated wallet


Title: Re: Using Electrum as a Backup to Ledger
Post by: Pmalek on November 04, 2020, 10:46:22 AM
@22bits
A member from the Croatian local forum wrote a nice post about how to display the derivation path of a Bitcoin account in Ledger Live. It can help you in the future. It's particularly useful if you have multiple Bitcoin accounts for different purposes, so it becomes hard to keep track of the correct paths.

Fire up your Ledger Live and click on the account you want to see the derivation path for. Click on the gear icon in the upper right corner to open the settings menu. Check the Advanced logs. You will see some text that says: "freshAddressPath": "xx'/x'/x'/x/x". The bolded part will be your derivation path. You can delete the last 2 digits. When you copy that into Electrum it will open the corresponding wallet.

I have used Ledger for several years but never actually bothered to check this myself because I don't have that many accounts to keep track of and know the derivation paths.

Thanks to slackovic who suggested this method here:
https://bitcointalk.org/index.php?topic=2270988.msg55468447#msg55468447


Title: Re: Using Electrum as a Backup to Ledger
Post by: o_e_l_e_o on November 04, 2020, 02:51:11 PM
-snip-
There is actually an easier way, if you don't know which derivation path your account is under.

With the newest versions of Electrum, once you enter your seed phrase and select the "BIP39" box, on the next screen there is a button titled "Detect Existing Accounts". If you press it, Electrum will automatically search a variety of derivation paths, including the three standard 44/49/84 paths. You can see the full list of derivation paths searched here: https://github.com/spesmilo/electrum/blob/master/electrum/bip39_wallet_formats.json

If it detects an active account, it will automatically search for the next account up at that derivation path, and continue until it finds an inactive account. Once it has found them all, it will display a list of them for you and you can choose which ones you want to restore.

But I also concur with the posters above - if you have restored your seed phrase from your Ledger to Electrum, then there is no point using the Ledger for that seed phrase anymore, as it has been exposed to the internet. Reset your Ledger, create a new seed phrase, and move all your coins to your new wallet(s).


Title: Re: Using Electrum as a Backup to Ledger
Post by: bob123 on November 04, 2020, 02:55:55 PM
You actually don't need to enter your mnemonic code into any other device than your ledger.

There is a mnemonic code check application for the ledger (to be installed on your ledger, not your PC).
This allows you to confirm your mnemonic code without exposing it to your PC or other device.


Title: Re: Using Electrum as a Backup to Ledger
Post by: Pmalek on November 04, 2020, 05:46:14 PM
There is actually an easier way, if you don't know which derivation path your account is under.

With the newest versions of Electrum, once you enter your seed phrase and select the "BIP39" box, on the next screen there is a button titled "Detect Existing Accounts". If you press it, Electrum will automatically search a variety of derivation paths, including the three standard 44/49/84 paths. You can see the full list of derivation paths searched here: https://github.com/spesmilo/electrum/blob/master/electrum/bip39_wallet_formats.json
I have never tried this option. I know it's there, but my seed is not going to leave the secure element of Ledger to test if it's valid on Electrum. I do agree that it is a useful addition by Electrum when restoring seeds created on software wallets. The option I mentioned above is useful if you want to find out the correct derivation path of one particular Ledger Bitcoin account where you could have 30 different ones.   


Title: Re: Using Electrum as a Backup to Ledger
Post by: HCP on November 06, 2020, 12:30:02 AM
Sadly, this isn't an option when "restoring" your wallet using a Hardware device, it only gives the 3 choices for script-type/derivation... there is no "detect existing accounts" option:
https://talkimg.com/images/2023/11/15/zvi1W.png

Hopefully, they are able to implement this option for hardware wallets in an upcoming version.


Title: Re: Using Electrum as a Backup to Ledger
Post by: 22bits on December 29, 2020, 11:59:38 AM
did not reply for a while.  The 'recovery check' ledger app works great.  Easy peesy lemon squeezy.  Thx.  


Title: Re: Using Electrum as a Backup to Ledger
Post by: bitpop on January 10, 2021, 07:30:49 PM
Inputting your seed unnecessarily decreases your security. Just test it once on your ledger and that's it. Your seed is your backup.


Title: Re: Using Electrum as a Backup to Ledger
Post by: HCP on January 11, 2021, 04:39:10 AM
Inputting your seed unnecessarily decreases your security. Just test it once on your ledger and that's it. Your seed is your backup.
The "recovery check" ledger app is designed exactly for that purpose. You really aren't decreasing your security at all as you are entering it on the device... not typing it into a PC etc. It's basically just like entering it during a full device restore.


Title: Re: Using Electrum as a Backup to Ledger
Post by: bitpop on January 11, 2021, 06:02:26 AM
Inputting your seed unnecessarily decreases your security. Just test it once on your ledger and that's it. Your seed is your backup.
The "recovery check" ledger app is designed exactly for that purpose. You really aren't decreasing your security at all as you are entering it on the device... not typing it into a PC etc. It's basically just like entering it during a full device restore.

Oh sounded like he was doing it on other wallet software how you'd recover a key in emergencies. I don't see electrum doing the seed in hardware?


Title: Re: Using Electrum as a Backup to Ledger
Post by: HCP on January 11, 2021, 06:25:50 AM
Oh sounded like he was doing it on other wallet software how you'd recover a key in emergencies.
Originally, yes... that is what the OP was doing to confirm they had the correct seed. All the users here pointed out that doing that is a "bad idea"™ because entering your seed into a "normal" wallet like Electrum etc is effectively negating the entire purpose of the hardware wallet (ie. it is exposing the seed)

OP was then instructed to try the official Ledger "recovery check" app (needs to be installed via Ledger Live/Manager) and use that to confirm they have the seed backed up correctly... which they eventually did.


I don't see electrum doing the seed in hardware?
I'm not quite sure what you mean by this? ???