http://dl.dropbox.com/u/1139081/extractKeys.tar.gz
Keep in mind, this utility is going to create a new file on your computer with your private keys. Handle with care!
Now, I want to create something that converts the flat file back into a wallet. This will allow someone to extract keys from multiple wallets, combine them into a single file, and the create a merged wallet. The output file format looks like this:
PubKey:
cfd41f6ab9a217380bd2dc370592635797759c7de172f5cc6b228c1d4f83dde2
44f5a373bf80e66db4c0d34a892def09d1f605aef0d94f6b2c3e0322dfdd331e
PrivKey:
7bb1e283fe1007757c75966706553e16cdb5f148c22712811a78e6bcf30c9a1b
1QXg28gA7mLBB9LSMgf4sjoB9batJBXEtB:
PubKey:
47634c35731a35b5b70d4959418dae2e1c6676a1007626092eef8bceb80e1b16
0d048e2a917c80a3f5f085a06ce4c88f78d66c82abf2f2a1683c171f8bbdb7ab
PrivKey:
6cd77c1cc66929e6db9bf4b502f4ce4868cb76037b66d630fd931a0ea2fb8bce
...
-- The first string is the address, which should be fairly obvious.
-- The PubKey is two 32-byte numbers (x,y), which correspond to a point on the secp256k1 elliptic curve (the ECDSA curve used by the bitcoin network)
-- The PrivKey is literally a random 32-byte number, which gives the public key when you multiply the generator point by this number. Yes, a private key is just a random number. As such, there is no way to identify whether a string of digits is a private key, without having a public key to compare to. Or rather, every 256-bit number is a private key, so a "private key" is only meaningful in the context of a public key point (x,y). (all hex numbers are encoded in BigEndian)
Anyone want to help converting pub/priv keypairs into a wallet file? I believe it can be done with the bsddb package in Python, but I haven't gotten it to work, myself, yet.
However, I modified it a bit and it's more practical
Basically I added the possibility to import a key:
- with its label
- in a wallet not named 'wallet.dat'
- as a reserve key (the hidden ones not shown in bitcoin adress book)
Here are both:
https://github.com/jackjack-jj/pywallet
https://github.com/joric/pywallet
Edit: I now read your entire message
I made a script too to backup the keys of a wallet into a new one automatically using my pywallet, without writing keys to the hdd
You may take a look: http://forum.bitcoin.org/index.php?topic=31418.0