From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 5B52B12A4 for ; Thu, 24 Sep 2015 18:02:30 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from mail-ob0-f177.google.com (mail-ob0-f177.google.com [209.85.214.177]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 3A1DE126 for ; Thu, 24 Sep 2015 18:02:29 +0000 (UTC) Received: by obbmp4 with SMTP id mp4so64345912obb.3 for ; Thu, 24 Sep 2015 11:02:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=wQxVN9UX/nlc/b3ry4Nf/n3RRvUnmFu8KVFEJh7S0Eo=; b=pXGrl39B+/K1gmSbUJCCD0gZZZaEEzME1Jy5Qz69Fp2cDVufQhzABQZ2GoZWBSdmRh RY8qVRVwWRxCQUl8pe0GT2s1oKI6wQMmuYessJxABz78JKnsOhEJKyV/k/2XmEcQlHza dTCGsqEugACmuNPr0FAmJzDu3QGUyz91It/NnyJ/dq+p9+sVx0Uw1720z8GiYeKJ76aT nxj31Q0xV6Fz4FalHfWwHSiyCiqBCBbMvOaHZtmpdGVv4EMRiSvKNjGt5pU7oFwfpZN7 cGwC6ALhSd9DsyK/rnF1I4SMY/WX4OXow2yHNjfr/0RQRjYHVZ1nPyGd1TwKY2iwDGsG BwpQ== MIME-Version: 1.0 X-Received: by 10.182.70.101 with SMTP id l5mr570094obu.51.1443117748474; Thu, 24 Sep 2015 11:02:28 -0700 (PDT) Received: by 10.202.197.83 with HTTP; Thu, 24 Sep 2015 11:02:28 -0700 (PDT) Date: Thu, 24 Sep 2015 14:02:28 -0400 Message-ID: From: Suhas Daftuar To: Bitcoin Dev Content-Type: multipart/alternative; boundary=089e0149c320c45a44052082080b X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Subject: [bitcoin-dev] [BIP Proposal] New "sendheaders" p2p message X-BeenThere: bitcoin-dev@lists.linuxfoundation.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: Bitcoin Development Discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Sep 2015 18:02:30 -0000 --089e0149c320c45a44052082080b Content-Type: text/plain; charset=UTF-8 Hi, I'm proposing the addition of a new, optional p2p message to help improve the way blocks are announced on the network. The draft BIP is available here and pasted below: https://gist.github.com/sdaftuar/465bf008f0a4768c0def The goal of this p2p message is to facilitate nodes being able to optionally announce blocks with headers messages rather than with inv's, which is particularly beneficial since the introduction of headers-first download in Bitcoin Core 0.10. In particular, this allows for more efficient propagation of reorgs as it would eliminate a round trip in network communication. The implementation of this BIP (which includes code to directly fetch blocks based on announced headers) is in https://github.com/bitcoin/bitcoin/pull/6494. For additional background, please also see https://github.com/bitcoin/bitcoin/issues/5982. Note that this new p2p message is optional; nodes can feel free to ignore and continue to use inv messages to announce new blocks. Thanks to Pieter Wuille for suggesting this idea. Draft BIP text:
  BIP: 
  Title: sendheaders message
  Author: Suhas Daftuar 
  Status: Draft
  Type: Standards Track
  Created: 2015-05-08
==Abstract== Add a new message, "sendheaders", which indicates that a node prefers to receive new block announcements via a "headers" message rather than an "inv". ==Motivation== Since the introduction of "headers-first" downloading of blocks in 0.10, blocks will not be processed unless they are able to connect to a (valid) headers chain. Consequently, block relay generally works as follows: # A node (N) announces the new tip with an "inv" message, containing the block hash # A peer (P) responds to the "inv" with a "getheaders" message (to request headers up to the new tip) and a "getdata" message for the new tip itself # N responds with a "headers" message (with the header for the new block along with any preceding headers unknown to P) and a "block" message containing the new block However, in the case where a new block is being announced that builds on the tip, it would be generally more efficient if the node N just announced the block header for the new block, rather than just the block hash, and saved the peer from generating and transmitting the getheaders message (and the required block locator). In the case of a reorg, where 1 or more blocks are disconnected, nodes currently just send an "inv" for the new tip. Peers currently are able to request the new tip immediately, but wait until the headers for the intermediate blocks are delivered before requesting those blocks. By announcing headers from the last fork point leading up to the new tip in the block announcement, peers are able to request all the intermediate blocks immediately. ==Specification== # The sendheaders message is defined as an empty message where pchCommand == "sendheaders" # Upon receipt of a "sendheaders" message, the node will be permitted, but not required, to announce new blocks by sending the header of the new block (along with any other blocks that a node believes a peer might need in order for the block to connect). # Feature discovery is enabled by checking protocol version >= 70012 ==Backward compatibility== Older clients remain fully compatible and interoperable after this change. ==Implementation== https://github.com/bitcoin/bitcoin/pull/6494 --089e0149c320c45a44052082080b Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Hi,

I'm proposing the addition of a= new, optional p2p message to help improve the way blocks are announced on = the network.=C2=A0 The draft BIP is available here and pasted below:
<= div>
<= br>
The goal of this p2p message is to facilitate nodes being abl= e to optionally announce blocks with headers messages rather than with inv&= #39;s, which is particularly beneficial since the introduction of headers-f= irst download in Bitcoin Core 0.10.=C2=A0 In particular, this allows for mo= re efficient propagation of reorgs as it would eliminate a round trip in ne= twork communication.

The implementation of this BI= P (which includes code to directly fetch blocks based on announced headers)= is in https://git= hub.com/bitcoin/bitcoin/pull/6494.=C2=A0 For additional background, ple= ase also see htt= ps://github.com/bitcoin/bitcoin/issues/5982.

N= ote that this new p2p message is optional; nodes can feel free to ignore an= d continue to use inv messages to announce new blocks.

=
Thanks to Pieter Wuille for suggesting this idea.

=
Draft BIP text:

<pre>
=C2=A0 Title: sendheaders message
=C2=A0 Author: Suhas Daftuar <sdaftuar@chaincode.com>
=C2=A0 Status: Draft
=C2=A0 Type: Standards Track
=C2=A0 Created: 2015-05-08
</pre>

=3D=3DAbstract=3D=3D

A= dd a new message, "sendheaders", which indicates that a node pref= ers to receive new block announcements via a "headers" message ra= ther than an "inv".

=3D=3DMot= ivation=3D=3D

Since the introduction of= "headers-first" downloading of blocks in 0.10, blocks will not b= e processed unless
the= y are able to connect to a (valid) headers chain.=C2=A0 Consequently, block= relay generally works
as follows:
# A node = (N) announces the new tip with an "inv" message, containing the b= lock hash
# A peer (P)= responds to the "inv" with a "getheaders" message (to = request headers up to the new tip) and a "getdata" message for th= e new tip itself
# N r= esponds with a "headers" message (with the header for the new blo= ck along with any preceding headers unknown to P) and a "block" m= essage containing the new block

However= , in the case where a new block is being announced that builds on the tip, = it would be generally more efficient if the node N just announced the block= header for the new block, rather than just the block hash, and saved the p= eer from generating and transmitting the getheaders message (and the requir= ed block locator).
In the case of a reo= rg, where 1 or more blocks are disconnected, nodes currently just send an &= quot;inv" for the new tip.=C2=A0 Peers currently are able to request t= he new tip immediately, but wait until the headers for the intermediate blo= cks are delivered before requesting those blocks.=C2=A0 By announcing heade= rs from the last fork point leading up to the new tip in the block announce= ment, peers are able to request all the intermediate blocks immediately.

=3D=3DSpecification=3D=3D

# The sendheaders message is defined as an empty messa= ge where pchCommand =3D=3D "sendheaders"
# Upon receipt of a "sendheaders" me= ssage, the node will be permitted, but not required, to announce new blocks= by sending the header of the new block (along with any other blocks that a= node believes a peer might need in order for the block to connect).=
# Feature discovery is enabl= ed by checking protocol version >=3D 70012

=3D=3DBackward compatibility=3D=3D

Older clients remain fully compatible and interoperable after this cha= nge.

=
=3D=3DImplementation=3D=3D<= /div>

--089e0149c320c45a44052082080b--