<div dir="ltr"><div><div><div>I&#39;ve updated the draft BIP in two ways:<br></div>-Making it clear that sorting is algorithmically agnostic, but should conform to the output of the example algorithms written in python<br></div>-The BIP now handles schemes that create an input/output dependency, such as SIGHASH_SINGLE:<br><br>Handling Input/Output Dependencies<br><br>Some uncommon forms of transactions create an ordering dependency between inputs and outputs of a transaction. Wallets forming these transactions should first sort inputs according to the methodology outlined in section “Transaction Inputs” of this BIP. Then, they should fix the output indices that depend on the input order, and sort the remaining outputs around them. If there are no outputs that do not depend on input order, then all outputs will simply be ordered based on the expected scheme. The following are the known cases of input/output dependency that must be handled specially:<br><br>* SIGHASH_SINGLE hash type. [5] Clients seeking to verify LI01 compliance for a transaction must inspect the last byte of the scriptSig of each input to determine the signature hash type. In the case of SIGHASH_SINGLE (0x03) for input “n”, the verifier should expect that output “n” will be fixed when considering output ordering.<br><br><a href="https://github.com/kristovatlas/rfc/blob/master/bips/bip-li01.mediawiki">https://github.com/kristovatlas/rfc/blob/master/bips/bip-li01.mediawiki</a><br><br></div><div>I&#39;m satisfied with this adjustment, as it is unlikely that any software that wants to verify compliance with the BIP will not have access to the scriptSig of each input.<br></div><div><br></div>-Kristov<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Jun 6, 2015 at 2:24 AM, Kristov Atlas <span dir="ltr">&lt;<a href="mailto:kristovatlas.lists@gmail.com" target="_blank">kristovatlas.lists@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Hey Stephen,<br><br></div>Thanks for your feedback<div class="gmail_extra"><br><div class="gmail_quote"><span class="">On Fri, Jun 5, 2015 at 11:20 PM, Stephen <span dir="ltr">&lt;<a href="mailto:stephencalebmorse@gmail.com" target="_blank">stephencalebmorse@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto"><div> - I think your explanation of sorting could be significantly shortened and clarified by simply saying that the TXIDs of inputs should be compared as uint256 integers. </div></div></blockquote><div><br></div></span><div>I considered defining the comparison of txids in terms of integers; however, I am concerned that this definition may be ambiguous when applied to a variety of languages and platforms without a similar amount of explanation as currently exists. For example, if a web wallet uses an API to receive transaction information, this is traditionally expressed in terms tx id strings rather than 256-bit integers. My intent is that wallets can implement the algorithm however they wish, but should ensure that their output is compliant with the BIP definition. IMHO the algorithm stated in the BIP should target test cases rather than implementation, and should leave as little room for ambiguity as possible. <br></div></div></div></div>
</blockquote></div><br></div>