Bitcoin Forum

Bitcoin => Electrum => Topic started by: 3L!te on January 08, 2020, 07:18:02 PM



Title: 'utf8' decode error by opening the wallet?!
Post by: 3L!te on January 08, 2020, 07:18:02 PM
Hey,

I restored an already deleted wallet with a program because I need access to it again:

When I use Electrum to open the restored wallet, there is an error message:

'utf8' codec can't decode byte 0xff in position 1: invalid start byte

What I can do to open my old wallet? Can anyone help me, please?



Title: Re: 'utf8' decode error by opening the wallet?!
Post by: HCP on January 08, 2020, 07:29:25 PM
Sounds like the wallet file is corrupted after the restore.

Are you sure that it is an Electrum wallet you have restored? Was it encrypted? If not, have you tried opening it with a text editor to see what the contents look like?


Title: Re: 'utf8' decode error by opening the wallet?!
Post by: Abdussamad on January 08, 2020, 10:34:29 PM
run electrum and enter a unique filename in the window that pops up. then go through the process of restoring your wallet file. note electrum only supports bitcoin.


Title: Re: 'utf8' decode error by opening the wallet?!
Post by: BitMaxz on January 08, 2020, 10:42:42 PM
What version of Electrum do you install?
Are you sure that you download that Electrum from the correct URL? it must be electrum.org

There are many fake Electrum wallet out there and maybe you use the fake one that is why it can't decode the wallet file that generated from original Electrum wallet.


Title: Re: 'utf8' decode error by opening the wallet?!
Post by: Pmalek on January 09, 2020, 02:02:41 PM
When was the original wallet created? I managed to find an older thread from 2017 where another user had a similar problem with wallets created before 2013. The info posted there seems to suggest that newer versions of Electrum have problems with wallets created on Electrum 2.0 and older versions.
The OP doesn't mention if he managed to fix the issues.

This is the thread:
https://bitcointalk.org/index.php?topic=2544522.0


Title: Re: 'utf8' decode error by opening the wallet?!
Post by: 3L!te on January 10, 2020, 10:38:41 PM
What version of Electrum do you install?
Are you sure that you download that Electrum from the correct URL? it must be electrum.org

There are many fake Electrum wallet out there and maybe you use the fake one that is why it can't decode the wallet file that generated from original Electrum wallet.

Yes, of course, it is the correct URL and the original Electrum.

run electrum and enter a unique filename in the window that pops up. then go through the process of restoring your wallet file. note electrum only supports bitcoin.

The problem is that Electrum is not able to read the restored wallet-file. There is the error message I quoted in my first post.

Try HCP suggestion first, if your wallet isn't encrypted, all you need to do are finding your private key/master private key and import it to Electrum (by creating new wallet).

If it's encrypted, try find other backup (either wallet file or mnemonic/seed/recovery words) you might have.

The wallet file is crypted (password), I don't have the private key anymore, just the wallet file.

Sounds like the wallet file is corrupted after the restore.

Are you sure that it is an Electrum wallet you have restored? Was it encrypted? If not, have you tried opening it with a text editor to see what the contents look like?

Yes, here is the screenshot of the wallet file opened in a text editor, it looks really weird:

www1.xup.in/exec/ximg.php?fid=20463319

The wallet file is from October 2018, maybe I should use exactly the same version of Electrum at this time?


Title: Re: 'utf8' decode error by opening the wallet?!
Post by: TryNinja on January 10, 2020, 10:48:44 PM
Yes, here is the screenshot of the wallet file opened in a text editor, it looks really weird:

www1.xup.in/exec/ximg.php?fid=20463319

The wallet file is from October 2018, maybe I should use exactly the same version of Electrum at this time?
I’m pretty sure this means the wallet is encrypted (or in the worst case, corrupted). I guess you don’t have any backup seed written somewhere, right? Without it, your chances of recovering your coins are pretty null.


Title: Re: 'utf8' decode error by opening the wallet?!
Post by: BitMaxz on January 10, 2020, 11:37:23 PM
~snip~

Do you remember which Electrum version you use before? If it is below Electrum 2.7 version the old wallet file will not work in the latest version base on my experience you may need to use the old version first(You can use portable version if you don't want to replace your latest version) and get the seed phrase since it's encrypted it will ask for the password.

After you get the seed you can install the latest Electrum version again(Just do this if you didn't use the portable version) and start to import your seed phrase.

The old version can be found from here https://download.electrum.org/


Title: Re: 'utf8' decode error by opening the wallet?!
Post by: TryNinja on January 10, 2020, 11:41:16 PM
Do you remember which Electrum version you use before? If it is below Electrum 2.7 version the old wallet it will not work in the latest version base on my experience you may need to use the old version first and get the seed since it's encrypted it will ask for the password.

After you get the seed you can install the latest Electrum version again and start to import your seed phrase.
I think you meant that versions < 2.7 do not connect to the Electrum servers. This has nothing to do with wallet files not working on new versions (which is false), thus having nothing to do with OP’s issue.


Title: Re: 'utf8' decode error by opening the wallet?!
Post by: HCP on January 11, 2020, 04:00:12 AM
Yes, here is the screenshot of the wallet file opened in a text editor, it looks really weird:
www1.xup.in/exec/ximg.php?fid=20463319
The wallet file is from October 2018, maybe I should use exactly the same version of Electrum at this time?
Yeah... it does look wierd. I'm fairly sure that isn't an Electrum encrypted wallet, or it is a very badly corrupted one. There are a number of non-ASCII looking characters in the screenshot you have provided (likely a text representation of binary data):
https://talkimg.com/images/2023/11/15/zcyZm.png



Whereas an Electrum encrypted wallet looks like this:
https://talkimg.com/images/2023/11/15/zcJ3W.png





Do you remember which Electrum version you use before? If it is below Electrum 2.7 version the old wallet file will not work in the latest version base on my experience you may need to use the old version first(You can use portable version if you don't want to replace your latest version) and get the seed phrase since it's encrypted it will ask for the password.
For the record, Full wallet file encryption was only added in version 2.8.0

# Release 2.8.0 (March 9, 2017)
  * Wallet file encryption using ECIES: A keypair is derived from the
    wallet password. Once the wallet is decrypted, only the public key
    is retained in memory, in order to save the encrypted file.
Earlier versions only encrypted "sensitive" data within the file (like private keys/seeds etc), but the structure of the file itself was still in "plaintext"... like this 2.7.0 wallet:
https://talkimg.com/images/2023/11/15/zcVBJ.png


Title: Re: 'utf8' decode error by opening the wallet?!
Post by: khaled0111 on January 11, 2020, 04:48:42 PM
It looks like an encoding problem.
No idea what caused the problem in first place, my best guess is that the file got corrupted during the recovery process.

I was able to reproduce the error by opening a wallet file with notepad and save it after editing the encoding format from "UTF-8" to "Unicode big endian"/"UTF-16".
Here is what i get when I open the wallet file with Electrum:

https://i.imgur.com/A3UP8Rq.jpg

and here is how the file looks like when trying to open it on WordPad:

https://i.imgur.com/w86zKc3.jpg

However it works fine on notepad. Therefore, Isuggest that OP tries to open the file with other text editors and see if that solves his problem.

If it doesn't, then he may also try opening it using an Hex editor. I used https://hexed.it/ to explain how it works. (However, OP should use a reliable software run locally to avoid exposing his private keys.)
Upload the wallet file and use the search feature to search for the word "seed". You'll get something like this:

https://i.imgur.com/vVpYHRI.jpg

Then you will be able to restore your wallet from seed. Hope this works for you.

edit: if the wallet is encrypted then the above will be worthless without the password to decrypt it.


Title: Re: 'utf8' decode error by opening the wallet?!
Post by: pooya87 on January 12, 2020, 04:51:51 AM
I was able to reproduce the error by opening a wallet file with notepad and save it after editing the encoding format from "UTF-8" to "Unicode big endian"/"UTF-16".

i don't think that is not reproducing the issue that OP has.
what you did was practically changing the contents of the wallet file that makes it impossible for Electrum to read its content anymore because it is in an entirely different encoding.
the problem OP is facing is probably in a small couple of bytes inside the wallet content and when the reader reaches that part it fails to continue.


Title: Re: 'utf8' decode error by opening the wallet?!
Post by: HCP on January 12, 2020, 08:39:15 AM
Did you see the screenshot he posted? I'd wager that it is more than "a small couple of bytes". The entire file looks totally corrupted. Even fully encrypted Electrum wallet files still contain standard ASCII "printable" text characters (https://en.wikipedia.org/wiki/ASCII#Printable_characters). The OP's file just looks like binary data being rendered in a text editor. Similar to what you would see if you were to open a .dll or an .exe file in Notepad. :-\