Bitcoin Forum

Bitcoin => Bitcoin Technical Support => Topic started by: ingrownpocket on November 03, 2012, 12:54:26 PM



Title: [SOLVED] I need help - Export priv keys
Post by: ingrownpocket on November 03, 2012, 12:54:26 PM
I have a 9 MB wallet with many txs and about 200 addrs, which many of them have BTC.

Since I cannot open this wallet with bitcoin.org client, I need some other way to extract priv keys and Import them to blockchain.info.
The wallet have a passphrase.

I already tryed that pywallet.py thing but I don't see any priv keys.
I used both pywallet.py -dumpwallet and localhost:8989
It gives me all addresses and txs, which makes my computer super slow.

I have Windows 7 32 bits.

How can I import this wallet priv keys to blockchain.info or any other wallet/client so I can send the BTC inside to my new wallet?


Title: Re: I need help - Export priv keys
Post by: deepceleron on November 03, 2012, 08:59:43 PM
dumpprivkey    <bitcoinaddress>    Reveals the private key corresponding to <bitcoinaddress>

This is the RPC command you want.

While bitcoin-qt or bitcoind is running, open a command window in the C:\Program Files (x86)\Bitcoin\daemon\ directory of windows (remove "(x86)" since you are on 32 bit windows)

example command:
C:\Program Files (x86)\Bitcoin\daemon>bitcoind walletpassphrase myStupidPassword
C:\Program Files (x86)\Bitcoin\daemon>bitcoind dumpprivkey 1BitCoiNMeeTtSD9nX2RHvoWS2ZH6AMgmm
(private key appears here)


Title: Re: I need help - Export priv keys
Post by: Pieter Wuille on November 03, 2012, 09:02:43 PM
This can also be done from the debug console since Bitcoin-Qt 0.7.


Title: Re: I need help - Export priv keys
Post by: flatfly on November 03, 2012, 09:36:34 PM
I have a 9 MB wallet with many txs and about 200 addrs, which many of them have BTC.

I'm not seeing myself doing that one by one.

I think this should be easier to script through a BAT file...


Title: Re: I need help - Export priv keys
Post by: deepceleron on November 03, 2012, 11:33:10 PM
You can use listreceivedbyaddress to print out all the addresses that you have ever received money at:

>bitcoind listreceivedbyaddress | findstr address > addresslist.txt

Then some clever search and replace can turn that into a .cmd file to do the above key export for each one:

Code:
powershell.exe
Get-Content addresslist.txt | ForEach-Object { $_ -replace "` ` ` ` ` ` ` ` `"address`" : `"" , "bitcoind dumpprivkey " } | ForEach-Object { $_ -replace "`"," , " >> privkeylist.txt" } | Set-Content export.cmd
exit