Subject: Re: [bitcoin-dev] 7z block compression, 18%

From: Greg Maxwell <[email-masked]>
Date: Sat, 24 Apr 2021 19:17:41 +0000

https://bitcointalk.org/index.php?topic=5303978.msg55946632#msg55946632

Blockstream satellite codebase includes an alternative serialization
that works a single transaction at a time and saves ~20%.  This avoids
violating layering, preserves single txn access, is compatible with
transaction relay.   (and if you wanted could also be fed to a
multiple txn at a time compressor for additional savings).  This
format makes intelligent use of the entirety of the transaction
format, not just amount encodings but even optimizing predictable
hashes (e.g. for p2sh embedded segwit) -- achieving savings that *no*
generic compressor could ever achieve.

Most of the savings from generic compressors comes from repeated
pubkeys and addresses, so it's highly variable, depends on address
reuse, and will likely be diminished by taproot (due to shrinking
multisig) and very much reduced by signature aggregation in the
future.

If you're thinking about use across networks generic compression
interfaces like zlib have had a pretty disappointing security track
record.

If you search the list archive and bitcoin-core github you'll find
many prior discussions of using generic compressors.

On Sat, Apr 24, 2021 at 6:12 PM NITSOPOULOS KONSTANTINOS via
bitcoin-dev <[email-masked]> wrote:
>
> Hi, I can compress new blocks by up to 18% using the 7z file type. I use wxHexEditor to dump a block's raw hex onto my disk, and then compress that with 7-Zip. I'd like to see 7z built into Bitcoin Core, for block compression (storage & propagation). The entire blockchain could be under 290GB if it's converted into a 7z archive-chain ("7z-chain"). I can compress some recent example blocks (hex -> less hex) if anyone wants. A future BIP could try increase the block Weight Units limit by up to 21% if 7z blocks are smaller & quick.
>
> Programming compression seems too difficult for me, so I'm hoping somebody else does it!
>
> Eventually I think transactions can be compressed by replacing addresses (& public keys) and coins, wherever possible, with just their own unique sequential index. TX amounts can also be compressed if they contain only a decimal digit or two, e.g. 00000000.10000000 XBT. A TX of 0.1 XBT between two existing addresses could be somehow compressed to half or maybe a quarter of its current size!
>
> -Tinos
> _______________________________________________
> bitcoin-dev mailing list
> [email-masked]
> https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev