pruning blockchain: what do I need to do?

13 replies 263 views
LuckyGuruMember
Posts: 3 · Reputation: 115
#1May 26, 2017, 05:29 AM
In Bitcoin Core settings under Main, I saw the option that says "Prune block storage to ______ GB". So I got a question. If I put "200" in that box, does the software... A) ......keep just the latest 200 GB of blocks on my SSD or B) .....remove the oldest 200 GB from the blockchain I have downloaded (meaning that this number can’t be more than the total size of the blockchain). I feel like it would make more sense for A), but just wanna make sure. Thanks!
4 Reply Quote Share
cryptobridgeSenior Member
Posts: 221 · Reputation: 1481
#2May 28, 2017, 06:30 AM
Pruning leaves the recent block to the size you set in the prune, as you download new blocks, the old blocks will be deleted to fit into that size of 200gb. So A is correct.
3 Reply Quote Share
LuckyGuruMember
Posts: 3 · Reputation: 115
#3May 30, 2017, 05:22 AM
Thank you. But is the pruning possibile only after i have downloaded all blocks? or i can set the pruning option when i install the client?
2 Reply Quote Share
cryptobridgeSenior Member
Posts: 221 · Reputation: 1481
#4May 30, 2017, 10:04 AM
To answer your question, yes you can prune even after downloading the blocks You can as well set pruning option immediately after installation. But you should only be pruning if you don't have enough space to keep the whole blocks or you are trying to manage space on your computer. If you have the space and can keep 600gb plus, there is no reason to prune.
3 Reply Quote Share
gr3g.0rbitHero Member
Posts: 1025 · Reputation: 2646
#5May 30, 2017, 03:38 PM
I saw that you also posted the OP in your other thread where you described that you're already downloading the blockchain on a 1TB drive. Yes, you can set it anytime you like but the node has to be restarted for the prune setting to apply. But take note that you can't just reverse it after enabling. Once you enabled prune mode, disabling it will cause your node to redownload the entire blockchain from start. So carefully consider its limitations (can't rescan deleted blocks, serves only a few blocks regardless of size, DYOR.) before deciding to enable that setting.
3 Reply Quote Share
LuckyGuruMember
Posts: 3 · Reputation: 115
#6May 30, 2017, 05:23 PM
Yes, I'm actually doing some testing. I have a question: if I download BitcoinCore onto an SSD with only 40GB of free space, can I set a limit of 20GB for the blockchain from the beginning, or will it require me to download the entire blockchain first (which is obviously impossible) and after that proceed to prune it? Thank you
2 Reply Quote Share
hash_bossLegendary
Posts: 1166 · Reputation: 5261
#7May 30, 2017, 07:38 PM
Yes, you can set pruning size limit from the beginning. Bitcoin Core still download whole blockchain, but it automatically remove older blocks when newly received blocks would exceed the limit. But since the free space is rather small, FYI Bitcoin Core also store other files such as UTXO set in folder "chainstate" that have peak size 12.6GB[1]. [1] https://statoshi.info/d/000000009/unspent-transaction-output-set?orgId=1&from=now-5y&to=now&timezone=browser&refresh=10m
3 Reply Quote Share
silentchainHero Member
Posts: 473 · Reputation: 2317
#8May 31, 2017, 01:49 AM
Yeah, you can, but it is better to acquire new SSD because leaving less free space negatively affects SSD performance. Keeping around 20% of the space free is recommended for both performance and endurance, as that free space acts like extra over-provisioning beyond the fixed portion hidden from user by SSD manufacturer.
0 Reply Quote Share
bear2021Full Member
Posts: 214 · Reputation: 612
#9Jun 1, 2017, 08:41 AM
If you run Bitcoin Core in pruned mode, the previous block data will not be there. The more gb of pruned size you give, the latest  blocks will be downloaded and stored according to your command . But when you download the full node, "initialblockdownload": true will be displayed, which means that the very first block data is being stored. "pruned": false, will be displayed because the full node is running here. I am running the full node myself now. I have given its output below. And after completing the node, if you do any other work based on it, such as creating lnd, then you will need some more space in that case. Therefore, if 40gb is free, then I think you can increase it up to 30gb depending on your work. If your computer has a drive partition and the other drive is free, then if you want, you can create a single  drive   C and create more space there and give more pruned size value .
3 Reply Quote Share
cryptobridgeSenior Member
Posts: 221 · Reputation: 1481
#10Jun 1, 2017, 12:19 PM
This isn't true and I will like you to come back and very this statement when your node is fully sync. Initial block download output=true is telling you that your node is still downloading blocks and it's not fully sync yet. You are still left with some blocks to download before you reach the latest block. Once you attain the latest block, initialblockdownload will change to false. As you can see from your block, you have only downloaded 30.1774%, if you get to 0.99999 or 99.99% initialblockdownload will turn to false. Yea, you can see from the size_on_disk, if you are running a prune node, the size will not be upto the tha number. You currently have about 200+ gb blocks on your disk.
0 Reply Quote Share
gr3g.0rbitHero Member
Posts: 1025 · Reputation: 2646
#11Jun 1, 2017, 04:30 PM
Yes, as I mentioned, you can set it anytime. You already get the gist of it, if it's the latter, it'll defeat the entire purpose of pruning since the node operator has to provide enough space anyways. To make it simple: Since Bitcoin Core in pruned mode is still a full node, so it has to verify each downloaded blocks and it does so as it downloads them, not after downloading all. After your node is done with a block (verification, scan for transactions, building indexes, etc.) it can decide to delete the earlier ones once it reached your target size.
2 Reply Quote Share
tom42Full Member
Posts: 37 · Reputation: 259
#12Jun 1, 2017, 07:53 PM
Yes as I mentioned you can set it anytime You already get the gist of it if it's the latter it'll defeat the entire purpose of pruning since the node operator has to provide enough space anyways To make it simple Since Bitcoin Core in pruned mode is still a full node so it has to verify each downloaded blocks and it does so as it downloads them not after downloading all After your node is done with a block (verification scan for transactions building indexes etc) it can decide to delete the earlier ones once it reached your target size Yeah man that's exactly how it works no need to download the whole thing first and then prune it would be dumb if it did that Bitcoin Core is smart it downloads verifies and prunes on the fly so with your 40GB free space setting 20GB should be fine but watch out for the chainstate folder it can spike up to around 13GB or so during sync as ABCbits mentioned I've done this on a small drive before and it worked but yeah like satscraper said keep some free space for SSD health maybe aim for 25-30% free if you can If you're tight on space pruning is a lifesaver but remember you lose some features like rescanning old wallets without redownloading everything
4 Reply Quote Share
hash_bossLegendary
Posts: 1166 · Reputation: 5261
#13Jun 1, 2017, 08:52 PM
Please don't give false information, help getblockchaininfo give different explanation. Please don't make bad suggestion. I've mentioned peak UTXO set/chainstate size is 12.6GB. So if OP allocate 30GB for block on SSD with 40GB free space, the SSD will run out of space during initial sync.
2 Reply Quote Share
Posts: 11 · Reputation: 125
#14Jun 2, 2017, 07:44 PM
Just to be precise, I'd add a piece of information to the correct answer A. Not only do we have the latest xxGB of blocks, but the headers of ALL previously deleted blocks are preserved (and therefore used space). The headers of the entire blockchain are essential for validating the future new block (Proof-of-Work).
4 Reply Quote Share

Related topics