<div dir="ltr">Hey Peter, thanks for your experienced feedback.<br><div><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Jun 6, 2015 at 10:35 PM, Peter Todd <span dir="ltr">&lt;<a href="mailto:pete@petertodd.org" target="_blank">pete@petertodd.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Why mention SIGHASH_SINGLE at all? Its use-case is highly specialized<br>
protocols; you haven&#39;t taken into account the needs of those protocols.<br>
For BIP&#39;s it&#39;s better to stick to the use-cases where the need is clear<br>
and there exists running code that to speculate too much on future uses.<br>
With signature hashing in particular it&#39;s not yet clear at all what<br>
future OP_CHECKSIG&#39;s will look like, let alone the various ways people<br>
will use sighash for smart contract type stuff.<br>
<br>
You&#39;d be better off presenting the BIP in terms of a generic statement<br>
that &quot;except when otherwise prevented by advanced signature hashing<br>
requirements, wallet software must emit transactions sorted according to<br>
the following&quot; You can then specify the two common cases in detail:<br>
<br>
1) SIGHASH_ALL: input and output order signed, so sort appropriately<br>
<br>
2) SIGHASH_ANYONECANPAY: input order not signed, so software should emit<br>
   transactions sorted, recognising that the actual mined order may be<br>
   changed.<br></blockquote><div><br></div><div>That makes sense. I updated the language as follows -- your thoughts? Keep in mind this BIP is informational, and so people are free to ignore it.<br><br>&quot;<span style="font-size:14.6667px;font-family:Arial;color:rgb(0,0,0);background-color:transparent;font-weight:normal;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline" id="docs-internal-guid-b79d8ec4-d55b-e25c-cd64-cbdd8f842cf6">Applicability: This BIP applies to all transactions of signature hash type SIGHASH_ALL. Additionally,  software compliant with this BIP that allows later parties to update the transaction (e.g. using signature hash types SIGHASH_NONE or a variant of SIGHASH_ANYONECANPAY) should emit lexicographically sorted inputs and outputs, although they may later be modified. Transactions that have index dependencies between transactions or within the same transaction are covered under the section of this BIP entitled “Handling Input/Output Dependencies.”&quot;</span></div><div> <br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
As for IsStandard() rules - let alone soft forks - better to leave<br>
discussion of them out for now. In particular, for the soft-fork case<br>
mandating certain transaction orders will very likely cause problems in<br>
the future for future OP_CHECKSIG upgrades. For SIGHASH_ANYONECANPAY, it<br>
might be appropriate for nodes to enforce a certain ordering, but that<br>
can be a separate BIP. (actually implementing that in Bitcoin Core would<br>
be annoying and ugly right now; without replace-by-fee ANYONECANPAY has<br>
a silly DoS attack (adding low-fee inputs) so I can&#39;t recommend wallets<br>
use it in the general case yet)<br>
<br>
&quot;and a sequence number currently set to 0xFFFFFFFF.&quot; &lt;- Actually, this<br>
will be changed in Bitcoin Core as of v0.11.0, which implements<br>
anti-fee-sniping w/ nLockTime.(1) (I need to write up a full BIP<br>
describing it)<br></blockquote><div><br></div><div>Thanks for the heads-up; removed.<br> <br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Do you have a patch implementing deterministic tx ordering for Bitcoin<br>
Core yet?<br></blockquote><div><br></div><div>I&#39;m not a frequent C programmer, so I&#39;d prefer to let someone else take care of it, as a frequent committer of code would do a faster and more stylistically consistent job of it. If no one else will, however, I will. <br><br></div><div>-Kristov</div></div><br></div></div></div>