March 19th, 2015
Bitcoin Core runs as a full network node and maintains a local copy of the block chain. This data independence improves wallet privacy and security. Unlike some SPV wallets that leak addresses to peers, Bitcoin Core stores all transactions locally. With local access to the complete set of headers and transactions, Bitcoin Core can use full verification to tell when peers lie about payments.
However, dealing with the block chain comes at a price. An ever-growing data set causes smaller hard drives to fill up quickly. Furthermore, a new wallet canвЂ™t be used until the full block chain is downloaded and processed, which can take several hours on mid-range equipment.
These problems can be solved by moving and copying Bitcoin CoreвЂ™s data directory. This article describes two approaches that can be used with either a new or existing Bitcoin Core 0.10.0 installation.
Although the procedures described here have been tested several times, MurphyвЂ™s law can strike at any time. To protect yourself from loss of funds, make a backup of your wallet now. Start Bitcoin Core and select the File ->, Backup WalletвЂ¦ option. After the backup has been saved, exit Bitcoin Core.
If your data directory already contains a complete block chain and or/wallet, you may want to move it rather than start from scratch. The first step is finding the default data directory. Mac, Windows, and Linux version of Bitcoin Core each store data in a different location. The procedure described here will use a graphical file browser to find it.
On Windows 7, begin by clicking on the Windows menu. Then click your username from the right-hand menu. Windows Explorer should show a folder containing other folders such as Contacts and Desktop . Another folder, AppData is hidden by default. It can be shown by selecting the Organize ->, Folder and Search options menu. From the View tab, click the вЂњShow hidden files, folder, and drivesвЂќ option, then click вЂњOKвЂќ.
Windows Explorer should now display an AppData folder. Double click it. Then enter the Roaming folder, where the Bitcoin folder is contained.
On OS X, open a file browser by selecting the File ->, New Finder Window menu option while running Finder. Next, select the Go ->, Go to FolderвЂ¦ menu option. Enter
/Library into the box and press enter. Double click on the Application Support folder. If youвЂ™ve already run Bitcoin Core, you will see a folder called Bitcoin .
On Ubuntu, open a file browser by clicking on the folder icon in the launcher. The data directory, .bitcoin , is hidden by default. To show it, select the View ->, Show Hidden Files menu option.
Having found the default data directory, we can now copy it. Be sure that Bitcoin Core has been shut down and is no longer running. The software occasionally takes a minute or two to completely exit.
Begin by renaming the Bitcoin Core data directory. Use the name bitcoin-backup . DonвЂ™t move the renamed folder. This allows recovery of the original data directory in case something goes wrong. To recover the original, reinstate the original name of the bitcoin-backup folder (either Bitcoin or .bitcoin ).
If youвЂ™d rather not change the default data directory, you may be able to use the alternative approach described below.
Next copy the renamed bitcoin data directory to a destination of your choice. This can be the same hard drive, an external hard drive, or a removable medium such as USB drive or SD card. Copying data may require only a few minutes or a couple of hours, depending on how up-to-date your copy of the block chain is and the speed of your hardware.
You can now rename the copied folder. For example, it might be convenient to use the name Bitcoin .
If you plan to run Armory on Mac, skip this step.
With no default data directory, Bitcoin Core assumes that this is its first session. Launching Bitcoin Core should yield a welcome screen. This screen gives you to option to store data in the default location or a custom location. Select the second option. Then Click the вЂњвЂ¦вЂќ button to point to the new location of the Bitcoin Core data directory.
Bitcoin Core should continue starting up. When the process completes, the software should work exactly as it did before. When ready to proceed to the next step, close the application.
At this point your system contains two more or less identical copies of the data directory. Assuming there were no issues with the move, the original can now be deleted. Browse to the location of the bitcoin-backup directory and delete it.
Users of Armory on Mac face a tricky problem when trying to move the Bitcoin Core data directory. Armory only recognizes the default data directory on OS X. Moving it means that Armory will no longer function.
Fortunately, the solution is relatively simple. Create a symbolic link from the new data directory to the old default directory. Creating this link allows the new data directory to be used as if it still resided at the old location. Although creating a shortcut through the Finder seems like it should work, it doesnвЂ™t.
Begin by launching the Terminal application. This is most conveniently done by pressing ⌘,-space, then typing the word вЂњterminalвЂќ into the search box. Enter the following command at the prompt to create the symbolic link, where is the path to the new data directory. For example, if you moved the data directory to a folder called Bitcoin on the external drive called вЂњBigdataвЂќ, then replace with /Volumes/Bigdata/Bitcoin .
The backslash after вЂњApplicationвЂќ is required.
Instead of pulling the data directory out from under Bitcoin Core and then supplying a new path after startup, the data directory can be passed as the command line parameter datadir . This approach keeps the existing default data directory intact. It also allows multiple data directories to be used side-by-side. The disadvantages are that this method requires some extra configuration, and it wonвЂ™t work easily on OS X.
Windows users can create a shortcut that uses the command line option datadir . Doing so directs Bitcoin Core to use, not the default data directory, but the one given as a parameter.
Begin by right-clicking on the desktop and selecting New ->, Shortcut. Browse to the location of the Bitcoin Core executable ( C:\Program Files\Bitcoin\bitcoin-qt.exe ) and click the OK button. Next, add the command line option datadir , using the path to your data directory.
Double clicking the newly-created shortcut will direct Bitcoin Core to use the new data directory.
Ubuntu users can create a desktop shortcut by first browsing to the /usr/share/applications directory. Right-click on the Bitcoin file, then select the вЂњCopyвЂќ option. Right click on the desktop and select вЂњPasteвЂќ. This places a shortcut on the desktop. To direct this shortcut use the datadir option, right click, select вЂњPropertiesвЂќ, then replace the command field with bitcoin-qt -datadir= , where is the fully qualified path to the new data directory. Double clicking the resulting shortcut starts Bitcoin Core with the custom data directory.
Although a similar shortcut-based approach will work on OS X, creating a clickable icon is much more difficult.
Moving the Bitcoin Core data directory can be helpful in two situations:
- freeing up disk space on a cramped hard drive
- rapidly bringing up a new node by copying an existing data directory
The procedures outlined here can be used in either case.
Want to learn Bitcoin in depth but don’t know where to begin? This book teaches a comprehensive, step-by-step system for thinking about and using Bitcoin.