<oembed><type>rich</type><version>1.0</version><author_name>npub1e46n428mcyfwznl7nlsf6d3s7rhlwm9x3cmkuqzt3emmdpadmkaqqjxmcu</author_name><author_url>https://nostr.ae/npub1e46n428mcyfwznl7nlsf6d3s7rhlwm9x3cmkuqzt3emmdpadmkaqqjxmcu</author_url><provider_name>njump</provider_name><provider_url>https://nostr.ae</provider_url><html>📅 Original date posted:2016-05-08&#xA;📝 Original message:(This response was originally off-list as moderators were still&#xA;deciding, here it is for those interested).&#xA;&#xA;Hi Tom,&#xA;&#xA;Thanks for reading the draft text and commenting! Replies inline.&#xA;&#xA;Matt&#xA;&#xA;On 05/08/16 00:40, Johnathan Corgan wrote:&#xA;&gt; ---------- Forwarded message ----------&#xA;&gt; From: Tom &lt;tomz at freedommail.ch &lt;mailto:tomz at freedommail.ch&gt;&gt;&#xA;&gt; To: bitcoin-dev at lists.linuxfoundation.org&#xA;&gt; &lt;mailto:bitcoin-dev at lists.linuxfoundation.org&gt;, Matt Corallo &lt;lf-lists at mattcorallo.com &lt;mailto:lf-lists at mattcorallo.com&gt;&gt;&#xA;&gt; Cc: &#xA;&gt; Date: Fri, 06 May 2016 13:31:15 +0100&#xA;&gt; Subject: Re: [bitcoin-dev] Compact Block Relay BIP&#xA;&gt; On Monday 02 May 2016 22:13:22 Matt Corallo via bitcoin-dev wrote:&#xA;&gt; &#xA;&gt; Thanks for putting in the time to make a spec!&#xA;&gt; &#xA;&gt; It looks good already, but I do think some more improvements can be made.&#xA;&gt; &#xA;&gt; &#xA;&gt;&gt; ===Intended Protocol Flow===&#xA;&gt; I&#39;m not a fan of the solution that a CNode should keep state and talk to&#xA;&gt; its remote nodes differently while announcing new blocks.&#xA;&gt; Its too complicated and ultimately counter-productive.&#xA;&gt; &#xA;&gt; The problem is that an individual node needs to predict network behaviour in&#xA;&gt; advance. With the downside that if it guesses wrong that both nodes end up&#xA;&gt; paying for the wrong guess.&#xA;&gt; This is not a good way to design a p2p layer.&#xA;&#xA;Nodes don&#39;t need to predict much in advance, and the cost for predicting&#xA;wrong is 0 if your peers receive blocks with a few hundred ms between&#xA;them (as we should expect) and you haven&#39;t set the announce bit on more&#xA;than a few peers (as the spec requires for this reason). As for&#xA;complexity of keeping state, think of it as a version flag in much the&#xA;same way sendheaders operates.&#xA;&#xA;It seems I forgot to add a suggested peer-preforwarding-selection&#xA;algorithm in the text, but the intended use-case is to set the bit on&#xA;peers which recently provided you blocks faster than other peers, up to&#xA;only one or three peers. This is both simple and should be incredibly&#xA;effective.&#xA;&#xA;[This has now been clarified in the BIP text]&#xA;&#xA;&gt; I would suggest that a new block is announced to all nodes equally and then&#xA;&gt; individual nodes can respond with a request of either a &#39;compact&#39; or a&#xA;&gt; normal block.&#xA;&gt; This is much more in line with the current design as well.&#xA;&gt; &#xA;&gt; Detection if remote nodes support compact blocks, for the purpose of&#xA;&gt; requesting a compact-block, can be done either via a network-bit or just a&#xA;&gt; protocol version. Or something else entirely, if you have better&#xA;&gt; suggestions.&#xA;&#xA;In line with recent trends, neither service bits nor protocol versions&#xA;are particularly well-suited for this purpose. Protocol versions are&#xA;impossible to handle sanely across different nodes on the network, as&#xA;they cannot indicate optional features. Service bits, while somewhat&#xA;more appropriate for this purpose, are a very limited resource which is&#xA;generally better suited to indicating significant new features which&#xA;nodes might need for correct operation, and thus might wish to actively&#xA;seek out when making connections. I&#39;m not sure anyone is suggesting that&#xA;here, and absent that recent agreement preferred message-based feature&#xA;indication instead of version-message-extension.&#xA;&#xA;&gt;&gt; Variable-length integers: bytes are a MSB base-128 encoding of the&#xA;&gt;&gt; number.&#xA;&gt;&gt; The high bit in each byte signifies whether another digit follows.&#xA;&gt;&gt; [snip bitwise spec]&#xA;&gt; &#xA;&gt; I suggest just referring to UTF-8 which describes this just fine.&#xA;&gt; it is good practice to refer to existing specs when possible and not copy&#xA;&gt; the details.&#xA;&#xA;Hmm? There is no UTF anywhere in this protocol. Indeed this section&#xA;needs to be rewritten, as indicated. I&#39;d recommend you read the code&#xA;until I update the section with better text if you&#39;re confused.&#xA;&#xA;&gt;&gt; ====Short transaction IDs====&#xA;&gt;&gt; Short transaction IDs are used to represent a transaction without&#xA;&gt;&gt; sending a full 256-bit hash. They are calculated by:&#xA;&gt;&gt; # single-SHA256 hashing the block header with the nonce appended (in&#xA;&gt;&gt; little-endian)&#xA;&gt;&gt; # XORing each 8-byte chunk of the double-SHA256 transaction hash with&#xA;&gt;&gt; each corresponding 8-byte chunk of the hash from the previous step&#xA;&gt;&gt; # Adding each of the XORed 8-byte chunks together (in little-endian)&#xA;&gt;&gt; iteratively to find the short transaction ID&#xA;&gt; &#xA;&gt; I don&#39;t think this is needed. Just use the first 8 bytes.&#xA;&gt; The reason to do xor-ing doesn&#39;t hold up and extra complexity is unneeded.&#xA;&gt; Especially since you mention some lines down;&#xA;&gt; &#xA;&gt;&gt; The short transaction ID calculation is designed to take absolutely&#xA;&gt;&gt; minimal processing time during block compaction to avoid introducing&#xA;&gt;&gt; serious DoS vulnerabilities&#xA;&#xA;I&#39;m confused as to what, specifically, you&#39;re proposing this be changed&#xA;to. I&#39;m pretty sure the proposed protocol is about as simple as you can&#xA;get while retaining some reasonable collision resistance. I might,&#xA;however, decide to switch to siphash with a very low round count, given&#xA;that it&#39;s probably faster than the cache-fill-time taken by just&#xA;iterating over the mempool. Needs a bit further investigation.&#xA;&#xA;&gt; ==Acknowledgements==&#xA;&gt; &#xA;&gt; I think you need to acknowledge some more people, or just remove this&#xA;&gt; paragraph.&#xA;&gt; &#xA;&gt; Cheers&#xA;&#xA;Greg was the only large contributor to the document (and was a very&#xA;large contributor, as mentioned - the work is based hugely on a protocol&#xA;recommendation he wrote up several years ago) don&#39;t see why this should&#xA;mean he doesn&#39;t get credit.&#xA;&#xA;[For those interested, I&#39;m referring here to&#xA;https://en.bitcoin.it/wiki/User:Gmaxwell/block_network_coding. This&#xA;BIP/the implementation is a precursor to an implementation that looks&#xA;similar to what Greg proposes there which can be found on my udp-wip&#xA;branch, which is based on and uses the data structures involved here.]</html></oembed>