I wrote a tool in Rust to xor the blocks directory with a random key. It was pointed out to me that there already exists some Rust code in contrib, so this might be a welcome addition to the toolkit here.
This lets you obfuscate the blocks blk.dat and rev.dat files if you synced with a version prior to v28.
It checks if a xor.dat
file exists, and if it is zero it overwrites it with a non-zero random key. It then goes through each *.dat
file in the blocks directory, checking if the first 4 bytes are the magic bytes. If so it reads the whole file into memory, xors all bytes with the key, then writes to a temporary file. It then renames the temporary file to the dat file it xor’d. This lets users safely run this on any blocks directory, as long as they let it completely finish once before starting bitcoind.