51

I read this comment:

You could consider running a pruning node, which is practically the same as a full node (including security), except it throws away some of the old history. Version 0.11 will make that possible

But I can't find details of how to run bitcoind in pruning mode. Questions on this site seem not to be recent enough to yield answers, and I also don't see a pruning mode in the bitcoind parameters.

Any insights into this?

2
  • as the comment said, this feature is not yet available in bitcoind. May 21, 2015 at 9:28
  • 1
    Ahhh I see, I didn't know 0.11 is a future version. Thanks for clarifying!
    – user
    May 21, 2015 at 9:57

3 Answers 3

40

By setting the -prune option.

-prune= Reduce storage requirements by enabling pruning (deleting) of old blocks. This allows the pruneblockchain RPC to be called to delete specific blocks, and enables automatic pruning of old blocks if a target size in MiB is provided. This mode is incompatible with -txindex and -rescan. Warning: Reverting this setting requires re-downloading the entire blockchain. (default: 0 = disable pruning blocks, 1 = allow manual pruning via RPC, 550 = automatically prune block files to stay under the specified target size in MiB)

The feature was originally introduced in Bitcoin Core 0.11 (see release notes).

As of version 0.12 pruning can be used while running a wallet. But note the -txindex and -rescan caveats.

Also note that the specified MiB will only include the block files and some undo space. Besides that you will also need some disk space for the chain state and block index databases.

6
  • 1
    The argument to pruning is how much disk space to use for blocks and undo data associated with them. It does not include and does not apply to the chain state or block index databases. Do not increase the number to account for them. May 21, 2015 at 16:30
  • @PieterWuille That's why i decreased the number for him. In another question he mentioned he had 35GB diskspace. :) But thanks for the addition, you're right that my answer was a bit ambiguous.
    – Jannes
    May 22, 2015 at 9:48
  • Well, if it disables the wallet funcionality, what would someone do with this node? Just mining? If so, in the event of successfully mining, what would be the destination of the generated bitcoin reward? Jan 28, 2016 at 13:23
  • 1
    @HenriqueBarcelos The upcoming version WILL allow running a wallet on a pruning node. The current version was just a stepping stone. As a side effect it made sure noone could possibly lose money due to a bug as there was no wallet at all. There are uses for (pruning) full nodes without wallet. For example you can use it as sort of a "firewall" between some internal application that you write yourself but that you don't want to directly hook up to the internet or possibly evil P2P traffic. Or to connect your Android wallet to it, so you are doing full validation, just not on the phone itself.
    – Jannes
    Jan 28, 2016 at 17:28
  • 2
    0.12.0 enables wallet support, you might want to update this answer. :)
    – Murch
    Feb 21, 2016 at 12:58
20

There are more details in the release notes.

To enable block pruning set prune=<N> on the command line or in bitcoin.conf, where N is the number of MiB to allot for raw block & undo data.

A value of 0 disables pruning. The minimal value above 0 is 550.

Where 550 is the size in MB you want the node to occupy in your system.

The bitcoin.conf is in the Bitcoin data directory, you can create a text file by the name there, if there isn't a bitcoin.conf yet.

5
  • bitcoin.conf doesnt exists ...
    – user42169
    Oct 12, 2016 at 3:59
  • @user42169: "The configuration file is not automatically created; you can create it using your favorite plain-text editor. By default, Bitcoin (or bitcoind) will look for a file named bitcoin.conf in the bitcoin data directory, but both the data directory and the configuration file path may be changed using the -datadir and -conf command-line arguments." –Running Bitcoin: Bitcoin.conf Configuration File. First hit when I searched for "Bitcoin.conf doesn't exist". ;)
    – Murch
    Oct 12, 2016 at 7:35
  • where should the bitcoin.conf file reside on a win10 / win7 machine? Oct 31, 2016 at 14:22
  • @duckx: I don't know. If you don't find the answer in documentation, please ask a new question. Oct 31, 2016 at 16:11
  • @duckx: Where is the configuration file of Bitcoin-Qt kept?.
    – Murch
    Jan 6, 2017 at 13:33
2

there was a followup on what a pruning node could actually be good for. Well, one answer would be shop systems who do not want/cannot rely on third party APIs like blockchain.info for their payment processing. a prune node would allow to be run on say a cheap vps with low space, while checking mempool for incoming transactions to implement payments. it would also allow checking/signing messages using the clients rpc calls, and to a limited degree it could allow checking the balances of addresses. I personally think(and I proposed intelligent pruning as I call it back in 2013) bitcoin devs implemented it wrongly. My implementation suggestion back then was to prune coins from the blockchain that had already been spent. Current behavior is to verify coins in transactions back to coinbase(aka when they were mined), while it should be sufficient to keep the last say 120 blocks plus every unspent transaction. Since the client verifies all blocks it gets, it could rely on those coins to be verified, yet it wouldnt need to know any previous transactions the coins went through.

1
  • 3
    No, that's exactly what Bitcoin Core does. All unspent coins are kept for further verification, and everything else is deleted (apart from the last day or so, to help with reorganisations). Nov 12, 2017 at 6:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.