Bitcoin-Qt data directory

A quick tip

Running your own bitcoin client is the best way to be sure that your wallet stays with you and is not at risk of being stolen from some server, together with thousands of others.

Although (most likely) your security is not enough to prevent an attack you are also not that appealing target for any potential hacker.

Because pf those reasons I run Bitcoin-Qt on my machine and don’t trust hosted solutions.

The problem

One disadvantage of running the bitcoin client on my computer is that I need whole blockchain data to be able to participate in the network. Nowadays that’s quite a lot of data (it was 72GB last time I checked).

Even though hard disks are getting bigger sacrificing so much space for one application, which I ran from time to time, is a big deal. Especially as my main HD is SSD, which doesn’t belong to the cheapest.

I was looking for a way to solve this problem by moving blockchain data from my main hard disk.

A failed attempt

Bitcoin-Qt as a good citizen of OS X stores its data in ~/Library/Application Support/Bitcoin. Exactly where one would expect it to be.

My initial idea was to copy just the blockchain data (blocks subdirectory) to an external drive and in that place put a symlink pointing to the new destination.

In theory, it should work. Symlinks should be treated as the thing they point to. But it didn’t work. My guess is that there are internal checks which prevent from that kind of tampering with the very important data.

The solution

Not being from ones who give up too easily I went to Google. Several queries later I found what I was looking for. On the bitcoin wiki there’s a page which mentions a command line switch -datadir. Using it one can point Bitcoin-Qt where it should look for all of its data.

Knowing about the switch I was able to move the data directory off from my main hard drive into a spare one, which I attach when it’s time to use bitcoin.

The only downside of that approach is that I have to start Bitcoin-Qt from the terminal. Not a big deal and something which I will probably fix in the future.