Bitcoin Core is an advanced user wallet requiring potentially many days of setup. Nevertheless, beginners routinely find themselves in the desperate situation of having accepted a payment through Bitcoin Core but needing immediate access to the funds. This article describes one solution.
Bitcoin Core downloads and validates the full block chain from the network. This procedure, known as “synchronization” or “syncing,” is extremely CPU-intensive. Time to completion depends on your computer, but could take days or more than a week of nonstop operation.
In the meantime, your wallet will for most practical purposes be useless. Before spending your payment, the wallet must validate the block containing your transaction’s parent. In many cases, this block will be recently-generated. Blocks are validated sequentially, from the very first to the most recent. Spending most payments will therefore require a nearly complete sync.
You can avoid the wait by switching from Bitcoin Core to Electrum. Unlike Bitcoin Core, Electrum doesn’t need to validate the entire block chain. It starts up almost instantly, and offers a good security tradeoff in most cases. Download and install Electrum as described previously.
This tutorial describes a procedure that can result in theft of your money. Do not proceed until you understand the risks involved.
A network-based attacker can steal bitcoin from you in one of two main ways: (1) by stealing your private key directly; and (2) by diverting payment through replacement of a destination address. Other attacks may also be possible. Unfortunately, the only way to know for sure whether your system has been compromised is to experience an attack.
The most secure option is to avoid exposing your private key(s) to the network. A more lengthy, but more secure, procedure for doing so is described here.
Assumptions and Conventions
This article assumes you’re running Bitcoin Core 0.16.0 and Electrum 3.1.3. You may need to modify the proceure if using other versions.
The screenshots presented here depict Bitcoin Core and Electrum running on testnet. Testnet is an altcoin (the first, in fact) that mimics most of Bitcoin’s properties. The most visible difference between mainnet and testnet is the format of addresses and private keys. Your Bitcoin Core addresses are likely to start with a “3,” your Electrum addresses are likely to start with a “1,” and your private key is likely to start with a “K” or “L.”
From Bitcoin Core
The goal of this part of the procedure is to extract from Bitcoin Core one or more private keys controlling payments to be spent.
Begin by hiding the wait screen overlay if it’s currently showing.
Next, find the addresses controlling your payments. The simplest way to do this is to double-click on the payment request under the Receive tab. A list of them will appear near the bottom of the window under “Requested payments history.”
Double clicking an item on the list produces an address window. Click “Copy Address” to copy the address to your clipboard, then close the window.
Now extract the private key for the address you copied. To do so, pull up the Console with the Help>Debug Window main menu. Then click on the Console tab. Obtain your private key by entering the following command into the lower text input:
<address> is the address you previously copied to the clipboard. It can be pasted with ctrl-v or by right-clicking. Pressing the enter key executes the command and should return a line of text, your private key. Copy it by selecting and then pressing ctrl-c or right-clicking.
If your wallet has a passphrase, you’ll get the error: “Error: Please enter the wallet passphrase with walletpassphrase first. (code -13).” This error can be avoided by temporarily unlocking the wallet. For example, unlock for 5 minutes (300 seconds) with:
walletpassprhase <passphrase> 300
<passphrase> is your wallet’s passprhase.
At this point, your private key has been copied to the clipboard.
In the next phase of this procedure, you’ll use the Bitcoin Core private key to create a payment into your Electrum wallet.
If you haven’t already done so, start Electrum. Choose the Wallet>Private Keys>Sweep option from the main menu. Into the window that pops up, enter the following:
<private key> is the private key you copied from Bitcoin Core. Multiple private keys can be entered by using one line for each.
It may not be obvious why the text “p2wpkh-p2sh:” precedes the private key. In a nutshell, Electrum needs to be told how to produce an address from the private key that’s being swept. Bitcoin Core 0.16 currently uses a new style of address by default. Electrum won’t regenerate it correctly unless directed how. More information is available on this issue.
If you fail to provide the needed private key prefix, Electrum will respond with the error message: “No inputs found. (Note that inputs need to be confirmed)”.
Having entered the prefix and private key, click Sweep. Electrum will present a screen allowing you to review the transaction before proceeding. Be sure the fee being paid makes sense, and that the amount being transferred matches your expectation. If not, you can cancel the sweep to try again by pressing Clear.
Examine your transaction in more detail by clicking the Preview button. The exact amount of your fee and your source/destination addresses will be presented. Close this window when you’re ready.
Finally, click the Send button. You’ll be asked if it’s Ok to proceed. Click Yes. Dismiss the dialog telling you that payment succeeded.
Monitor the progress of the transaction from the History tab. Your payment is spendable immediately, but it’s a good idea to wait for one or two confirmations.
Accepting a payment with an unsynced Bitcoin Core wallet is a common beginner mistake. Even so, experienced users can find themselves in a similar situation after long periods of wallet inactivity. Provided that the recovery risks are acceptable, this procedure will allow you to move on.