Even though the current bitcoin prices are currently very low I still think it's an interesting technology. Especially the Lightning protocol. And I'm looking for a way to somehow use it in surface interval, a project that I'm working on. But currently the blockchain is almost 200GB and that's a bit much for my server.
If you don’t want to have the whole bitcoin blockchain on your computer or server you don’t have to. There is an option that deletes previously verified blocks from your local copy. This is called pruning. To enable it you have to add the following line to your bitcoind config. This config file is usually in ‘/etc/bitcoin/bitcoin.conf’.
After that you have to restart bitcoind and 5 minutes later you have a whole lot more free diskspace.
You can check if pruning is enabled with:
bitcoin-cli getblockchaininfo | grep prune
It will output something like this:
"pruned": true, "pruneheight": 552518, "prune_target_size": 1073741824,
The prune= value has to be higher than 550. And the number indicates the diskspace to be used in Megabytes. I went with 5000 because 5GB seemed reasonable to me.
After I enabled the prune=5000 option bitcoind wouldn’t start anymore. There was no usable error:
root@cryptodoos:~# service bitcoind start Job for bitcoind.service failed because the control process exited with error code. See "systemctl status bitcoind.service" and "journalctl -xe" for details.
I checked for typo’s in the config file and read the logfile in /var/lib/bitcoin/debug.log but everything seemed fine. So I started the daemon by hand. This is usually a good approach to see what’s going on.
root@cryptodoos:~# /usr/bin/bitcoind -daemon -datadir=/var/lib/bitcoin \ -conf=/etc/bitcoin/bitcoin.conf -pid=/run/bitcoind/bitcoind.pid Error: Prune mode is incompatible with -txindex.
And there it is. You have to disable txindex in the bitcoin.conf to use pruning.