<oembed><type>rich</type><version>1.0</version><author_name>npub1zw7cc8z78v6s3grujfvcv3ckpvg6kr0w7nz9yzvwyglyg0qu5sjsqhkhpx</author_name><author_url>https://nostr.ae/npub1zw7cc8z78v6s3grujfvcv3ckpvg6kr0w7nz9yzvwyglyg0qu5sjsqhkhpx</author_url><provider_name>njump</provider_name><provider_url>https://nostr.ae</provider_url><html>📅 Original date posted:2016-05-10&#xA;📝 Original message:Gregory Maxwell &lt;greg at xiph.org&gt; writes:&#xA;&gt; On Tue, May 10, 2016 at 5:28 AM, Rusty Russell via bitcoin-dev&#xA;&gt; &lt;bitcoin-dev at lists.linuxfoundation.org&gt; wrote:&#xA;&gt;&gt; I used variable-length bit encodings, and used the shortest encoding&#xA;&gt;&gt; which is unique to you (including mempool).  It&#39;s a little more work,&#xA;&gt;&gt; but for an average node transmitting a block with 1300 txs and another&#xA;&gt;&gt; ~3000 in the mempool, you expect about 12 bits per transaction.  IOW,&#xA;&gt;&gt; about 1/5 of your current size.  Critically, we might be able to fit in&#xA;&gt;&gt; two or three TCP packets.&#xA;&gt;&#xA;&gt; Hm. 12 bits sounds very small even giving those figures. Why failure&#xA;&gt; rate were you targeting?&#xA;&#xA;That&#39;s a good question; I was assuming a best-case in which we have&#xA;mempool set reconciliation (handwave) thus know they are close.  But&#xA;there&#39;s also an alterior motive: any later more sophisticated approach&#xA;will want variable-length IDs, and I&#39;d like Matt to do the work :)&#xA;&#xA;In particular, you can significantly narrow the possibilities for a&#xA;block by sending the min-fee-per-kb and a list of &#34;txs in my mempool&#xA;which didn&#39;t get in&#34; and &#34;txs which did despite not making the&#xA;fee-per-kb&#34;.  Those turn out to be tiny, and often make set&#xA;reconciliation trivial.  That&#39;s best done with variable-length IDs.&#xA;&#xA;&gt; (*Not interesting because it mostly reduces exposure to loss and the&#xA;&gt; gods of TCP, but since those are the long poles in the latency tent,&#xA;&gt; it&#39;s best to escape them entirely, see Matt&#39;s udp_wip branch.)&#xA;&#xA;I&#39;m not convinced on UDP; it always looks impressive, but then ends up&#xA;reimplementing TCP in practice.  We should be well within a TCP window&#xA;for these, so it&#39;s hard to see where we&#39;d win.&#xA;&#xA;&gt;&gt; I would also avoid the nonce to save recalculating for each node, and&#xA;&gt;&gt; instead define an id as:&#xA;&gt;&#xA;&gt; Doing this would greatly increase the cost of a collision though, as&#xA;&gt; it would happen in many places in the network at once over the on the&#xA;&gt; network at once, rather than just happening on a single link, thus&#xA;&gt; hardly impacting overall propagation.&#xA;&#xA;&#34;Greatly increase&#34;?  I don&#39;t see that.&#xA;&#xA;Let&#39;s assume an attacker grinds out 10,000 txs with 128 bits of the same&#xA;TXID, and gets them all in a block.  They then win the lottery and get a&#xA;collision.  Now we have to transmit ~48 bytes more than expected.&#xA;&#xA;&gt; Using the same nonce means you also would not get a recovery gain from&#xA;&gt; jointly decoding using compact blocks sent from multiple peers (which&#xA;&gt; you&#39;ll have anyways in high bandwidth mode).&#xA;&#xA;Not quite true, since if their mempools differ they&#39;ll use different&#xA;encoding lengths, but yes, you&#39;ll get less of this.&#xA;&#xA;&gt; With a nonce a sender does have the option of reusing what they got--&#xA;&gt; but the actual encoding cost is negligible, for a 2500 transaction&#xA;&gt; block its 27 microseconds (once per block, shared across all peers)&#xA;&gt; using Pieter&#39;s suggestion of siphash 1-3 instead of the cheaper&#xA;&gt; construct in the current draft.&#xA;&gt;&#xA;&gt; Of course, if you&#39;re going to check your whole mempool to reroll the&#xA;&gt; nonce, thats another matter-- but that seems wasteful compared to just&#xA;&gt; using a table driven size with a known negligible failure rate.&#xA;&#xA;I&#39;m not worried about the sender: The recipient needs to encode all the&#xA;mempool.&#xA;&#xA;&gt;&gt; As Peter R points out, we could later enhance receiver to brute force&#xA;&gt;&gt; collisions (you could speed that by sending a XOR of all the txids, but&#xA;&gt;&gt; really if there are more than a few collisions, give up).&#xA;&gt;&#xA;&gt; The band between &#34;no collisions&#34; and &#34;infeasible many&#34; is fairly&#xA;&gt; narrow.  You can add a small amount more space to the ids and&#xA;&gt; immediately be in the no collision zone.&#xA;&#xA;Indeed, I would be adding extra bits in the sender and not implementing&#xA;brute force in the receiver.  But I welcome someone else to do so.&#xA;&#xA;Cheers,&#xA;Rusty.</html></oembed>