How to lower Bitcoin and other cryptos disk space by using pruning commandsteemCreated with Sketch.

in #bitcoin7 years ago (edited)

How to save disk space using pruning.


Screenshot from 2017-09-17 09-03-59.png

Your blockchain files are occupying too much space? There is a solution! It's called pruning.

Each times there is a transaction on a blockchain, new data is created. Over time the blockchain grows always bigger and so consumes more space on your harddrive. Actually the bitcoin blockchain stands at 150GB.

Screenshot from 2017-09-17 09-30-03.png

To solve this issue, there is a very useful function called prune="sizeyouwant" that you can add to your bitcoin.conf file in your bitcoin directory.

Screenshot from 2017-09-17 09-35-25.png

With this you can set the size of data that your node will keep. For example I chose to keep 20GB of data by using prune=20000 in my bitcoin.conf file. If there is no bitcoin.conf file in your bitcoin directory, create it with a text editor.

Screenshot from 2017-09-17 09-36-03.png

One problem is that you first have to download the full blockchain to be able to prune, as it's the only way for your wallet to be able to verify the origin of each transactions before deleting them.

Screenshot from 2017-09-17 06-39-48.png

Warning if you want to revert this setting you will have to download again the pruned data.

But what exactly is pruning? It simply delete old validated transactions. For example when X coins move from address A to B and then C there is no need to keep that they came from A. If you are interested here is a more technical explanation from bitcoin.org:

Block file pruning

This release supports running a fully validating node without maintaining a copy of the raw block and undo data on disk. To >recap, there are four types of data related to the blockchain in the bitcoin system: the raw blocks as received over the >network (blk???.dat), the undo data (rev???.dat), the block index and the UTXO set (both LevelDB databases). The databases >are built from the raw data.

Block pruning allows Bitcoin Core to delete the raw block and undo data once it’s been validated and used to build the >databases. At that point, the raw data is used only to relay blocks to other nodes, to handle reorganizations, to look up old >transactions (if -txindex is enabled or via the RPC/REST interfaces), or for rescanning the wallet. The block index continues to >hold the metadata about all blocks in the blockchain.

The user specifies how much space to allot for block & undo files. The minimum allowed is 550MB. Note that this is in >addition to whatever is required for the block index and UTXO databases. The minimum was chosen so that Bitcoin Core will >be able to maintain at least 288 blocks on disk (two days worth of blocks at 10 minutes per block). In rare instances it is >possible that the amount of space used will exceed the pruning target in order to keep the required last 288 blocks on disk.

Block pruning works during initial sync in the same way as during steady state, by deleting block files “as you go” whenever >disk space is allocated. Thus, if the user specifies 550MB, once that level is reached the program will begin deleting the oldest >block and undo files, while continuing to download the blockchain.

Don't forget to restart your wallet for the pruning to work.

And this is the result !
Screenshot from 2017-09-17 09-39-26.png
From 150GB to only 23. It's always possible to use a lower value of pruning, however the bigger the chain you store the more nodes you help with syncing. That's why I chose 20000.

Now you know how to prune your blockchain and use less diskspace ! If you need help please use the comment section ;), I hope to be able to get it solved :).

Sort:  

This post recieved an upvote from minnowpond. If you would like to recieve upvotes from minnowpond on all your posts, simply FOLLOW @minnowpond

Coin Marketplace

STEEM 0.17
TRX 0.16
JST 0.030
BTC 66612.27
ETH 2467.28
USDT 1.00
SBD 2.60