Bitcoin Forum

Bitcoin => Electrum => Topic started by: joe1234 on April 06, 2021, 02:56:17 PM



Title: Electrum Wallet Backup
Post by: joe1234 on April 06, 2021, 02:56:17 PM
Hello Forum


- does the wallet-backup of Electrum contain the seed too?

- does Electrum use strong encryption for it's wallet backups?
 

Thanks!

Joe


Title: Re: Electrum Wallet Backup
Post by: TryNinja on April 06, 2021, 03:04:35 PM
- does the wallet-backup of Electrum contain the seed too?
Yes.

- does Electrum use strong encryption for it's wallet backups?
Only if you add a password to your wallet and select the "encrypt wallet file" checkbox.


Title: Re: Electrum Wallet Backup
Post by: AB de Royse777 on April 06, 2021, 03:11:45 PM
- does the wallet-backup of Electrum contain the seed too?
It's safer if you write down the seed manually to somewhere secure place. Keep the same sequence.


Title: Re: Electrum Wallet Backup
Post by: o_e_l_e_o on April 06, 2021, 03:17:43 PM
Electrum uses AES-128-CBC with ECIES to encrypt its wallet files, provided you have set a wallet password as TryNinja has said. Provided you have picked a long and complex password, then your wallet files should remain secure against brute force attacks. However, none of that is a reason to not write down your seed phrase on paper.

You can see the relevant code here: https://github.com/spesmilo/electrum/blob/94774c6ad22916026b7183736960abe2f33e3142/electrum/ecc.py#L316-L331


Title: Re: Electrum Wallet Backup
Post by: ranochigo on April 06, 2021, 03:47:21 PM
does Electrum use strong encryption for it's wallet backups?
Key derivation used is PBKDF2 and it is salted, IIRC so no rainbow tables. There isn't any real risks with moderately strong password. However, as with all backups, if someone gets his hands on it, then it'll definitely be less secure than it should be. Use a strong and unpredictable password and keep it safe. While backing up the seed will eliminate any electronic failure affecting the backup, it'll be better to have both if you also value your TX descriptions, labels and your LN channels.


Title: Re: Electrum Wallet Backup
Post by: pooya87 on April 07, 2021, 04:15:31 AM
Electrum uses AES-128-CBC with ECIES to encrypt its wallet files, https://github.com/spesmilo/electrum/blob/94774c6ad22916026b7183736960abe2f33e3142/electrum/ecc.py#L316-L331
That code is for encrypting and decrypting messages using ECIES which uses a smaller size AES (128 version) and has nothing to do with wallet file encryption.

The wallet file is actually encrypted using AES-256 and the double SHA256 hash of the password that the user enters. The code is found here: https://github.com/spesmilo/electrum/blob/22e6fe09c17724cd75763306470fa46a7bb7c4e8/electrum/crypto.py#L110-L125


Title: Re: Electrum Wallet Backup
Post by: ranochigo on April 07, 2021, 05:25:12 AM
Electrum uses AES-128-CBC with ECIES to encrypt its wallet files, https://github.com/spesmilo/electrum/blob/94774c6ad22916026b7183736960abe2f33e3142/electrum/ecc.py#L316-L331
That code is for encrypting and decrypting messages using ECIES which uses a smaller size AES (128 version) and has nothing to do with wallet file encryption.

The wallet file is actually encrypted using AES-256 and the double SHA256 hash of the password that the user enters. The code is found here: https://github.com/spesmilo/electrum/blob/22e6fe09c17724cd75763306470fa46a7bb7c4e8/electrum/crypto.py#L110-L125
Electrum encrypts the private keys and seeds differently from the wallet file. The seeds and private keys are encrypted with AES-256-CBC but the wallet file uses ECIES which allows it to be written and encrypted without the need for the passphrase to be entered again.

https://github.com/spesmilo/electrum/blob/1b763b4a3c6a456c6b944c7cd7493a7ec1a54a12/RELEASE-NOTES#L841


Title: Re: Electrum Wallet Backup
Post by: pooya87 on April 07, 2021, 05:50:44 AM
Electrum uses AES-128-CBC with ECIES to encrypt its wallet files, https://github.com/spesmilo/electrum/blob/94774c6ad22916026b7183736960abe2f33e3142/electrum/ecc.py#L316-L331
That code is for encrypting and decrypting messages using ECIES which uses a smaller size AES (128 version) and has nothing to do with wallet file encryption.

The wallet file is actually encrypted using AES-256 and the double SHA256 hash of the password that the user enters. The code is found here: https://github.com/spesmilo/electrum/blob/22e6fe09c17724cd75763306470fa46a7bb7c4e8/electrum/crypto.py#L110-L125
Electrum encrypts the private keys and seeds differently from the wallet file. The seeds and private keys are encrypted with AES-256-CBC but the wallet file uses ECIES which allows it to be written and encrypted without the need for the passphrase to be entered again.

https://github.com/spesmilo/electrum/blob/1b763b4a3c6a456c6b944c7cd7493a7ec1a54a12/RELEASE-NOTES#L841
Interesting but I can't find it in the source code. I could only trace encryption back to the pw_encode() method that does what I said above and it seems to only get private keys (eg. an imported key or when it reads the key from wallet to sign a message). Can't find where the wallet file itself is being encrypted though.


Title: Re: Electrum Wallet Backup
Post by: NotATether on April 07, 2021, 06:17:23 AM
- does the wallet-backup of Electrum contain the seed too?

If you are asking this because you're thinking that you don't have to back up the seed phrase if you have a copy of the wallet file and the password, then please reconsider this.

When you created the wallet, you should have already devised a backup strategy for storing the seed phrase so you don't lose it.

From a data recovery point of view, inside the wallet file is not a safe place to leave the seed in by itself because there are so many ways for a wallet file to get corrupted.


Title: Re: Electrum Wallet Backup
Post by: ranochigo on April 07, 2021, 11:56:09 AM
Interesting but I can't find it in the source code. I could only trace encryption back to the pw_encode() method that does what I said above and it seems to only get private keys (eg. an imported key or when it reads the key from wallet to sign a message). Can't find where the wallet file itself is being encrypted though.
This script outlines the process it takes to check for the version and the keys used for decryption;  HW wallet's xpubs or the user's password[1].

[1] https://github.com/spesmilo/electrum/blob/d86138a1a5a144b5adc32ef8bd1ff7afd860927d/electrum/storage.py#L118