Can Bitcoin-Qt be configured to trim the blockchain?

14

4

I run Bitcoin-Qt and Bitcoin Armory on a laptop. I don't have the space to store the whole 20 GB (or however big it is now) blockchain.

I understand the need to run through the entire thing for security, but I'd like it to only store relatively recent blocks + the summarized version (for example, the database of unused outputs / computed ledger). I'd like good security; I just don't have the space to store the whole thing.

Is there some way to configure Bitcoin-Qt / bitcoind to trim its data to a more reasonable size after it's gone through and processed the chain?

Sai

Posted 2014-01-06T23:01:15.233

Reputation: 303

Answers

2

This answer is now outdated please see Answer below

At this time, no, you can not strip the block chain (as far as I know). There is one programmer (Mark Freidenbach AKA maaku) who is working on further compressing the blockchain for the Satoshi bitcoin clients.

The entire block chain is currently needed to verify all coins are legitimate from the beginning of time. Plus there are coins in the older blocks that would not be included in new blocks, so some old miners might lose their coins.

1: https://en.bitcoin.it/wiki/Original_Bitcoin_client

Joe White

Posted 2014-01-06T23:01:15.233

Reputation: 538

1If I understand right, the entire block chain need merely be processed to verify coins. All that has to be stored, assuming you trust your storage, is the table of unused outputs & their corresponding values. (And of course all the text portions are highly compressible.) Am I incorrect?Sai 2014-01-07T15:41:47.220

I misunderstood you a bit then, it might possible to do that but don't quote me on that one as I've never been able to successfully prune a block chain. I do not have as much experience with in depth blockchain surgery as some of the "older" coders do. Now, on the other hand it is possible to at very least prune the block coinbase block headers where you have messages from pools (like "Mined by AsicMiner" etc) that might save you some disk space.Joe White 2014-01-07T19:49:24.367

have you considered getting a 64 gb thumb drive? They run about $25 usd each on amazon usa. you could always save the blockchain thereJoe White 2014-01-07T19:52:11.300

If I went that route, I'd probably use Armory's split online/offline mode and run the full chain on a server, which I can connect to occasionally via ssh-fs.Sai 2014-01-07T21:57:31.713

1This answer is now outdated.Murch 2015-07-28T09:20:16.900

17

Since Bitcoin-Core 0.11.0 you can prune (trim) the blockchain in Bitcoin-Qt. But not from the UI. You need to add prune=550 to your bitcoin.conf file and restart Bitcoin-Qt.

Explanation: -prune=<target in MiB> will tell bitcoin-core to remove blocks which are older than oldest block that can be kept with a chainsize (sum of block-sizes) of <target> (min. 550MiB as example above shows). A minimum of 550MiB ensures to keep at least 288 blocks (~2 days). (simple explanation not including undo-data)

Restriction: -prune does disable all wallet functions in version 0.11 (will work with a wallet in version 0.12).

Jonas Schnelli

Posted 2014-01-06T23:01:15.233

Reputation: 5 465

2What are the tradeoffs here?Michael Hampton 2015-07-31T01:29:11.717

1You don't fully participate in the network health because you can't serve most historical blocks. Your node is considered to be a p2p leech. Along to this you can't use -txindex.Jonas Schnelli 2015-07-31T06:05:12.180

1I forgot to mention the biggest drawback with pruning in 0.11: it does not work with wallet enabled, though in upcoming version 0.12 it will also work with the wallet.Jonas Schnelli 2015-07-31T08:42:37.330

I was under the impression that it did work, but that adding a private key to the wallet required a blockchain redownload.Nick ODell 2015-07-31T09:06:48.050

Right. There are some restrictions with importing keys that can require a full reindex (=redownload of the blockchain). On a decent system with a fast internet connection this takes around 6h.Jonas Schnelli 2015-07-31T09:51:37.643

2The prune option is a command-line argument, not a bitcoin.conf setting.Tim Sylvester 2015-10-12T02:23:05.587

1@TimSylvester: not true. Command-line argument = bitcoin.conf.Jonas Schnelli 2015-10-12T07:34:03.253

@JonasSchnelli is correct, wallet functions work in 0.12 with pruning.mkabatek 2016-02-16T02:28:20.413

0

If I recall it correctly, Ufasoft's multi-currency client stores the blockchain in a format of their own in which it gets compressed, so you might switch to it and see a small decrease in the usage of your hard-drive.

Be warned, though, there's no way to import the block-chain from bitcoin-qt's format to Usasoft, so the latter will have to re-download all the blocks from the very beginning.

Joe Pineda

Posted 2014-01-06T23:01:15.233

Reputation: 2 040

1AFAICT, only bitcoin-qt is interoperable w/ Armory, and I do want to have access to advanced features / good security. It's just the space limitation on my laptop that's a problem.Sai 2014-01-07T15:44:08.823

1You're right, Armory so far needs the original bitcoin-qt and can't operate with alternative clients. Too bad :(Joe Pineda 2014-01-07T16:45:58.540