pull down to refresh

Bitcoin block compression

Although this subject has been raised multiple times on bitcointalk.org, bitcoin-dev mailing list, and Bitcoin Core GitHub, due to a high fee rate currently, and the fact that almost half of block space is occupied by JSON documents (ordinals), I think it's time to measure it once again.

The chart

Compression ratios for blocks using the following algorithms: xz, lzo, and zstd:

Average compression ratios

On average zstd is the best compressor for Bitcoin blocks.
compressorratio
xz61.45%
zstd61.36%
lzo66.96%

How I measured it

I've downloaded recent 100 blocks from my Bitcoin node and compressed each of them with 3 compressors. All the data you can find at a Google Sheet

Compressing concatenation of blocks

As you possibly know, compression algorithms work better the more data you feed them at once. So, I've concatenated these 100 blocks and compressed the concatenation. In this case, the results are marginally better, especially for xz:
compressorratio
xz55.93%
zstd58.11%
lzo66.87%

How can it be used

Although the compression ratio is not so dramatic that it could lead to the blockchain scaling and fee lowering, at the same time it could significantly reduce the disk space needed for a full Bitcoin blockchain by 10s or even 100s of gigabytes (I'll push an update when I compress all the blocks on my node). It could be done via filesystem level if yours supports it, but I think it's much more suitable to implement it inside a Bitcoin node.