Bitcoin Forum

Bitcoin => Bitcoin Technical Support => Topic started by: kdn on April 03, 2019, 10:08:54 PM



Title: pywallet recovery help
Post by: kdn on April 03, 2019, 10:08:54 PM
Hi all,

I have an encrypted wallet.dat that is 3 years old. I have tried the easy methods (opening Core, replacing the wallet.dat, importing into electrum etc) but everything comes back as saying my wallet is corrupted.

As a last resort I am trying to run pywallet recovery on a usb stick with my dat file. I am getting a strange error though:


root@linux-box:~/Desktop/btc# ls -l /mnt/usb
-rw-r--r-- 1 root root 31667 Mar 31 16:09 wallet.dat


python pywallet.py --recover --recov_size=256Mo --recov_device=/mnt/usb/ --recov_outputdir=./
Enter the passphrase for the wallet that will contain all the recovered keys: ****

Starting recovery.
Traceback (most recent call last):
  File "pywallet.py", line 4870, in <module>
    recoveredKeys=recov(device, passes, size, 10240, options.recov_outputdir)
  File "pywallet.py", line 1467, in recov
    r=search_patterns_on_disk(device, size, inc, map(lambda x:nameToDBName
  • , ['mkey', 'ckey', 'key']))
  File "pywallet.py", line 1350, in search_patterns_on_disk
    if lendataloaded%512>0:
TypeError: unsupported operand type(s) for %: 'NoneType' and 'int'


Could this just be an OS issue? I'm running Debian. Python version is 2.7

thanks!


Title: Re: pywallet recovery help
Post by: HCP on April 03, 2019, 10:56:58 PM
Could this just be an OS issue? I'm running Debian. Python version is 2.7
No... I'd say that it is most likely because you have an "upgraded" wallet.dat file that has new data fields in it. Pywallet hasn't been updated in a long time... and it doesn't play nicely with the newer wallet.dat format.

I posted a quick "workaround/hack" for it here: https://bitcointalk.org/index.php?topic=34028.msg30435668#msg30435668

Basically, it just ignores the new (irrelevant) data fields and should continue on it's merry way and dump the file contents.