vrijdag 26 oktober 2012

Save Bitcoins from Android Bitcoin Wallet app


Introduction
In this article, I describe the process to recover Bitcoins from the Android app 'Bitcoin Wallet ' written by Schildbach into the official Windows bitcoin client (version 7). The process is fairly easy but this guide may help the less tech savy users and save them trouble (or worse, lost Bitcoins).

But for those unfamiliar with Bitcoin , first something about the Bitcoin protocol itself.

Bitcoin protocol

Since the inception in January 2009, the Bitcoin network has grown rapidly into a system for digital payments. While the exchange rate has shown large swings and the blogs are filled with numerous stories about user scams and thefts of wallets, Bitcon's future seems bright as a cheap and free payment protocol.

If you want to learn more about the basics of the Bitcoin protocol, http://www.bitcoin.org and http://www.weusecoins.org are great starting points.

Android Bitcoin Wallet
There are several Bitcoin clients available for Android. One of them is 'Bitcoin Wallet' written by Schildbach. It has a gorgeous UI and useful options such as import/export of keys. While  you should give it a try, the app does not behave very well on my HTC Desire HD. Of course, please keep in mind that development is still fresh (and the app is free).
   (screenshot Bitcoin Wallet app)

I collected a few bits of mBTC (0.001 BTC)  which did show up in the app. Unfortunately, after multiple receipts of mBTC's, the app did no longer perform a full update. While I was able to view a total balance of some 0.40 BTC (via blockchain.info by searching on the app's BTC receiving address), the app would not show a balance of more than 0.39 BTC. Worse, the app would not let me make payments, presumably because the real balance of my BTC address did not match the balance recorded and shown by the app.

Thankfully, as from version 2.23 Bitcoin Wallet supports exporting 'private keys'. In essence, the private keys give the holder thereof the power to spend the bitcoins in the related BTC address. Think of it as a password required to send Bitcoins from that address. Moreover, it proved easy to communicate with Schildbach, who is very responsive and which got me on the right track for recovery.
Recovery of Bitcoins
It all starts with the Android app.

1. Export the private keys to the SD Card of your device by choosing that option from the app's menu

2. the app will prompt you to use a password; the private keys will be stored as a .txt file, but only in encrypted form (for security reasons)

3. the .txt file thus retrieved contains the private keys, albeith with a strong encryption
Now we move to Windows XP

4. to decrypt the .txt file, you will need appropriate software. I used OpenSSL for Windows (available at http://gnuwin32.sourceforge.net/packages/openssl.htm). Install the software (I chose to install developer files as well, but did not chose to install the sources)

5. Now it gets a little nerdy: you will have to use the Windows command line. Back to the days for MS-DOS folks and everyday-business for hardcore Linux users, the command line may be unknow territory for regular Windows users. It begins with clicking the 'Start' button, followed by the 'Run' item from the menu. If you do not see the option 'Run' in your start menu, try Google for answers on how to acces the 'Run' item.

6. In the box that opens, type 'cmd'; the command line will pop up (a window with a black screen and a line of text in white with a blinking cursor awaiting your input)

7. First, you need to go to the directory where the OpenSSL software was installed. Default location is (assuming your 'Program Files' directory is located on the c: drive ): 'c:\Program Files\GnuWin32\openssl'. The command to switch to this directory is:
               
cd "c:\Program Files\GnuWin32\openssl"

Please note that you need to use double brackets ("), not single brackets (').

8. When in the openssl-directory, you will use the openssl.exe program that is located in that directory to decrypt the .txt file. Use the following command to do so:
                
openssl enc -d -aes-256-cbc -a -in <filename>

For <filename> insert the name of your .txt file and don't forget the .txt extension.

The private key is now shown in the window. Don't close the window yet, because you will need to take over the exact sequence of that private key as part of the next steps.

9. The next steps concern importing the retrieved private key into the official bitcoin client. The steps are described in detail at the following link and are thus not described further in this article: https://en.bitcoin.it/wiki/How_to_import_private_keys_v7%2B

Result
If you have completed all steps above, your official Bitcoin client now gives access to the Bitcoins previously inaccessible. Wouldn't want to waste 0.4 BTC - Good as Gold -, would you?

P.S. I now use BitcoinSpinner for Android which is very basic but also very fast and effective. Whatever protocol will prevail, the future of mobile payments is NOW.

Geen opmerkingen:

Een reactie posten