<div dir="ltr"><div class="gmail_default" style="font-size:small"><pre style="color:rgb(0,0,0);word-wrap:break-word;white-space:pre-wrap">There was some confusion over the following email which was posted to the list
which appears to have been cancelled before a decision could be reached.

Please note the email seems inflammatory in the &quot;acknowledgement&quot; section and
really should have been rewritten to contain specific details of the objection
and corrections expected.

To be clear posts to the mailing list are either approved, or rejected for not
meeting the posting standards. This allows the author to make a quick correction
and resubmit. All rejections are cc&#39;d to <a href="https://lists.ozlabs.org/pipermail/bitcoin-dev-moderation/">https://lists.ozlabs.org/pipermail/bitcoin-dev-moderation/</a>
for transparency. Sometimes moderators get delayed - this week has been a busy
with lots of distractions one for everyone :)

I&#39;m copying the entire message below:

---------- Forwarded message ----------
From: Tom &lt;<a href="mailto:tomz@freedommail.ch">tomz@freedommail.ch</a>&gt;
To: <a href="mailto:bitcoin-dev@lists.linuxfoundation.org">bitcoin-dev@lists.linuxfoundation.org</a>, Matt Corallo &lt;<a href="mailto:lf-lists@mattcorallo.com">lf-lists@mattcorallo.com</a>&gt;
Cc: 
Date: Fri, 06 May 2016 13:31:15 +0100
Subject: Re: [bitcoin-dev] Compact Block Relay BIP
On Monday 02 May 2016 22:13:22 Matt Corallo via bitcoin-dev wrote:

Thanks for putting in the time to make a spec!

It looks good already, but I do think some more improvements can be made.


&gt; ===Intended Protocol Flow===
I&#39;m not a fan of the solution that a CNode should keep state and talk to
its remote nodes differently while announcing new blocks.
Its too complicated and ultimately counter-productive.

The problem is that an individual node needs to predict network behaviour in
advance. With the downside that if it guesses wrong that both nodes end up
paying for the wrong guess.
This is not a good way to design a p2p layer.



I would suggest that a new block is announced to all nodes equally and then
individual nodes can respond with a request of either a &#39;compact&#39; or a
normal block.
This is much more in line with the current design as well.

Detection if remote nodes support compact blocks, for the purpose of
requesting a compact-block, can be done either via a network-bit or just a
protocol version. Or something else entirely, if you have better
suggestions.



&gt; Variable-length integers: bytes are a MSB base-128 encoding of the
&gt; number.
&gt; The high bit in each byte signifies whether another digit follows.
&gt; [snip bitwise spec]

I suggest just referring to UTF-8 which describes this just fine.
it is good practice to refer to existing specs when possible and not copy
the details.

&gt; ====Short transaction IDs====
&gt; Short transaction IDs are used to represent a transaction without
&gt; sending a full 256-bit hash. They are calculated by:
&gt; # single-SHA256 hashing the block header with the nonce appended (in
&gt; little-endian)
&gt; # XORing each 8-byte chunk of the double-SHA256 transaction hash with
&gt; each corresponding 8-byte chunk of the hash from the previous step
&gt; # Adding each of the XORed 8-byte chunks together (in little-endian)
&gt; iteratively to find the short transaction ID

I don&#39;t think this is needed. Just use the first 8 bytes.
The reason to do xor-ing doesn&#39;t hold up and extra complexity is unneeded.
Especially since you mention some lines down;

&gt; The short transaction ID calculation is designed to take absolutely
&gt; minimal processing time during block compaction to avoid introducing
&gt; serious DoS vulnerabilities


==Acknowledgements==

I think you need to acknowledge some more people, or just remove this
paragraph.

Cheers


---------- Forwarded message ----------
From: <a href="mailto:bitcoin-dev-request@lists.linuxfoundation.org">bitcoin-dev-request@lists.linuxfoundation.org</a>
To: 
Cc: 
Date: Fri, 06 May 2016 12:31:23 +0000
Subject: confirm 37d25406a07ab77823fba5f9b450438c410ccd75
If you reply to this message, keeping the Subject: header intact,
Mailman will discard the held message.  Do this if the message is
spam.  If you reply to this message and include an Approved: header
with the list password in it, the message will be approved for posting
to the list.  The Approved: header can also appear in the first line
of the body of the reply.</pre></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, May 2, 2016 at 3:13 PM, Matt Corallo via bitcoin-dev <span dir="ltr">&lt;<a href="mailto:bitcoin-dev@lists.linuxfoundation.org" target="_blank">bitcoin-dev@lists.linuxfoundation.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi all,<br>
<br>
The following is a BIP-formatted design spec for compact block relay<br>
designed to limit on wire bytes during block relay. You can find the<br>
latest version of this document at<br>
<a href="https://github.com/TheBlueMatt/bips/blob/master/bip-TODO.mediawiki" rel="noreferrer" target="_blank">https://github.com/TheBlueMatt/bips/blob/master/bip-TODO.mediawiki</a>.<br>
<br>
There are several TODO items left on the document as indicated.<br>
Additionally, the implementation linked at the bottom of the document<br>
has a few remaining TODO items as well:<br>
<br>
 * Only request compact-block-announcement from one or two peers at a<br>
time, as the spec requires.<br>
 * Request new blocks using MSG_CMPCT_BLOCK where appropriate.<br>
 * Fill prefilledtxn with more than just the coinbase, as noted by the<br>
spec, up to 10K in transactions.<br>
<br>
Luke (CC&#39;d): Can you assign a BIP number?<br>
<br>
Thanks,<br>
Matt<br>
<br>
&lt;pre&gt;<br>
  BIP: TODO<br>
  Title: Compact block relay<br>
  Author: Matt Corallo &lt;<a href="mailto:bip@bluematt.me">bip@bluematt.me</a>&gt;<br>
  Status: Draft<br>
  Type: Standards Track<br>
  Created: 2016-04-27<br>
&lt;/pre&gt;<br>
<br>
==Abstract==<br>
<br>
Compact blocks on the wire as a way to save bandwidth for nodes on the<br>
P2P network.<br>
<br>
The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;,<br>
&quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this<br>
document are to be interpreted as described in RFC 2119.<br>
<br>
==Motivation==<br>
<br>
Historically, the Bitcoin P2P protocol has not been very bandwidth<br>
efficient for block relay. Every transaction in a block is included when<br>
relayed, even though a large number of the transactions in a given block<br>
are already available to nodes before the block is relayed. This causes<br>
moderate inbound bandwidth spikes for nodes when receiving blocks, but<br>
can cause very significant outbound bandwidth spikes for some nodes<br>
which receive a block before their peers. When such spikes occur, buffer<br>
bloat can make consumer-grade internet connections temporarily unusable,<br>
and can delay the relay of blocks to remote peers who may choose to wait<br>
instead of redundantly requesting the same block from other, less<br>
congested, peers.<br>
<br>
Thus, decreasing the bandwidth used during block relay is very useful<br>
for many individuals running nodes.<br>
<br>
While the goal of this work is explicitly not to reduce block transfer<br>
latency, it does, as a side effect reduce block transfer latencies in<br>
some rather significant ways. Additionally, this work forms a foundation<br>
for future work explicitly targeting low-latency block transfer.<br>
<br>
==Specification==<br>
<br>
===Intended Protocol Flow===<br>
TODO: Diagrams<br>
<br>
The protocol is intended to be used in two ways, depending on the peers<br>
and bandwidth available, as discussed [[#Implementation_Details|later]].<br>
The &quot;high-bandwidth&quot; mode, which nodes may only enable for a few of<br>
their peers, is enabled by setting the first boolean to 1 in a<br>
&quot;sendcmpct&quot; message. In this mode, peers send new block announcements<br>
with the short transaction IDs already, possibly even before fully<br>
validating the block. In some cases no further round-trip is needed, and<br>
the receiver can reconstruct the block and process it as usual<br>
immediately. When some transactions were not available from local<br>
sources (ie mempool), a getblocktxn/blocktxn roundtrip is neccessary,<br>
bringing the best-case latency to the same 1.5*RTT minimum time that<br>
nodes take today, though with significantly less bandwidth usage.<br>
<br>
The &quot;low-bandwidth&quot; mode is enabled by setting the first boolean to 0 in<br>
a &quot;sendcmpct&quot; message. In this mode, peers send new block announcements<br>
with the usual inv/headers announcements (as per BIP130, and after fully<br>
validating the block). The receiving peer may then request the block<br>
using a MSG_CMPCT_BLOCK getdata reqeuest, which will receive a response<br>
of the header and short transaction IDs. In some cases no further<br>
round-trip is needed, and the receiver can reconstruct the block and<br>
process it as usual, taking the same 1.5*RTT minimum time that nodes<br>
take today, though with significantly less bandwidth usage. When some<br>
transactions were not available from local sources (ie mempool), a<br>
getblocktxn/blocktxn roundtrip is neccessary, bringing the best-case<br>
latency to 2.5*RTT, again with significantly less bandwidth usage than<br>
today. Because TCP often exhibits worse transfer latency for larger data<br>
sizes (as a multiple of RTT), total latency is expected to be reduced<br>
even when full the 2.5*RTT transfer mechanism is used.<br>
<br>
===New data structures===<br>
Several new data structures are added to the P2P network to relay<br>
compact blocks: PrefilledTransaction, HeaderAndShortIDs,<br>
BlockTransactionsRequest, and BlockTransactions. Additionally, we<br>
introduce a new variable-length integer encoding for use in these data<br>
structures.<br>
<br>
For the purposes of this section, CompactSize refers to the<br>
variable-length integer encoding used across the existing P2P protocol<br>
to encode array lengths, among other things, in 1, 3, 5 or 9 bytes.<br>
<br>
====New VarInt====<br>
TODO: I just copied this out of the src...Something that is<br>
wiki-formatted and more descriptive should be used here isntead.<br>
<br>
Variable-length integers: bytes are a MSB base-128 encoding of the number.<br>
The high bit in each byte signifies whether another digit follows. To make<br>
sure the encoding is one-to-one, one is subtracted from all but the last<br>
digit.<br>
Thus, the byte sequence a[] with length len, where all but the last byte<br>
has bit 128 set, encodes the number:<br>
<br>
(a[len-1] &amp; 0x7F) + sum(i=1..len-1, 128^i*((a[len-i-1] &amp; 0x7F)+1))<br>
<br>
Properties:<br>
* Very small (0-127: 1 byte, 128-16511: 2 bytes, 16512-2113663: 3 bytes)<br>
* Every integer has exactly one encoding<br>
* Encoding does not depend on size of original integer type<br>
* No redundancy: every (infinite) byte sequence corresponds to a list<br>
  of encoded integers.<br>
<br>
0:         [0x00]  256:        [0x81 0x00]<br>
1:         [0x01]  16383:      [0xFE 0x7F]<br>
127:       [0x7F]  16384:      [0xFF 0x00]<br>
128:  [0x80 0x00]  16511: [0x80 0xFF 0x7F]<br>
255:  [0x80 0x7F]  65535: [0x82 0xFD 0x7F]<br>
2^32:           [0x8E 0xFE 0xFE 0xFF 0x00]<br>
<br>
Several uses of New VarInts below are &quot;differentially encoded&quot;. For<br>
these, instead of using raw indexes, the number encoded is the<br>
difference between the current index and the previous index, minus one.<br>
For example, a first index of 0 implies a real index of 0, a second<br>
index of 0 thereafter refers to a real index of 1, etc.<br>
<br>
====PrefilledTransaction====<br>
A PrefilledTransaction structure is used in HeaderAndShortIDs to provide<br>
a list of a few transactions explicitly.<br>
<br>
{|<br>
|Field Name||Type||Size||Encoding||Purpose<br>
|-<br>
|index||New VarInt||1-3 bytes||[[#New_VarInt|New VarInt]],<br>
differentially encoded since the last PrefilledTransaction in a<br>
list||The index into the block at which this transaction is<br>
|-<br>
|tx||Transaction||variable||As encoded in &quot;tx&quot; messages||The transaction<br>
which is in the block at index index.<br>
|}<br>
<br>
====HeaderAndShortIDs====<br>
A HeaderAndShortIDs structure is used to relay a block header, the short<br>
transactions IDs used for matching already-available transactions, and a<br>
select few transactions which we expect a peer may be missing.<br>
<br>
{|<br>
|Field Name||Type||Size||Encoding||Purpose<br>
|-<br>
|header||Block header||80 bytes||First 80 bytes of the block as defined<br>
by the encoding used by &quot;block&quot; messages||The header of the block being<br>
provided<br>
|-<br>
|nonce||uint64_t||8 bytes||Little Endian||A nonce for use in short<br>
transaction ID calculations<br>
|-<br>
|shortids_length||CompactSize||1, 3, 5, or 9 bytes||As used elsewhere to<br>
encode array lengths||The number of short transaction IDs in shortids<br>
|-<br>
|shortids||List of uint64_ts||8*shortids_length bytes||Little<br>
Endian||The short transaction IDs calculated from the transactions which<br>
were not provided explicitly in prefilledtxn<br>
|-<br>
|prefilledtxn_length||CompactSize||1, 3, 5, or 9 bytes||As used<br>
elsewhere to encode array lengths||The number of prefilled transactions<br>
in prefilledtxn<br>
|-<br>
|prefilledtxn||List of PrefilledTransactions||variable<br>
size*prefilledtxn_length||As defined by PrefilledTransaction definition,<br>
above||Used to provide the coinbase transaction and a select few which<br>
we expect a peer may be missing<br>
|}<br>
<br>
====BlockTransactionsRequest====<br>
A BlockTransactionsRequest structure is used to list transaction indexes<br>
in a block being requested.<br>
<br>
{|<br>
|Field Name||Type||Size||Encoding||Purpose<br>
|-<br>
|blockhash||Binary blob||32 bytes||The output from a double-SHA256 of<br>
the block header, as used elsewhere||The blockhash of the block which<br>
the transactions being requested are in<br>
|-<br>
|indexes_length||New VarInt||1-3 bytes||As defined in [[#New_VarInt|New<br>
VarInt]]||The number of transactions being requested<br>
|-<br>
|indexes||List of New VarInts||1-3 bytes*indexes_length||As defined in<br>
[[#New_VarInt|New VarInt]], differentially encoded||The indexes of the<br>
transactions being requested in the block<br>
|}<br>
<br>
====BlockTransactions====<br>
A BlockTransactions structure is used to provide some of the<br>
transactions in a block, as requested.<br>
<br>
{|<br>
|Field Name||Type||Size||Encoding||Purpose<br>
|-<br>
|blockhash||Binary blob||32 bytes||The output from a double-SHA256 of<br>
the block header, as used elsewhere||The blockhash of the block which<br>
the transactions being provided are in<br>
|-<br>
|transactions_length||New VarInt||1-3 bytes||As defined in<br>
[[#New_VarInt|New VarInt]]||The number of transactions provided<br>
|-<br>
|transactions||List of Transactions||variable||As encoded in &quot;tx&quot;<br>
messages||The transactions provided<br>
|}<br>
<br>
====Short transaction IDs====<br>
Short transaction IDs are used to represent a transaction without<br>
sending a full 256-bit hash. They are calculated by:<br>
# single-SHA256 hashing the block header with the nonce appended (in<br>
little-endian)<br>
# XORing each 8-byte chunk of the double-SHA256 transaction hash with<br>
each corresponding 8-byte chunk of the hash from the previous step<br>
# Adding each of the XORed 8-byte chunks together (in little-endian)<br>
iteratively to find the short transaction ID<br>
<br>
===New messages===<br>
A new inv type (MSG_CMPCT_BLOCK == 4) and several new protocol messages<br>
are added: sendcmpct, cmpctblock, getblocktxn, and blocktxn.<br>
<br>
====sendcmpct====<br>
# The sendcmpct message is defined as a message containing a 1-byte<br>
integer followed by a 8-byte integer where pchCommand == &quot;sendcmpct&quot;.<br>
# The first integer SHALL be interpreted as a boolean (and MUST have a<br>
value of either 1 or 0)<br>
# The second integer SHALL be interpreted as a little-endian version<br>
number. Nodes sending a sendcmpct message MUST currently set this value<br>
to 1.<br>
# Upon receipt of a &quot;sendcmpct&quot; message with the first and second<br>
integers set to 1, the node SHOULD announce new blocks by sending a<br>
cmpctblock message.<br>
# Upon receipt of a &quot;sendcmpct&quot; message with the first integer set to 0,<br>
the node SHOULD NOT announce new blocks by sending a cmpctblock message,<br>
but SHOULD announce new blocks by sending invs or headers, as defined by<br>
BIP130.<br>
# Upon receipt of a &quot;sendcmpct&quot; message with the second integer set to<br>
something other than 1, nodes SHOULD treat the peer as if they had not<br>
received the message (as it indicates the peer will provide an<br>
unexpected encoding in cmpctblock, and/or other, messages)<br>
# Nodes SHOULD check for a protocol version of &gt;= 70014 before sending<br>
sendcmpct messages.<br>
# Nodes MUST NOT send a request for a MSG_CMPCT_BLOCK object to a peer<br>
before having received a sendcmpct message from that peer.<br>
<br>
====MSG_CMPCT_BLOCK====<br>
# getdata messages may now contain requests for MSG_CMPCT_BLOCK objects.<br>
# Upon receipt of a getdata containing a request for a MSG_CMPCT_BLOCK<br>
object with the hash of a block which was recently announced and after<br>
having sent the requesting peer a sendcmpct message, nodes MUST respond<br>
with a cmpctblock message containing appropriate data representing the<br>
block being requested.<br>
# MSG_CMPCT_BLOCK inv objects MUST NOT appear anywhere except for in<br>
getdata messages.<br>
<br>
====cmpctblock====<br>
# The cmpctblock message is defined as as a message containing a<br>
serialized HeaderAndShortIDs message and pchCommand == &quot;cmpctblock&quot;.<br>
# Upon receipt of a cmpctblock message after sending a sendcmpct<br>
message, nodes SHOULD calculate the short transaction ID for each<br>
unconfirmed transaction they have available (ie in their mempool) and<br>
compare each to each short transaction ID in the cmpctblock message.<br>
# After finding already-available transactions, nodes which do not have<br>
all transactions available to reconstruct the full block SHOULD request<br>
the missing transactions using a getblocktxn message.<br>
# A node MUST NOT send a cmpctblock message unless they are able to<br>
respond to a getblocktxn message which requests every transaction in the<br>
block.<br>
# A node MUST NOT send a cmpctblock message without having validated<br>
that the header properly commits to each transaction in the block, and<br>
properly builds on top of the existing chain with a valid proof-of-work.<br>
A node MAY send a cmpctblock before validating that each transaction in<br>
the block validly spends existing UTXO set entries.<br>
<br>
====getblocktxn====<br>
# The getblocktxn message is defined as as a message containing a<br>
serialized BlockTransactionsRequest message and pchCommand == &quot;getblocktxn&quot;.<br>
# Upon receipt of a properly-formatted getblocktxnmessage, nodes which<br>
recently provided the sender of such a message a cmpctblock for the<br>
block hash identified in this message MUST respond with an appropriate<br>
blocktxn message. Such a blocktxn message MUST contain exactly and only<br>
each transaction which is present in the appropriate block at the index<br>
specified in the getblocktxn indexes list, in the order requested.<br>
<br>
====blocktxn====<br>
# The blocktxn message is defined as as a message containing a<br>
serialized BlockTransactions message and pchCommand == &quot;blocktxn&quot;.<br>
# Upon receipt of a properly-formatted requested blocktxn message, nodes<br>
SHOULD attempt to reconstruct the full block by:<br>
## Taking the prefilledtxn transactions from the original cmpctblock and<br>
placing them in the marked positions.<br>
## For each short transaction ID from the original cmpctblock, in order,<br>
find the corresponding transaction either from the blocktxn message or<br>
from other sources and place it in the first available position in the<br>
block.<br>
# Once the block has been reconstructed, it shall be processed as<br>
normal, keeping in mind that short transaction IDs are expected to<br>
occasionally collide, and that nodes MUST NOT be penalized for such<br>
collisions, wherever they appear.<br>
<br>
===Implementation Notes===<br>
# For nodes which have sufficient inbound bandwidth, sending a sendcmpct<br>
message with the first integer set to 1 to up to three peers is<br>
RECOMMENDED. If possible, it is RECOMMENDED that those peers be selected<br>
based on their past performance in providing blocks quickly. This will<br>
allow them to receive some blocks in only 0.5*RTT between them and the<br>
sending peer. It will also reduce their block transfer latency in other<br>
cases due to the smaller amount of data transmitted. Nodes MUST NOT send<br>
such sendcmpct messages to all peers, as it encourages wasting outbound<br>
bandwidth across the network.<br>
<br>
# All nodes SHOULD send a sendcmpct message to all appropriate peers.<br>
This will reduce their outbound bandwidth usage by allowing their peers<br>
to request compact blocks instead of full blocks.<br>
<br>
# Nodes with limited inbound bandwidth SHOULD request blocks using<br>
MSG_CMPCT_BLOCK/getblocktxn requests, when possible. While this<br>
increases worst-case message round-trips, it is expected to reduce<br>
overall transfer latency as TCP is more likely to exhibit poor<br>
throughput on low-bandwidth nodes.<br>
<br>
# Nodes sending cmpctblock messages SHOULD make an attempt to not place<br>
too many transactions into prefilledtxn (ie should limit prefilledtxn to<br>
only around 10KB of transactions). When in doubt, nodes SHOULD only<br>
include the coinbase transaction in prefilledtxn.<br>
<br>
# Nodes MAY pick one nonce per block they wish to send, and only build a<br>
cmpctblock message once for all peers which they wish to send a given<br>
block to. Nodes SHOULD NOT use the same nonce across multiple different<br>
blocks.<br>
<br>
# Nodes MAY impose additional requirements on when they announce new<br>
blocks by sending cmpctblock messages. For example, nodes with limited<br>
outbound bandwidth MAY choose to announce new blocks using inv/header<br>
messages (as per BIP130) to conserve outbound bandwidth.<br>
<br>
# Note that the MSG_CMPCT_BLOCK section does not require that nodes<br>
respond to MSG_CMPCT_BLOCK getdata requests for blocks which they did<br>
not recently announce. This allows nodes to calculate cmpctblock<br>
messages at announce-time instead of at request-time. Thus, nodes MUST<br>
NOT request blocks using MSG_CMPCT_BLOCK getdatas unless it is in<br>
response to an inv/headers block announcement (as per BIP130), and MUST<br>
NOT request blocks using MSG_CMPCT_BLOCK getdatas in response to headers<br>
messages which were, themselves, responses to getheaders requests.<br>
<br>
# While the current version sends transactions with the same encodings<br>
as is used in tx messages and elsewhere in the protocol, the version<br>
field in sendcmpct is intended to allow this to change in the future.<br>
For this reason, it is recommended that the code used to decode<br>
PrefilledTransaction and BlockTransactions messages be prepared to take<br>
a different transaction encoding, if and when the version field in<br>
sendcmpct changes in a future BIP.<br>
<br>
==Justification==<br>
<br>
====Protocol design====<br>
There have been many proposals to save wire bytes when relaying blocks.<br>
Many of them have a two-fold goal of reducing block relay time and thus<br>
rely on the use of significant processing power in order to avoid<br>
introducing additional worst-case RTTs. Because this work is not focused<br>
primarily on reducing block relay time, its design is much simpler (ie<br>
does not rely on set reconciliation protocols). Still, in testing at the<br>
time of writing, nodes are able to relay blocks without the extra<br>
getblocktxn/blocktxn RTT around 90% of the time. With a smart<br>
compact-block-announcement policy, it is thus expected that this work<br>
might allow blocks to be relayed between nodes in 0.5*RTT instead of<br>
1.5*RTT at least 75% of the time.<br>
<br>
====Use of New VarInts====<br>
Bitcoin has long had a variable-length integer implementation (referred<br>
to as CompactSize in this document), making a second a strange protocol<br>
quirk. However, in this protocol most of our variable-length integers<br>
are between 0 and 2000. For both encodings, small numbers (&lt;100) are<br>
encoded as 1-byte. For numbers over 250, the CompactSize encoding begins<br>
to use 3 bytes instead of 1, whereas the New VarInt encoding uses 2.<br>
Because the primary motivation for this work is to save bytes during<br>
block relay, the extra byte of saving per transaction-difference is<br>
considered worth the extra design complexity.<br>
<br>
====Short transaction ID calculation====<br>
The short transaction ID calculation is designed to take absolutely<br>
minimal processing time during block compaction to avoid introducing<br>
serious DoS vulnerabilities such as those introduced by the<br>
bloom-filtering in BIP 37. As such, it is possible for a node to<br>
construct one compact-block representation of a block for relay to<br>
multiple peers. Additionally, only one cryptographic hash (2 SHA rounds)<br>
is used when calculating the short transaction IDs for an entire block.<br>
<br>
The XOR-and-add method is used for calculating short transaction IDs<br>
primarily because it is fast and is reasonably able to limit the ability<br>
of an attacker who does not know the block hash or nonce to cause<br>
collisions in short transaction IDs. If an attacker were able to cause<br>
such collisions, filling mempools (and, thus, blocks) with them would<br>
cause poor network propagation of new (or non-attacker, in the case of a<br>
miner) blocks.<br>
<br>
The 8-byte nonce in short transaction ID calculation is used to<br>
introduce additional entropy on a per-node level. While the use of 8<br>
bytes is sufficient for an attacker to maliciously cause short<br>
transaction ID collisions in their own block relay, this would have less<br>
of an effect than if such an attacker were relaying headers/invs and not<br>
responding to requests for the full block.<br>
<br>
==Backward compatibility==<br>
<br>
Older clients remain fully compatible and interoperable after this change.<br>
<br>
==Implementation==<br>
<br>
<a href="https://github.com/TheBlueMatt/bitcoin/tree/udp" rel="noreferrer" target="_blank">https://github.com/TheBlueMatt/bitcoin/tree/udp</a><br>
<br>
==Acknowledgements==<br>
<br>
Thanks to Gregory Maxwell for the initial suggestion as well as a lot of<br>
back-and-forth design and significant testing.<br>
<br>
==Copyright==<br>
<br>
This document is placed in the public domain.<br>
<br>
_______________________________________________<br>
bitcoin-dev mailing list<br>
<a href="mailto:bitcoin-dev@lists.linuxfoundation.org">bitcoin-dev@lists.linuxfoundation.org</a><br>
<a href="https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev" rel="noreferrer" target="_blank">https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev</a><br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div>Johnathan Corgan<br>Corgan Labs - SDR Training and Development Services</div><div><a href="http://corganlabs.com" style="font-size:12.8px" target="_blank">http://corganlabs.com</a><br></div></div></div></div></div></div></div></div></div>
</div></div>