<div dir="ltr"><div>I&#39;m new to this mailing list and apologize if this has been suggested before. I was directed from the Bitcoin core github to this mailing list for suggestions.</div><div><br></div>I&#39;d just like to post a possible solution that increases the amount of data in a block without actually increasing the size on disk or the size in memory or the size transmitted over the Internet. Simply applying various compression algorithms, I was able to achieve about a 50% compression ratio. Here are my findings on a recent Bitcoin block using max compression for all methods:<div><br></div><div>Raw block</div><div>998,198 bytes</div><div><br></div><div>Gzip</div><div>521,212 bytes (52% ratio)</div><div>(needs 2MB to decompress).</div><div><br></div><div>LZMA</div><div>415,308 bytes (41% ratio)</div><div> (1MB dictionary, needs 3MB to decompress)</div><div><br></div><div>- ZStandard: 469,179 bytes (47% ratio)</div><div>(1MB memory to decompress)</div><div><br></div><div>- LZ4: 641,063 bytes (64% ratio)</div><div>(32-64K to decompress)</div><div><br></div><div>The compression time on my modest laptop (2 years old) was &quot;instant&quot;. I ran all from the command line and did not notice any lag as I pressed enter to do the compression, so easily less than a second. But compression time doesn&#39;t matter, decompression time is what matters as blocks will be decompressed billions of times more than they will be compressed. Decompression speed for LZ4 is the fastest of the above methods, at 3.3GB / second, slightly less than half the speed of memcpy, see char at (<a href="https://github.com/lz4/lz4">https://github.com/lz4/lz4</a>).</div><div><br></div><div>If decompression speed, CPU and memory usage is a concern, LZ4 is a no brainer. You basically get a 33% larger block size for &quot;free&quot;. But ZStandard, in my opinion, makes the most sense as it offers greater than 50% compression ratio with a very good decompression ratio of 900MB / second.</div><div><br></div><div>If this were implemented in the Bitcoin protocol, there would need to be a place to specify the compression type in a set of bits somewhere, so that future compression algorithms could potentially be added.<br></div><div><br></div><div>Miners could do nothing and keep sending blocks as is, and these blocks would have &quot;no compression&quot; as the type of compression, just as today. Or they could opt in to compress blocks and choose how many transactions they want to stuff into the block, keeping the compressed size under the limit.</div><div><br></div><div>The bitcoin client code would also need to be able to handle the appropriate compression bits, and limits of signature data, etc. modified to deal with the compression.</div><div><br></div><div>I understand schnorr signatures are on the roadmap as a 25% compression gain which is great, I suspect that schnorr signatures would compress even further when compressed with the above compression methods.</div><div><br></div><div>Here is a link to the block that I compressed: <a href="https://mega.nz/#!YPIF2KTa!4FxxLvqzjqIftrkhXwSC2h4G4Dolk8dLteNUolEtq98">https://mega.nz/#!YPIF2KTa!4FxxLvqzjqIftrkhXwSC2h4G4Dolk8dLteNUolEtq98</a><br></div><div><span class="gmail-file-link-info gmail-key" style="font-size:13px;outline:none;color:rgb(217,0,7);font-family:source_sans_proregular,Arial;white-space:pre-wrap"><br></span></div><div>Thanks for reading, best wishes to all.</div><div><br></div><div>-- Jeff Johnson<br></div></div>