16

I have purchased bitcoins and have downloaded Bitcoin-QT, but my wallet is taking forever to synchronize to the network.

I can't access my wallet because it is still in the sync process. I have the record of me paying for the Bitcoins, the confirmation email, etc., and the address it has been sent to. I desperately want to start spending them. What can I do to gain access immediately without waiting for the synchronization to run its course?

Murch
  • 75,206
  • 34
  • 186
  • 622
Alex Jackson
  • 169
  • 1
  • 3

4 Answers4

8

One solution is to export (in your privacy) the private key connected to the address on which you received your Bitcoins (or simply all private keys). This can be done using a command line tool known as pywallet.

Then, you can import this key (or all your keys) into another wallet. Browser-based wallets such as https://blockchain.info/wallet do not require syncing. Hence you can immediately spent your coins. For the bĺockchain.info wallet the procedure is described on their website.

Jan
  • 1,000
  • 1
  • 6
  • 14
Freemanix
  • 81
  • 1
  • how do i find out my private key? i have encrypted my wallet.i have looked on the net for CLI interface but i dont understand. i have created a new online wallet and am hoping to export the bitcoins to that wallet if i can – Alex Jackson Jan 08 '13 at 12:44
  • 2
    @AlexJackson instructions for exporting private keys from bitcoin-qt are here http://bitcoin.stackexchange.com/a/5933/2531 – Don Park Jan 08 '13 at 17:41
4

I had to do this for a Dogecoin wallet that was very out of sync once. I will outline the steps that worked for me. My example will be for Bitcoin, though, since that's probably what most people will need.

Caution: this is a bit technical, but it works. Expect this to take probably 10-30 minutes. This also assumes you are using a standard Pay-To-Pubkey-Hash address (for bitcoin, this just means an address that starts with a 1).

1.

Obtain the address that you were sent coins to. This is an address that the unsynced Bitcoin-QT wallet previously generated. For this example, I will use

13x1ZipMJJbVawV7voCtW5qSoBUTwx13Nr

as my address that I need to get coins out of.

2.

Go to https://insight.bitpay.com/address/{{ your address }}.

Find the transaction TXID, output index, and amount of the coins you are trying to spend from the block explorer.

  • To get the transaction ID, use the hex code at the top of the transaction box.
  • To get the output index, count the transaction outputs from zero until you find your address. For example, in the transaction shown below, my 13x... address received coins in the first output, which means index zero. If it were in the second output, it would be index 1, etc.
  • To get the amount, make sure you select "BTC" as the website units (in the top right). Then copy the amount from the output where you see your address receiving coins.

So for me, the important information here is:

txid:   83a1007401a6acb656668afc137b9c02ca023ae274e0f12abbc79395a89b6b79
index:  0
amount: 0.00231499

enter image description here

3.

The other piece of information that we need is the scriptPubKey. This is basically just a more low-level encoding of the address.

To get this, click the "+" icon to the left of the TXID (still on the same insight page as before). Under your address, it will say something like:

OP_DUP OP_HASH160 205799b3b8bdba5824b0129eec27450b0cfde7eb OP_EQUALVERIFY OP_CHECKSIG

Now the scriptPubKey that you want is using those middle 40 hex characters, plus a few more. The basic formula is:

scriptPubKey = "76a914" concat {{ hex chars from above }} concat "88ac"

So for my example, we have:

scriptPubKey: 76a914205799b3b8bdba5824b0129eec27450b0cfde7eb88ac

4.

Almost done!

Get the address you want to send the coins too. I will use

1PwFdFxP7uXrun8sToCrWXxVdpeDeX6dfq.

5.

Now we are going to create a transaction and send it out to the network.

Open up the unsynced Bitcoin-QT wallet (or start the bitcoind daemon), and go to the Help menu, and select Debug Console. In the window that opens, replace the appropriate fields, and then type:

createrawtransaction '[{ "txid": "{{ your txid }}", "vout": {{ your index }} }]' '{ "{{ your address from step 4 }}": {{ amount - fee }} }'

Typically, a fee of about 0.0001 applies.

So, for me this looks like:

createrawtransaction '[{ "txid": "83a1007401a6acb656668afc137b9c02ca023ae274e0f12abbc79395a89b6b79", "vout": 0 }]' '{"1PwFdFxP7uXrun8sToCrWXxVdpeDeX6dfq": 0.00221499}'

And the result is

0100000001796b9ba89593c7bb2af1e074e23a02ca029c7b13fc8a6656b6aca6017400a1830000000000ffffffff013b610300000000001976a914fb9570085ff3acfef21eac307223eaa499e1e21188ac00000000

Now we just have to sign it. This has to be done on the same daemon that generated the address, so that you have the private keys. Replace with your appropriate fields and then execute:

signrawtransaction {{ hex from createrawtransaction step above }} '[{ "txid": "{{ your txid }}", "vout": {{ your index }}, "scriptPubKey": "{{ your scriptPubKey }}" }]

So, for me this looks like:

signrawtransaction 0100000001796b9ba89593c7bb2af1e074e23a02ca029c7b13fc8a6656b6aca6017400a1830000000000ffffffff013b610300000000001976a914fb9570085ff3acfef21eac307223eaa499e1e21188ac00000000 '[{ "txid": "83a1007401a6acb656668afc137b9c02ca023ae274e0f12abbc79395a89b6b79", "vout": 0, "scriptPubKey": "76a914205799b3b8bdba5824b0129eec27450b0cfde7eb88ac" }]'

The result looks like:

0100000001796b9ba89593c7bb2af1e074e23a02ca029c7b13fc8a6656b6aca6017400a183000000006a4730440220000000000000000000000000000000000000000000000000000000000000000002200000000000000000000000000000000000000000000000000000000000000000012102e25c37498e9e62b2ebcc85780e10949eaacd29826b5ca97a1031ee22e55f0ab5ffffffff013b610300000000001976a914fb9570085ff3acfef21eac307223eaa499e1e21188ac00000000

6.

Using the final result of step 5, go to

https://live.blockcypher.com/btc-testnet/pushtx/

And enter the raw transaction hex. Select the "Bitcoin" network, hit the "Broadcast Transaction" button, and you will have successfully removed your coins from the unsynced wallet!

(I don't have any affiliation with any of the services used here, I just found them useful for this answer.)

morsecoder
  • 14,168
  • 2
  • 42
  • 94
3

Open the console on Bitcoin Core. Type dumpprivkey and the public address. It will give you the private key. Then import the private key to whatever thin client you want.

Murch
  • 75,206
  • 34
  • 186
  • 622
Niccolò
  • 31
  • 1
  • 1
    You could even send the transaction from that same wallet if you create, sign and broadcast a raw transaction from the console. It is not something for someone wanting to make his first payment, but worth mentioning anyway. – Fernando Gutierrez May 06 '16 at 15:30
1

Find the wallet.dat file with generated public-private key pairs and run bitcoin client with the file on other machine.

  • 1
    This is a good answer, but it should be explained a bit better. E.g. it should contain a warning to make a backup of the other wallet on the computer that has already synchronized. – Murch Dec 22 '15 at 09:49