I agree that it would be nice if the protocol stayed stateless. <div><br></div><div>I also think we should try and keep in our heads the aggregate bitcoin-universe cost of implementing any protocol change; even a very small change, something that truly only takes one hour of time from each bitcoin node client developer to implement, test and bugfix (hah!) Has a cost in the (tens?) of thousands of USD added up across those who need to understand, implement, discuss, etc.</div>

<div><br></div><div>Peter</div><div><br><div class="gmail_quote">On Thu, Apr 12, 2012 at 10:24 AM, Amir Taaki <span dir="ltr">&lt;<a href="mailto:zgenjix@yahoo.com">zgenjix@yahoo.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

Jeff elaborated the problems very well, but I just want to add this:<br>
<br>
Your change is essentially relying (trusting) the server to track a piece of information (your state). Anytime you start depending on another node in some way, it is opening yourself up to be exploited. Nodes should be doing their owning state maintainance, not relying on external parties.<br>


<br>
<br>
I am very much against the change. As someone who has implemented the complete bitcoin protocol, I had no problems implementing the blockchain download. In fact, I dislike that nodes have to store the last inventory they sent as part of a getblocks in order to trigger the next round. It&#39;s be better if there was no state whatsoever.<br>


<br>
________________________________<br>
From: Jeff Garzik &lt;<a href="mailto:jgarzik@exmulti.com">jgarzik@exmulti.com</a>&gt;<br>
To: <a href="mailto:sirk390@gmail.com">sirk390@gmail.com</a><br>
Cc: <a href="mailto:bitcoin-development@lists.sourceforge.net">bitcoin-development@lists.sourceforge.net</a><br>
Sent: Thursday, April 12, 2012 6:12 PM<br>
<div class="im HOEnZb">Subject: Re: [Bitcoin-development] Adding request/reply id in messages<br>
<br>
</div><div class="HOEnZb"><div class="h5">On Wed, Apr 11, 2012 at 2:39 PM, Christian Bodt &lt;<a href="mailto:sirk390@gmail.com">sirk390@gmail.com</a>&gt; wrote:<br>
&gt; Hi,<br>
&gt;<br>
&gt; I would like to discuss the following bitcoin protocol improvement proposal:<br>
&gt;<br>
&gt;          Adding request/reply id in all messages (in the message header,<br>
&gt; based on what was done for the &quot;checksum&quot; field)<br>
&gt;<br>
&gt; The original reason is that I found it very hard to implement robust<br>
&gt; blockchain downloading as we are missing context information:<br>
&gt; The download protocol relies on the other peer sending one (or more) &quot;inv&quot;<br>
&gt; reponse(s) to &quot;getblocks&quot; and sending the &quot;hashContinue&quot;.<br>
&gt; But if the other peer doesn&#39;t send a response to getblock, send a partial<br>
&gt; response to getblocks, mixes it with some unrelated blocks inventories<br>
&gt; or doesn&#39;t send the &quot;hashContinue&quot; it is very hard to detect and handle<br>
&gt; (e.g. ban the peer and switch to another).  This could cause some DoS<br>
&gt; attacks by misbehaving peers.<br>
<br>
If the peer is misbehaving, then disconnect.  Your protocol change<br>
does not offer any clear benefits in this area, as these sorts of<br>
attacks/misbehaviors/bugs are still just as possible, and just as<br>
damaging (or not).<br>
<br>
Just disconnect the strange peer!<br>
<br>
&gt; The problems are that 1/ we don&#39;t know how many &quot;inv&quot; messages to wait for<br>
&gt; after &quot;getblocks&quot; and 2/ we don&#39;t know how to distinguish between result of<br>
&gt; &quot;getblocks&quot; and spontaneous &quot;inv&quot; notifications.<br>
&gt; The same is true for  &quot;addr&quot; messages (it is both a notification and reply)<br>
&gt; but this is less of a problem as a lack of response to getaddr<br>
&gt; doesn&#39;t constitute a DoS.<br>
&gt;<br>
&gt; The idea would be to add a new &quot;requestid&quot; field in messages and define the<br>
&gt; following:<br>
<br>
<br>
Stateless protocols have a lot of value.  They are easiest to<br>
implement, and easier to prove correct.  Existing clients like<br>
ArtForz&#39; half-a-node, variants of which are deployed all over the<br>
place in bitcoin-land, rely on the stateless-ness to one degree or<br>
another.<br>
<br>
Stateful protocols, too, have their problems as well.  One must add<br>
code to help remain &quot;synchronized&quot; between local and remote states,<br>
which your suggested change only hints at.  NFSv4 and RPC have a long<br>
history of dealing with stateful-ness issues.  Obviously bitcoin P2P<br>
is nowhere near as complex, but the history of NFS development offers<br>
several lessons applicable to your proposed change.<br>
<br>
Overall, IMO your listed reasons for needing this major change<br>
(stateless-&gt;stateful) do not really justify the change.  Handling<br>
initial block download can be accomplished in a number of ways, and<br>
peer(s) may crash or return odd results.  You must handle these cases<br>
properly, regardless of the presence of req/reply id&#39;s.<br>
<br>
--<br>
Jeff Garzik<br>
exMULTI, Inc.<br>
<a href="mailto:jgarzik@exmulti.com">jgarzik@exmulti.com</a><br>
<br>
------------------------------------------------------------------------------<br>
For Developers, A Lot Can Happen In A Second.<br>
Boundary is the first to Know...and Tell You.<br>
Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!<br>
<a href="http://p.sf.net/sfu/Boundary-d2dvs2" target="_blank">http://p.sf.net/sfu/Boundary-d2dvs2</a><br>
_______________________________________________<br>
Bitcoin-development mailing list<br>
<a href="mailto:Bitcoin-development@lists.sourceforge.net">Bitcoin-development@lists.sourceforge.net</a><br>
<a href="https://lists.sourceforge.net/lists/listinfo/bitcoin-development" target="_blank">https://lists.sourceforge.net/lists/listinfo/bitcoin-development</a><br>
<br>
------------------------------------------------------------------------------<br>
For Developers, A Lot Can Happen In A Second.<br>
Boundary is the first to Know...and Tell You.<br>
Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!<br>
<a href="http://p.sf.net/sfu/Boundary-d2dvs2" target="_blank">http://p.sf.net/sfu/Boundary-d2dvs2</a><br>
_______________________________________________<br>
Bitcoin-development mailing list<br>
<a href="mailto:Bitcoin-development@lists.sourceforge.net">Bitcoin-development@lists.sourceforge.net</a><br>
<a href="https://lists.sourceforge.net/lists/listinfo/bitcoin-development" target="_blank">https://lists.sourceforge.net/lists/listinfo/bitcoin-development</a><br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><br><div>Peter J. Vessenes</div><div>CEO, CoinLab</div><div>M: 206.595.9839</div><br>
</div>