7z block compression, 18%

7z block compression, 18%
2021-04-24 18:20 ` Pavol Rusnak
  2021-04-24 19:17 ` Greg Maxwell
  
From: NITSOPOULOS KONSTANTINOS @ 2021-04-24 11:02 UTC (permalink / raw)
  To: bitcoin-dev

[-- Attachment #1: Type: text/html, Size: 1269 bytes --]

 permalink raw reply	[|nested]
2021-04-24 11:02 [bitcoin-dev] 7z block compression, 18% NITSOPOULOS KONSTANTINOS

  2021-04-24 19:17 ` Greg Maxwell
  
From: Pavol Rusnak @ 2021-04-24 18:20 UTC (permalink / raw)
  To: NITSOPOULOS KONSTANTINOS, Bitcoin Protocol Discussion

[-- Attachment #1: Type: text/plain, Size: 265 bytes --]

If block compression is going to be considered, zstd provides better
properties than the competition.
Especially for the decompression. [1]

[1] https://github.com/facebook/zstd

-- 
Best Regards / S pozdravom,

Pavol "stick" Rusnak
Co-founder and CTO, SatoshiLabs

[-- Attachment #2: Type: text/html, Size: 616 bytes --]

 permalink raw reply	[|nested]
2021-04-24 11:02 [bitcoin-dev] 7z block compression, 18% NITSOPOULOS KONSTANTINOS
  2021-04-24 18:20 ` Pavol Rusnak

  
From: Greg Maxwell @ 2021-04-24 19:17 UTC (permalink / raw)
  To: NITSOPOULOS KONSTANTINOS, Bitcoin Protocol Discussion

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 <bitcoin-dev@lists•linuxfoundation.org> 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
> bitcoin-dev@lists•linuxfoundation.org
> https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev


 permalink raw reply	[|nested]