<oembed><type>rich</type><version>1.0</version><author_name>npub1ncnj8arudstdxzfhxk7k4nwgkrw3hyw8sgt0wqqmm5hh2c4knmgs2lqt2n</author_name><author_url>https://nostr.ae/npub1ncnj8arudstdxzfhxk7k4nwgkrw3hyw8sgt0wqqmm5hh2c4knmgs2lqt2n</author_url><provider_name>njump</provider_name><provider_url>https://nostr.ae</provider_url><html>📅 Original date posted:2017-12-11&#xA;📝 Original message:I want to resurrect this thread from August/September because it seems like&#xA;a significant improvement for light clients at very little cost. From the&#xA;mailing list, it seems like this got stalled in determining how many more&#xA;bytes could be save in addition to the prev_block.&#xA;&#xA;The ideas I&#39;ve gathered from Greg Maxwell&#39;s forwarded email are:&#xA;&#xA;1. Omit nBits altogether and have the receiving node determine it from&#xA;chain context.&#xA;2. Include nBits only on headers with a height that is a multiple of 2016&#xA;since it does not change in between.&#xA;3. Compress nTime to two bytes by using the bounds on allowed values from&#xA;the consensus rules.&#xA;&#xA;I propose just moving ahead with only the exclusion of the prev_block, as&#xA;IMO the other savings are not worth the added complexity.&#xA;&#xA;Firstly, I don&#39;t like the idea of making the net header encoding dependent&#xA;on the specific header validation rules that Bitcoin uses (eg. the fact&#xA;that difficulty is only recalculated every 2016 blocks). This would be&#xA;coupling together the two layers, breaking net compatibility for some alts,&#xA;and possibly making consensus rule changes even more difficult for a&#xA;savings with insufficient benefit. So if you buy that argument, I&#39;m not in&#xA;favor of #2 or #3.&#xA;&#xA;Option 1 is still viable, though it has some downsides. The implementation&#xA;leaks into the validation code, whereas calculating prev_block can occur&#xA;just at the net layer (see implementation below). Also, nodes would now be&#xA;*required* to sync the header chain from the genesis block, whereas they&#xA;had the option of starting from some checkpoint before.&#xA;&#xA;So switching gears, I&#39;d like to ask what the best way to actually implement&#xA;this change is. Solutions I can think of are:&#xA;&#xA;1. New headers command name like &#34;cmpctheaders&#34; or &#34;headersv2&#34;.&#xA;2. Change serialization of existing headers message in a new protocol&#xA;version.&#xA;3. Change serialization of existing headers message with new service bit.&#xA;&#xA;I wrote up some proof-of-concept implementations in Core a) just omitting&#xA;prev_block&#xA;&lt;https://github.com/bitcoin/bitcoin/compare/master...jimpo:compact-headers&gt;&#xA;and b) omitting nBits as well&#xA;&lt;https://github.com/bitcoin/bitcoin/compare/master...jimpo:compact-headers-difficulty&gt;.&#xA;If people think a) is reasonable, I&#39;ll write up a BIP.&#xA;&#xA;&#xA;&gt; Hi everyone, the Bitcoin headers are probably the most condensed and&#xA;&gt; important piece of data in the world, their demand is expected to grow.&#xA;&gt; When sending a stream of continuous block headers, a common case in IBD and&#xA;&gt; in disconnected clients, I think there is a possible optimization of the&#xA;&gt; transmitted data: The headers after the first could avoid transmitting the&#xA;&gt; previous hash cause the receiver could compute it by double hashing the&#xA;&gt; previous header (an operation he needs to do anyway to verify PoW). In a&#xA;&gt; long stream, for example 2016 headers, the savings in bandwidth are about&#xA;&gt; 32/80 ~= 40% without compressed headers 2016*80=161280 bytes with&#xA;&gt; compressed headers 80+2015*48=96800 bytes What do you think? In&#xA;&gt; OpenTimestamps calendars we are going to use this compression to give&#xA;&gt; lite-client a reasonable secure proofs (a full node give higher security&#xA;&gt; but isn&#39;t feasible in all situations, for example for in-browser&#xA;&gt; verification) To speed up sync of a new client Electrum starts with the&#xA;&gt; download of a file &lt;https://headers.electrum.org/blockchain_headers&gt;&#xA;&gt; ~36MB containing the first 477637 headers. For this kind of clients could&#xA;&gt; be useful a common http API with fixed position chunks to leverage http&#xA;&gt; caching. For example /headers/2016/0 returns the headers from the genesis&#xA;&gt; to the 2015 header included while /headers/2016/1 gives the headers from&#xA;&gt; the 2016th to the 4031. Other endpoints could have chunks of 20160 blocks&#xA;&gt; or 201600 such that with about 10 http requests a client could fast sync&#xA;&gt; the headers&#xA;-------------- next part --------------&#xA;An HTML attachment was scrubbed...&#xA;URL: &lt;http://lists.linuxfoundation.org/pipermail/bitcoin-dev/attachments/20171211/86e7642f/attachment.html&gt;</html></oembed>