Bitcoin Forum

Alternate cryptocurrencies => Altcoin Discussion => Topic started by: patrickquinn on January 04, 2014, 06:18:07 AM



Title: [Help] [Bounty] Recovering LTC Wallet using Pywallet
Post by: patrickquinn on January 04, 2014, 06:18:07 AM
 My wallet disappeared over a year ago with 200+ LTC in it, possibly due to me running CCleaner for Mac over my machine (which looks for and deletes .dat files as part of its sweep as far as i can tell). I have made several attempts to locate my wallet including using Photorec and dumping the existing wallet.dat, but to no avail. I am going for one last chance attempt to recover it before giving up and moving on.

I am attempting to use pywallet to recover the wallet from my machine by issuing the following,
Code:
sudo ./pywallet.py --datadir=/Users/patrickquinn/Library/Application\ Support/Litecoin/ --recover --recov_size 121.3Gio --recov_device /dev/disk0 --recov_outputdir /Users/patrickquinn/Desktop/Looking --otherversion=48
which returned

Code:
Read 121.3 Go in 58.5 minutes

Found 0 possible wallets
Found 0 possible encrypted keys
Found 1640 possible unencrypted keys

and left two files, recovered_wallet_1388812907.dat and pywallet_partial_recovery_1388812907.dat in the specified 'Looking' directory.

Can these unencrypted keys be recovered or am i snookered?

Any help  with this would mean the world to me :)

The first person to come up with a successful solution to this problem and aid me in restoring my LTC will get 10 of them which is roughly 240 Dollars at current market value.

Thanks guys.


Title: Re: [Help] [Bounty] Recovering LTC Wallet using Pywallet
Post by: patrickquinn on January 04, 2014, 07:25:59 AM
Bounty added.


Title: Re: [Help] [Bounty] Recovering LTC Wallet using Pywallet
Post by: magnux on May 27, 2014, 06:14:33 AM
Dood, I feel your pain, I just went through it. I lost my keys, I recovered them from hard drive surface, but I couln't do anything with the recovered wallet, why? well, I detected a bug in pywallet, it is not behaving well for litecoin.

Anyway, I managed after a lot of debugging to sort it out, and fixed it, partially.
Here is my repo on github https://github.com/magnux/pywallet, it is exactly the same as the original, except for the line 1231, where I changed "prefix = chr(128)" for "prefix = chr(176)". This small fix will let you dump your keys correctly.

You're not screwed, if you still have those recovered .dat of course.

So, the recipe:
1) Download MY pywallet https://github.com/magnux/pywallet.

2) Recover it:
If you have already recovered your wallet:, you can use your recovered .dat. It might issue a warning later, in the dumping phase, because of the chr mismatch, ignore it.
If you haven't:
Code:
python pywallet.py --otherversion 48 --recover --recov_size=<yoursize> --recov_outputdir=recovered/ --recov_device=<your device or file>
(I discovered that a .db file recovered by photorec works just as fine as recovering from the surface of the disk directly with pywallet)

3) Dump it(the info):
Code:
python pywallet.py --otherversion 48 --datadir=recovered/ --wallet=recovered_wallet_<yournumber>.dat --dumpwallet --passphrase=<yourpass>  > litewallet.dump

4) Extract it:
Code:
cat litewallet.dump | grep "\"sec\":*" | sed 's/.*: \"//g' | sed 's/\",.*$//g' > liteprivatekeys.txt

This will extract all your keys in lines.

5) Import it:
Using litecoind, you can import it, this process is painstakingly slow, it has to rescan each time imports a key into the wallet.
Run the server and let it sync the block, after that you can use this line:

Code:
while read i; do echo "Importing Key: $i"; /<pathtolitecoind>/litecoind importprivkey $i; done < liteprivatekeys.txt

6) Enjoy:
This process will allow you recover your keys, guaranteed, I just done so with mine.
All your keys will be associated with the "" account, and you'll be able to get your coins out via litecoind sendtoaddress

I hope this helps the mankind. :)

tips: LeNXP1KhagNUFfy9XKq1wn5quK6du2LX1R


Title: Re: [Help] [Bounty] Recovering LTC Wallet using Pywallet
Post by: doncello on December 12, 2017, 05:51:41 PM
Hi,
Ive lost my wallet file as well for litecoin. Can you help me pls to try to recover it on windows? If its successful I can give out 2LTC bounty.


Title: Re: [Help] [Bounty] Recovering LTC Wallet using Pywallet
Post by: ashraful1980 on July 12, 2020, 07:28:09 AM
Dood, I feel your pain, I just went through it. I lost my keys, I recovered them from hard drive surface, but I couln't do anything with the recovered wallet, why? well, I detected a bug in pywallet, it is not behaving well for litecoin.

Anyway, I managed after a lot of debugging to sort it out, and fixed it, partially.
Here is my repo on github https://github.com/magnux/pywallet, it is exactly the same as the original, except for the line 1231, where I changed "prefix = chr(128)" for "prefix = chr(176)". This small fix will let you dump your keys correctly.

You're not screwed, if you still have those recovered .dat of course.

So, the recipe:
1) Download MY pywallet https://github.com/magnux/pywallet.

2) Recover it:
If you have already recovered your wallet:, you can use your recovered .dat. It might issue a warning later, in the dumping phase, because of the chr mismatch, ignore it.
If you haven't:
Code:
python pywallet.py --otherversion 48 --recover --recov_size=<yoursize> --recov_outputdir=recovered/ --recov_device=<your device or file>
(I discovered that a .db file recovered by photorec works just as fine as recovering from the surface of the disk directly with pywallet)

3) Dump it(the info):
Code:
python pywallet.py --otherversion 48 --datadir=recovered/ --wallet=recovered_wallet_<yournumber>.dat --dumpwallet --passphrase=<yourpass>  > litewallet.dump

4) Extract it:
Code:
cat litewallet.dump | grep "\"sec\":*" | sed 's/.*: \"//g' | sed 's/\",.*$//g' > liteprivatekeys.txt

This will extract all your keys in lines.

5) Import it:
Using litecoind, you can import it, this process is painstakingly slow, it has to rescan each time imports a key into the wallet.
Run the server and let it sync the block, after that you can use this line:

Code:
while read i; do echo "Importing Key: $i"; /<pathtolitecoind>/litecoind importprivkey $i; done < liteprivatekeys.txt

6) Enjoy:
This process will allow you recover your keys, guaranteed, I just done so with mine.
All your keys will be associated with the "" account, and you'll be able to get your coins out via litecoind sendtoaddress

I hope this helps the mankind. :)

tips: LeNXP1KhagNUFfy9XKq1wn5quK6du2LX1R



Dear Sir,
I would like to draw your kind attention that i have some error to use to your script. Please suggestion how to solve it:
C:\Users\PC\Downloads\pywallet-master>python pywallet.py --otherversion 48 --datadir=recovered/ --wallet=wallet.dat --dumpwallet --passphrase=./   1>wallet.dump
Traceback (most recent call last):
  File "pywallet.py", line 5008, in <module>
    db_env = create_env(db_dir)
  File "pywallet.py", line 1267, in create_env
    r = db_env.open(db_dir, (DB_CREATE|DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_MPOOL|DB_INIT_TXN|DB_THREAD|DB_RECOVER))
bsddb.db.DBNoSuchFileError: (2, 'No such file or directory -- recovered/__db.001: No such file or directory')