This guide is intended for former users of Bitcoin Core who wish to very securely transfer Bitcoin from an archived wallet.dat file into a new secure storage target (e.g. hardware wallet) using a process that keeps all private keys off of any online computer.
Before reading this page, users should note that directly manipulating ECDSA private keys is dangerous and can result in losing bitcoins.
- Safely sweep Bitcoin from a wallet.dat file and send to a new address.
- Never allow wallet.dat or any private keys to touch online computer.
- Use GUI tools that minimize complication and potential for mistake.
- You are paranoid and don't trust the security of your online computer.
- You have a hardware wallet or other secure means of storing Bitcoin.
- You like doing things in a more complicated way than otherwise necessary by more trusting folk.
- You aren't comfortable manually building Raw Transactions from UTXOs and playing with big opaque hex strings.
Read This First
Less paranoid people may find the following article simpler and easier, which also describes in more detail obtaining the relevant software and other basic topics:
Less paranoid people seeking to move Bitcoin from a wallet.dat to another address may also simply use Bitcoin Core itself directly, bypassing all complexity of offline transactions.
The following ALL-CAPS terms are introduced here and used below consistently.
- NET-PC : An online computer with potential malware.
- OFFLINE-PC : A secure offline computer without network access.
- USB-STICK : A USB stick to transfer files over air gap.
- WALLET.DAT : A high value wallet.dat file stored offline.
Software (always verify signatures!)
- OFFLINE-PC [Bitcoin Core] Dump addresses from wallet.dat using at least (NOTE: this part needs review - how best to simply and reliably list all addresses?):
- <code>listreceivedbyaddress 0 true</code>
- Copy addresses to NET-PC via USB-STICK.
- NET-PC [Electrum] Create "Watch Bitcoin Addresses" wallet using exported addresses. See which have balances.
- OFFLINE-PC [Bitcoin Core] Dump each private key from wallet.dat: <code>dumpprivkey "$ADDR"</code>.
- OFFLINE-PC [Electrum] Create "Standard Wallet" with "Use public or private keys" using (copy/paste) desired private keys.
- NET-PC [Electrum] Generate transactions and save them to USB-STICK.
- OFFLINE-PC [Electrum] Sign transactions and save them back to USB-STICK.
- NET-PC [Electrum] Broadcast transactions from USB-STICK.
- OFFLINE-PC: Wipe drive.
Simplifications for sweeping a paper wallet
If you have a paper wallet (with private key and address written on it) instead of a wallet.dat file, you may simplify the instructions as follows:
- No need to install Bitcoin Core on OFFLINE-PC.
- Skip steps 1 and 2, and use address directly in step 3.
- Skip step 4, and use private key directly in step 5.