Post
Topic
Board Bitcoin Technical Support
Re: Old wallet.dat from 2011
by
Stalesamy
on 24/02/2021, 12:22:39 UTC
You must be using Python 2 because it's default behavior for the decode() method is to use the "ascii" codec which can't handle any bytes greater than 0x7f , while Python 3 switched to the "utf8" codec which does handle all kinds of bytes.

Running Pywallet using Python 3 is going to remove this error, but I notice your stack trace also has json_db[type] = 'unsupported'. Which points to one of two possibilities:

- either your friend gave you a weird wallet.dat that has an unsupported field in the database, or:
- you are using an experimental build of pywallet and cloned the Github repo while jackjack was updating stuff.

I'm inclined to think it is the second possibility so can you try rolling back to an older commit by running "git checkout COMMIT_ID_You_get_from_github"?

So he emailed me the wallet.dat file, I put it into the pywallet directory, ran python3 pywallet.py --dumpwallet --wallet=wallet.dat

and I get :

Wallet data not recognized: Bdict({'__key__': b'\bunch of stuff like \x03\x11\xab ', '__value__': b'UNKNOWN_DATA', '__type__': b''})
Wallet data not recognized: Bdict({'__key__': b'\bunch of stuff like \x03\x11\xab', '__value__': b'UNKNOWN_DATA', '__type__': b''})
Wallet data not recognized: Bdict({'__key__': b'\'bunch of stuff like \x03\x11\xab, '__value__': b'UNKNOWN_DATA', '__type__': b''})
Traceback (most recent call last):
  File "pywallet.py", line 2316, in parse_wallet
    item_callback(type, d)
  File "pywallet.py", line 2716, in item_callback
    json_db[type] = 'unsupported'
  File "pywallet.py", line 111, in __setitem__
    return super(Bdict, self).__setitem__(bytes_to_str(k), v)
  File "pywallet.py", line 90, in bytes_to_str
    return k.decode()
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xa1 in position 0: invalid start byte
ERROR parsing wallet.dat, type b'\xa1'
key data: b' bunch of stuff like \x03\x11\xab'
key data in hex: b'long string'
value data in hex: b'short string'

To download pywallet on my machine, I ran: git clone https://github.com/jackjack-jj/pywallet.git

I'm not sure what you mean by "you are using an experimental build of pywallet and cloned the Github repo while jackjack was updating stuff."

Could you walk me through?

-Thanks for your help