Bitcoin blockchain pruning – How to reduce Bitcoin core wallet file size
It is recommended that you run a full node in order to support Bitcoin and to keep the system decentralized. It not only helps the network but also benefits the essential participant. But with such a huge blockchain file size do you think is it possible for everyone to run a full node? There are light weight SPV wallets, mobile and hardware wallets but nothing comes close like operating a core wallet. But the huge drawback of running a core wallet is its disk space and bandwidth requirements.
The current Bitcoin blockchain size is more than 350 GB which is immense and not everyone is ready to allocate such a huge space for Bitcoin. In order to lower this storage requirements there is a function called pruning mode. With the help of this option users can run a core wallet without having to worry about disk space. Here in this beginners guide we’ll show you how to reduce Bitcoin wallet blockchain size by using pruning command.
Bitcoin block file pruning – What is it and how it works?
The Bitcoin blockchain data contains all transaction history from the day Bitcoin was created to till date. With 1MB block size and 10 minutes block time the size of the chain grows larger and larger. Hence the storage capacity needed to run a full node will only keeps increasing in the future.
To overcome this issue Bitcoin core team have released a feature in version 0.11.0 called block file pruning. Block pruning allows one to run a smaller version of full blockchain. It does this by deleting the older data that it no longer requires while downloading the latest blockchain. Running wallet in prune mode simply throws away previous transaction and old chain history which in turn saves disk space.
More information on how it works can be found here.
Before you reduce Bitcoin wallet blockchain size:
Here are few things to note before you go ahead and enable pruning mode to your Bitcoin wallet.
- Pruning mode will not lessen your wallet security. It is same as running a full node wallet.
- Once this mode is enabled you can’t rescan your wallet as it requires you to download the blockchain again. Running a wallet in pruned mode is incompatible with
- Pruning blockchain just takes a few moments. But remember that it is a one way ticket. If you ever decide to use full node again then you’ll have to re-download the entire blockchain.
- Since files like chain state and block index database needs some storage the total amount of disk space consumed will exceed the pruning target; but not much.
- By default Block pruning is disabled and it is easy to enable. But remember that once enabled there is no other shortcut to revert this setting. The only way is to download the whole blockchain again.
Also note that pruning takes up CPU resources and is more taxing on your hard-disk as it has to read, write and delete files simultaneously. So during this process ensure that you are not running any other intensive application especially if your PC is low on specs.
Alright! Let’s see how to save disk space by enabling pruning mode.
How do I use the prune option in Bitcoin core?
The command that you need to reduce storage size is
prune=N where N is the target size in MiB that you’d like to allow.
prune=0 – Disables pruning mode
prune=1 – Allows manual pruning via RPC
prune=550 – Automatically deletes previous block files to stay below this target size.
Follow the steps below to enable prune mode in Bitcoin core wallet.
1. First locate your wallet configuration file. If you don’t find bitcoin.conf file in your Bitcoin directory then create one.
2. Open wallet, go to settings >> options and click on open configuration file.
3.The config file will be mostly empty. Now close your wallet and in the config file input the following.
Note: It can be 550, 1000, 2000, 10000, 20000 or any value as you like. But 550 is the minimum recommended value and setting anything lower will not work. It should be >=550. For example if you are fine to allow 5 GB of blockchain size then you can set
4. Once this value has been entered save the config file and restart your wallet.
That’s it! Your wallet is now in prune mode. Instead of using 200+ GB your wallet will only use the specified value but as we said before it could slightly exceed this value.
Instead of setting this in config file you can also add a startup parameter like this
Do I need to download the entire Blockchain?
It’s great that pruning mode allows one to operate Bitcoin core wallet in a limited hard drive space. But the real question is “Do I need to download the whole blockchain for the prune mode to take effect?” or “It will only download the set of most recent blocks until the specified size is met?” This is a common question for users in location where their bandwidth is capped by ISP. While the prune mode helps saves your disk space it still consumes a lot of bandwidth.
Yes, if you’re using wallet for the first time and syncing the node from scratch then you’ll have to download the whole blockchain. We know downloading the entire transaction history won’t work for many users who have slow internet speeds and monthly data caps. For such users the only option is to download the blockchain from uncapped Internet connection and copy it to the wallet disk.
Okay, I’m fine downloading the entire blockchain as my bandwidth is not limited here. But I only have less than 50 GB storage on my system. Does it fill up my disk space by downloading 200+ GB of data before pruning takes effect? You don’t have to worry about this. When your wallet is on prune mode it will automatically delete all the old data on the fly while the new blocks are being downloaded. So technically it won’t occupy more of your disk space than what you’ve specified.
Also there is a misconception that Blockchain pruning will speed up the syncing process. No, it will not sync your blockchain faster. It will only reduce the storage requirements. So what is the fastest way to sync the blockchain?
Downloading Bitcoin pruned blockchain
Bitcoin wallet syncing process has been improved over the years and downloading blockchain via the network is significantly faster so don’t go looking for direct download or torrent links. Also note that downloading the whole blockchain or pruned blockchain from online is highly not recommended. It is massively insecure so be careful to not download such files from untrusted source.
However you can still find someone that you can trust. Like get a copy of blockchain from your friends computer, transfer it to USB stick, download it to your machine and sync it just like that. It also works if they’ve pruned blockchain already. If you can’t find a trusted person or source and worried about bandwidth consumption then Electrum wallet is the ideal solution for you.
Hope this guide helps! If you have any questions regarding Bitcoin wallet blockchain pruning then please do let us know in comments section.
I would think that, in addition to the file size being reduced, the reduction in size would likely mean less chance of any data errors within the file commensurate with the reduction in size. Ie., if a 200 gig file has a 2% chance of corruption in a 24 month period, a 2 gig file would likely have .02% chance of data loss due to physical sector damage.
I take it you have never run the Bitcoin Core node yourself? You see it is *not* one big file that all is saved in. It is a whole bunch of files that all together make up the blockchain.
Awesome explanation! All my questions answered in single blog post! This should be in the Bitcoin GitHub Wiki.
You wrote “you can still find someone that you can trust. Like get a copy of blockchain from your friends computer, transfer it to USB stick, download it to your machine and sync it just like that. It also works if they’ve pruned blockchain already.”
How would that process work? I downloaded the entire blockchain on a spare computer at home, now I’d like to setup another machine, how should I proceed? In some other guide I read it’s enough to copy these subdirectories from .bitcoin dir: blocks and blockchainstate
I assume if I switch pruning e.g. 550 I can also copy just these 2 folders. Can you confirm, or which other files may be needed?
Yes, that is correct. Just copy blocks and chainstate folders to another machine. It should work.
What’s next please? I just downloaded pruned Bitcoin Core and have a brand new Coldcard. I’d like to setup and start using to buy my first Bitcoin. Thanks.