Pages:
Author

Topic: Pywallet 2.2: manage your wallet [Update required] - page 4. (Read 208227 times)

HCP
legendary
Activity: 2086
Merit: 4361
Will this search  through All types of folders and files?  being compressed, zip, and BKF backup files too?
No... any form of compression will modify the actual structure of the underlying data... it has to, otherwise the data can't get "smaller". This will mean that the script will be unable to detect the wallets by inspecting the bytes for the indicators of a wallet file.

It's the same reason why you can't use the "hex string search" method on zip files etc... the data will have changed, and you can't really know how it will have changed... so the "standard" markers you're looking for won't be found...

The only way to do it would be to uncompress the files and then inspect the extracted files... which could be problematic if the archives are encrypted/password protected... and you don't have the password.
member
Activity: 77
Merit: 11
Will this search  through All types of folders and files?  being compressed, zip, and BKF backup files too?
newbie
Activity: 5
Merit: 0
Support of Python 3 is started
Basic things seems to be working but you'll likely find bugs

Also the recovery looks broken, I fixed a small part and I'll fix the rest during next weeks
Sounds like it is coming along nicely... if you get a "stable-ish" release... let me know and I'll do some basic testing on it Wink
Great, I'll let you know!

What is broken in recover? I used recently and got a dump fail

Is there a legacy version that is stable that can be reverted to?
What is broken always has been broken
Today's fix is about compressed keys not being recovered for example
Recent wallets, like the ones using BIP32 seem to be recoverable at least partially but I don't know exactly what works or not

In case I break more things than I fix though, you can try that 'legacy' version here: https://github.com/jackjack-jj/pywallet/tree/b52c955f8c93a75745166ebf281448016e1f22e2

What do you mean by dump fail?

Nevermind, my recover was giving me segmentation fault core dumped error, but I fixed by installing pycrypto.
legendary
Activity: 1176
Merit: 1280
May Bitcoin be touched by his Noodly Appendage
Support of Python 3 is started
Basic things seems to be working but you'll likely find bugs

Also the recovery looks broken, I fixed a small part and I'll fix the rest during next weeks
Sounds like it is coming along nicely... if you get a "stable-ish" release... let me know and I'll do some basic testing on it Wink
Great, I'll let you know!

What is broken in recover? I used recently and got a dump fail

Is there a legacy version that is stable that can be reverted to?
What is broken always has been broken
Today's fix is about compressed keys not being recovered for example
Recent wallets, like the ones using BIP32 seem to be recoverable at least partially but I don't know exactly what works or not

In case I break more things than I fix though, you can try that 'legacy' version here: https://github.com/jackjack-jj/pywallet/tree/b52c955f8c93a75745166ebf281448016e1f22e2

What do you mean by dump fail?
newbie
Activity: 5
Merit: 0
What is broken in recover? I used recently and got a dump fail

Is there a legacy version that is stable that can be reverted to?

HCP
legendary
Activity: 2086
Merit: 4361
Support of Python 3 is started
Basic things seems to be working but you'll likely find bugs

Also the recovery looks broken, I fixed a small part and I'll fix the rest during next weeks
Sounds like it is coming along nicely... if you get a "stable-ish" release... let me know and I'll do some basic testing on it Wink
legendary
Activity: 1176
Merit: 1280
May Bitcoin be touched by his Noodly Appendage
Support of Python 3 is started
Basic things seems to be working but you'll likely find bugs

Also the recovery looks broken, I fixed a small part and I'll fix the rest during next weeks
legendary
Activity: 1176
Merit: 1280
May Bitcoin be touched by his Noodly Appendage
A new 'last resort' feature: the --minimal_encrypted_copy option creates a copy of a wallet but containing only the encrypting parameters and one unused key pair
This tiny wallet could then be shared for people to bruteforce it in case of a lost password situation
Obviously not a perfect solution but better than losing the coins

Code:
$ python pywallet.py --wallet ~/.bitcoin/wallets/test/wallet.dat --minimal_encrypted_copy

Before creating a safe partial wallet you need to check the balance of the following addresses.
You may check the balance on your wallet or using an online block explorer.
Just hit Enter if the address is empty and write 'no' if not empty.


1LKjAaLke66hMdwYgw11nZ2QSaraCjEuRk:
3C7XannaU2cKfQA1hs3a56q63qXng7k8uz: no

1MgjXTP7RMYLD81fNQCyrwHKYgtX3cjjGC: no

1Ed5Bqsfd4mWw3pwv2C8UywGzHWEAMDPJP: no

1947WYGqYYwWWVkBDDppxfQX8Dw2PzqPVb: no

13AdH1Za325jfaYe6vrx5FvUerYn7BpwRX:
3BGxmNSyji5QRzqd9jNnBHPcthvCcoa6Ah:
bc1qzlpyde9m57ur6y58gzqhm37vqmmawp9xcvcvfu:
Are you REALLY sure the 3 addresses above have an empty balance? (type 'YES') YES

Minimal wallet written at wallet.dat.minimal_for_decrypting.dat

Code:
$ python pywallet.py --dumpwallet --wallet wallet.dat.minimal_for_decrypting.dat --passphrase 0000
The wallet is encrypted and the passphrase is incorrect
{
    "ckey": [],
    "keys": [
        {
            "addr": "13AdH1Za325jfaYe6vrx5FvUerYn7BpwRX",
            "compressed": true,
            "encrypted_privkey": "ec8125d0304b9f1b40325f005b33b7e2f228b63b22017b64e330cf19b6d089b0e4052174e798a5a30f0229b2338fa368",
            "pubkey": "03ffa92cd030c601ec86a959641826292bc5d0bab7ec44d6d6a8935e7ab59fe505",
            "reserve": 1
        }
    ],
    "mkey": {
        "encrypted_key": "cbd9dd630c0ae5b3907294a2a1a6096f00c241850cdce57d49a999c38a96669b72861b9ec9098e19859fa250c9c8f951",
        "nDerivationIterations": 136845,
        "nDerivationMethod": 0,
        "nID": 1,
        "otherParams": "",
        "salt": "c5f4f5235fa925c6"
    },
    "names": {},
    "pool": [],
    "tx": []
}
legendary
Activity: 1176
Merit: 1280
May Bitcoin be touched by his Noodly Appendage
I meant "handling the non-crashing" Cheesy
I hope the handling will be done not too far in the future but I'll have to check when the (several?) breaking changes occurred
Also I think many things would be broken anyway but at least as you say people can dump keys, which is 99% of what people use pywallet for I think
HCP
legendary
Activity: 2086
Merit: 4361
stop breaking with recent wallets, handling will be done later though, thanks to HCP for handling that with his fork
I wouldn't say that my fork was "handling" recent wallets... it just ignores all the new data fields that were added so you don't get all the "NoneType" errors and the script doesn't error out when you run dumpwallet Tongue

I"m pretty sure the (very minor) changes I made will likely break other functionality of the wallet... but it means you can dump out one of the newer wallets without the script choking on (mostly) unimportant data Wink
legendary
Activity: 1176
Merit: 1280
May Bitcoin be touched by his Noodly Appendage
New version:
  • stop breaking with recent wallets, handling will be done later though, thanks to HCP for handling that with his fork
  • add --find_address option: this looks for an address in all the keys of the wallet
Code:
$ python pywallet.py --wallet=path/to/wallet.dat --find_address 1Mp26TFhkmyupEFbnuitvTeu8PSiqku6pT --passphrase aaaaaa
[
    {
        "addr": "1Mp26TFhkmyupEFbnuitvTeu8PSiqku6pT",
        "compressed": true,
        "encrypted_privkey": "45421e5f31d614803dbdbd1419b6c0fb5cacf61d3a371de637afa3b8c502ae4fc5c674d0421dcf3f246265f6ecae0f81",
        "hexsec": "2a26e47fda8e7a0a345f6e4e4da2afa88ee2b69b57eb468911cf73da448f0bcd",
        "pubkey": "02008fa3d569d00ac7ae31edbc3cc3f99a59b4e9ee21ae37af8dfe3d50319747b7",
        "reserve": 1,
        "sec": "KxdeaXTuE7ZVKX92AzPCaiLfnNwYQeSWrrrGsrXYW5y34v6BMiQB",
        "secret": "2a26e47fda8e7a0a345f6e4e4da2afa88ee2b69b57eb468911cf73da448f0bcd01"
    }
]

legendary
Activity: 1176
Merit: 1280
May Bitcoin be touched by his Noodly Appendage
I pushed a new version that support BIP32 key derivation with ranges in path (red)
Quote
$ python pywallet.py --dump_bip32 xprv9s21ZrQH143K31xYSDQpPDxsXRTUcvj2iNHm5NUtrGiGG5e2DtALGdso3pGz6ssrdK4PFmM8NSp SBHNqPqm55Qn3LqFtT2emdEXVYsCzC2U m/0/2147483647H/0-2/2147483646H/1-3
m/0/2147483647'/0/2147483646'/1: Kwjbf2aNxQn9Z5kW3FTjWoPVcVVxcT5aAZ6iv2TNT7hxx2YncHYU
m/0/2147483647'/0/2147483646'/2: KzDrZyWjeXR9X1EsccdiikgwUCfJXrS3b4p9hoH8QxzwzxA7peSK
m/0/2147483647'/0/2147483646'/3: L12hzsCFyhkJf7jnnZRMQJyw1ifKi6ZhkGJXD9v54sErS4HjzbdU
m/0/2147483647'/1/2147483646'/1: L1YELgqFKLb3fHbjtBf8n733nbCcFKFHdoWvrHmDBY4JTuXk9Qi5
m/0/2147483647'/1/2147483646'/2: L3WAYNAZPxx1fr7KCz7GN9nD5qMBnNiqEJNJMU1z9MMaannAt4aK
m/0/2147483647'/1/2147483646'/3: L31UHxF3kqYjzE3ucNWCapFYt12oynYeoFAYGUyKGW8WxLkLfxtw
m/0/2147483647'/2/2147483646'/1: L3f4m5XVRTgryT2cMzhzhzQeWZErNSPww6RuvnxtpfzMvfxnNB9y
m/0/2147483647'/2/2147483646'/2: L18MSoLXyxN4xrMyw8FSAn3Hvhpu4ZrUcPhAdXy537QLKNT7KmxE
m/0/2147483647'/2/2147483646'/3: KxmL9CcpGNtUAKARTJQVjgY499pdsfk6iSy2aRHfXomLZwvdaqGS
Quote
$ python pywallet.py --dump_bip32 xprv9s21ZrQH143K31xYSDQpPDxsXRTUcvj2iNHm5NUtrGiGG5e2DtALGdso3pGz6ssrdK4PFmM8NSp SBHNqPqm55Qn3LqFtT2emdEXVYsCzC2U m/0/2147483647H/0-2/2147483646H/1-3 --bip32_format=addr
m/0/2147483647'/0/2147483646'/1: 1KYQU8kvknvN8DQVdqQrPcjxiq8qQ2AjW1
m/0/2147483647'/0/2147483646'/2: 1MdrWZnF5bwM5zxBKZVEHn8rvKbGDjLXX2
m/0/2147483647'/0/2147483646'/3: 1P8fQNc1q3Bqq2BWde7ZSkSyuQLy5YTW2b
m/0/2147483647'/1/2147483646'/1: 17FFNNBCNSrHpp71Xaf136NgN4Q9fzsRu5
m/0/2147483647'/1/2147483646'/2: 14UKfRV9ZPUp6ZC9PLhqbRtxdihW9em3xt
m/0/2147483647'/1/2147483646'/3: 1PK6Ke6kRCxd2Wbj3n16UR7TPZfmxWzJh
m/0/2147483647'/2/2147483646'/1: 1NoJNJjTDmNMHWQyX9z47WV2VWqy3tjeAY
m/0/2147483647'/2/2147483646'/2: 1G3qeLrL5oxjYucUWmFwQzvoZa7p4hgFHL
m/0/2147483647'/2/2147483646'/3: 115NPN9HKQtkiCuiiueQhFkAjNcPPL653x

The blue lines are one of the BIP32 test vector
BIP32 test vectors: https://en.bitcoin.it/wiki/BIP_0032_TestVectors
legendary
Activity: 1176
Merit: 1280
May Bitcoin be touched by his Noodly Appendage
FWIW I just added an option to output the Bitcoin whitepaper inserted in the blockchain (block 230009) using either bitcoin-cli or by downloading the transaction from blockchain.info
The hash is checked in case of untrusted environmenent: https://github.com/jackjack-jj/pywallet/blob/0ab675f68b8ab760ba9c8bfe5687e40afcc363ec/pywallet.py#L3226

(+ small improvements including printing P2SH-P2WPKH and P2WPKH addresses)
legendary
Activity: 1176
Merit: 1280
May Bitcoin be touched by his Noodly Appendage
it would be useful to have:
- updated Pywallet that works "properly" with newer wallet.dat files and doesn't just suppress/ignore errors
- Python 3 compatibility would be a bonus, as Python 2 is now completely unsupported
These 2 are a must, plus these:
- clean that crazy source code, there's no reason for it to be 5000 lines long and to be that ugly
- change the --datadir and --wallet arguments
- kill (for now) the web interface and remove the twisted dependency (that would help reducing the code by the way)
- be more explicit about ecdsa being only optional

When do you think this will be available to download and run??
Honestly I don't know, you can follow the thread and I've put some issues on Github to track what I'm doing/planning
Right now I'm on the code cleaning + python 3 support

The __db.00x files are only internal files for Berkeley DB so not helpful
But yeah you can try the db_dump command (db-utils in apt) on your wallet, it should output a bunch of (sensitive!) hexadecimal data without errors
I just tested with an old wallet of mine, maybe from something like 2013, and it worked as expected
If it works for you then try deleting (backup them if you want but they aren't needed) the __db.00x files
Does the existence of the DB files indicate that Jack Jack found a valid/ actual bitcoin wallet on my device??
Thank you, and welcome back!
As Mek said, no
It just means that the Berkeley DB library created a bsddb environment in this folder, which actually means nothing
Mek
jr. member
Activity: 72
Merit: 6
mtc.mekweb.eu - mega transistor clock
Does the existence of the DB files indicate that Jack Jack found a valid/ actual bitcoin wallet on my device??
No. In my case, the db files were created even if the wallet.dat file was not found.
member
Activity: 77
Merit: 11
The __db.00x files are only internal files for Berkeley DB so not helpful
But yeah you can try the db_dump command (db-utils in apt) on your wallet, it should output a bunch of (sensitive!) hexadecimal data without errors
I just tested with an old wallet of mine, maybe from something like 2013, and it worked as expected
If it works for you then try deleting (backup them if you want but they aren't needed) the __db.00x files


Does the existence of the DB files indicate that Jack Jack found a valid/ actual bitcoin wallet on my device??
Thank you, and welcome back!
member
Activity: 77
Merit: 11


it would be useful to have:
- updated Pywallet that works "properly" with newer wallet.dat files and doesn't just suppress/ignore errors
- Python 3 compatibility would be a bonus, as Python 2 is now completely unsupported
These 2 are a must, plus these:
- clean that crazy source code, there's no reason for it to be 5000 lines long and to be that ugly
- change the --datadir and --wallet arguments
- kill (for now) the web interface and remove the twisted dependency (that would help reducing the code by the way)
- be more explicit about ecdsa being only optional



When do you think this will be available to download and run??
legendary
Activity: 1176
Merit: 1280
May Bitcoin be touched by his Noodly Appendage
Ok done, --datadir is no more
I added a message about the breaking change, I think it is enough
Code:
$ python pywallet.py --datadir abc --dumpwallet --wallet wallet.dat
Breaking change
  The --datadir option has been removed, now the full path of the wallet file must go to --wallet
  If you're not sure what to do, concatenating the old --datadir content, then a directory separator, then the old --wallet should do the trick
  If not, ask for help in the Pywallet thread: https://bitcointalk.org/index.php?topic=34028

I also improved the displayed info for private keys (still P2PKH for now)
Code:
$ python pywallet.py --info --importhex --importprivkey 1
Hexadecimal private keys must be 64 or 66 characters long (specified one is 1 characters long)
Padding with zeroes, uncompressed
Compressed: False
Address (Bitcoin): 1EHNa6Q4Jz2uvNExL497mE43ikXhwF6kZm
Privkey (Bitcoin): 5HpHagT65TZzG1PH3CSu63k8DbpvD8s5ip4nEB3kEsreAnchuDf
Hexprivkey: 0000000000000000000000000000000000000000000000000000000000000001
Hash160: 91b24bf9f5288532960ac687abb035127b1d28a5
Pubkey: 0479be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8

Hexadecimal private keys must be 64 or 66 characters long (specified one is 1 characters long)
Padding with zeroes, compressed
Compressed: True
Address (Bitcoin): 1BgGZ9tcN4rm9KBzDn7KprQz87SZ26SAMH
Privkey (Bitcoin): KwDiBf89QgGbjEhKnhXJuH7LrciVrZi3qYjgd9M7rFU73sVHnoWn
Hexprivkey: 0000000000000000000000000000000000000000000000000000000000000001
    For compressed keys, the hexadecimal private key sometimes contains an extra '01' at the end
Hash160: 751e76e8199196d454941c45d1b3a323f1433bd6
Pubkey: 0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798
legendary
Activity: 1176
Merit: 1280
May Bitcoin be touched by his Noodly Appendage
Actually it'd be better to completely remove this datadir option that confuses many people and makes no sense
Working on it!
Mek
jr. member
Activity: 72
Merit: 6
mtc.mekweb.eu - mega transistor clock
Yes, that was it, it works now, thank you for your kind support Wink
I passed the datadir argument because I didn't want to pollute my home dir with any files that pywallet would output.
I also tried this
Code:
./pywallet.py --dumpwallet --datadir=./w --wallet=./wallet.dat
just in case that "current dir" for pywallet would be different than "current dir" of bash.
I think it would be good to mention in the docs that wallet parameter is relative to datadir if passed Smiley
Pages:
Jump to: