2

Suppose I have an archiving full node (i.e. a full node where all blocks are saved to disk forever) running on one of my computers.

Now suppose I have another computer where I'd like to run a separate full node, but where I need to prune blocks instead of archiving them because the disk of this computer doesn't have enough space to store every block.

Obviously, I could begin running the new pruned node from scratch as normal and have it download and validate every block from the Bitcoin Network. But this would be quite wasteful in terms of network bandwidth and CPU cycles, as I already have an archiving full node that I fully trust with the UTXO set and all of the blocks available.

How exactly could I copy (using standard tools like sftp or rsync) only the data I absolutely need from the archiving node to this new pruned node that will store, say, 2 GiB worth of blocks (prune=2048)?

Without a doubt, we'll want to copy the chainstate folder over in full for the UTXO set. I assume we'll also want the blocks/index folder for the block metadata in LevelDB as well (plus, it's only 112MiB at time-of-writing). So, the trick will be to copy only the blocks/blk*.dat and blocks/rev*.dat files that are absolutely necessary.

Copying everything over and then running with pruning enabled isn't an option as the disk isn't big enough.

Is it possible to, say, copy just the last 2 GiB worth of blocks from the blocks/blk*.dat and/or blocks/rev*.dat files to get the pruned node up and running?

2
  • 1
    You could sidestep the bandwidth use by connecting only to your already synced node during synchronization. It would still process the whole blockchain, though.
    – Murch
    Jan 17, 2023 at 14:48
  • Thanks @Murch, that definitely at least helps.
    – edwargix
    Jan 21, 2023 at 21:22

1 Answer 1

1

How exactly could I copy (using standard tools like sftp or rsync) only the data I absolutely need from the archiving node to this new pruned node that will store, say, 2 GiB worth of blocks (prune=2048)?

I'm pretty sure that is not possible using those tools. The data isn't arranged in a way that makes this approach possible.

Is it possible to, say, copy just the last 2 GiB worth of blocks from the blocks/blk*.dat and/or blocks/rev*.dat files to get the pruned node up and running?

It is very likely that there are indexes elsewhere that point into block data, if those indexes are missing or point to files that don't exist, I imagine Bitcoin core will regard this as a fatal error during startup.


See also

1
  • That makes sense, thanks. I wonder how Bitcoin Core could be refactored slightly to make this possible (if at all).
    – edwargix
    Jan 21, 2023 at 21:24

Your Answer

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

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