When you first run the Bitcoin core wallet, you will be given an opportunity to customise the location of the default data directory (which in Linux is
$HOME/.bitcoin). If you need to change the data directory after the first launch, there is no option to do so from within the GUI. Many Stack Overflow answers suggest launching
bitcoin-qt with the
-datadir option - e.g.
bitcoin-qt -datadir=/path/to/custom/datadir - this works, however you can easily amend the QT configuration so that the proper data directory is referenced by default.
QSettings for Bitcoin
The Bitcoin Core GUI wallet is based on QT, and it uses
QSettings to store settings.
Users normally expect an application to remember its settings (window sizes and positions, options, etc.) across sessions. This information is often stored in the system registry on Windows, and in XML preferences files on Mac OS X. On Unix systems, in the absence of a standard, many applications (including the KDE applications) use INI text files. QSettings documentation
Location of Config File: Linux
On Linux/Unix systems, the following files are used by default:
For myself, running Bitcoin Core under Ubuntu 16.04 the config file is
Location of Config File: Mac OS
On Mac OS X check the following locations:
Location of Config File: Windows
On Windows, check the following registry paths:
I don’t run MacOS or Windows so I haven’t checked these locations - this info is based on that provided in the QT QSettings documentation.
Edit the Config
Once you’ve located the config file, you can edit it like any other text file, and you’ll be able to amend the data directory:
The data directory key is
stdDataDir and looks like this:
Just amend this value to reference your data directory.
You can now launch
bitcoin-qt as normal without specifying the custom data directory.
A Note on Moving Data Directories
Don’t open Bitcoin Core in a different data directory without first copying across all data from the original data directory (e.g. using
rsync). Otherwise, blocks will need to be re-indexed - which is a lengthy process, and unecessary if you already have an up-to-date installation.
comments powered by Disqus