Received: from sog-mx-3.v43.ch3.sourceforge.com ([172.29.43.193] helo=mx.sourceforge.net) by sfs-ml-2.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1Z1O7E-0008Fn-N0 for bitcoin-development@lists.sourceforge.net; Sun, 07 Jun 2015 00:07:04 +0000 Received-SPF: pass (sog-mx-3.v43.ch3.sourceforge.com: domain of gmail.com designates 209.85.215.65 as permitted sender) client-ip=209.85.215.65; envelope-from=kristovatlas.lists@gmail.com; helo=mail-la0-f65.google.com; Received: from mail-la0-f65.google.com ([209.85.215.65]) by sog-mx-3.v43.ch3.sourceforge.com with esmtps (TLSv1:RC4-SHA:128) (Exim 4.76) id 1Z1O7D-0004as-CI for bitcoin-development@lists.sourceforge.net; Sun, 07 Jun 2015 00:07:04 +0000 Received: by lams18 with SMTP id s18so2273800lam.2 for ; Sat, 06 Jun 2015 17:06:57 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.152.225.166 with SMTP id rl6mr9762273lac.36.1433635616964; Sat, 06 Jun 2015 17:06:56 -0700 (PDT) Received: by 10.152.163.98 with HTTP; Sat, 6 Jun 2015 17:06:56 -0700 (PDT) In-Reply-To: References: <44BE16F9-AB24-4A8E-BC7F-03A6C590FCE7@gmail.com> Date: Sat, 6 Jun 2015 20:06:56 -0400 Message-ID: From: Kristov Atlas To: Stephen Content-Type: multipart/alternative; boundary=001a1134986cafc4270517e24da1 X-Spam-Score: -0.6 (/) X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. -1.5 SPF_CHECK_PASS SPF reports sender host as permitted sender for sender-domain 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (kristovatlas.lists[at]gmail.com) -0.0 SPF_PASS SPF: sender matches SPF record 1.0 HTML_MESSAGE BODY: HTML included in message -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-Headers-End: 1Z1O7D-0004as-CI Cc: Bitcoin development mailing list Subject: Re: [Bitcoin-development] Lexicographical Indexing of Transaction Inputs and Outputs X-BeenThere: bitcoin-development@lists.sourceforge.net X-Mailman-Version: 2.1.9 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Jun 2015 00:07:04 -0000 --001a1134986cafc4270517e24da1 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable I've updated the draft BIP in two ways: -Making it clear that sorting is algorithmically agnostic, but should conform to the output of the example algorithms written in python -The BIP now handles schemes that create an input/output dependency, such as SIGHASH_SINGLE: Handling Input/Output Dependencies 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 =E2=80=9CTransaction Inputs=E2=80=9D 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: * 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 =E2=80=9Cn=E2=80=9D, the verifier should expect that output =E2= =80=9Cn=E2=80=9D will be fixed when considering output ordering. https://github.com/kristovatlas/rfc/blob/master/bips/bip-li01.mediawiki I'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. -Kristov On Sat, Jun 6, 2015 at 2:24 AM, Kristov Atlas wrote: > Hey Stephen, > > Thanks for your feedback > > On Fri, Jun 5, 2015 at 11:20 PM, Stephen > wrote: > >> - I think your explanation of sorting could be significantly shortened >> and clarified by simply saying that the TXIDs of inputs should be compar= ed >> as uint256 integers. >> > > I considered defining the comparison of txids in terms of integers; > however, I am concerned that this definition may be ambiguous when applie= d > 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 walle= ts > can implement the algorithm however they wish, but should ensure that the= ir > 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. > --001a1134986cafc4270517e24da1 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
I've updated the draft BIP in two ways:=
-Making it clear that sorting is algorithmically agnostic, but sh= ould conform to the output of the example algorithms written in python
<= /div>-The BIP now handles schemes that create an input/output dependency, s= uch as SIGHASH_SINGLE:

Handling Input/Output Dependencies

Som= e uncommon forms of transactions create an ordering dependency between inpu= ts and outputs of a transaction. Wallets forming these transactions should = first sort inputs according to the methodology outlined in section =E2=80= =9CTransaction Inputs=E2=80=9D of this BIP. Then, they should fix the outpu= t indices that depend on the input order, and sort the remaining outputs ar= ound 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 follow= ing are the known cases of input/output dependency that must be handled spe= cially:

* SIGHASH_SINGLE hash type. [5] Clients seeking to verify LI= 01 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 =E2=80=9Cn=E2=80=9D, the verifier should expect th= at output =E2=80=9Cn=E2=80=9D will be fixed when considering output orderin= g.

https://github.com/kristovatlas/rfc/blob/master/bips/bip= -li01.mediawiki

I'm satisfied with this adjustmen= t, 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.

-Kristov

On Sat, Jun 6, 2015 at 2:24 AM, Kristov Atlas <kris= tovatlas.lists@gmail.com> wrote:
Hey Stephen,

Thanks for your feedb= ack

On Fri, Jun 5, 2015 at 11:20 PM, Stephen <stephencalebmorse= @gmail.com> wrote:
=C2=A0- I think your explanation of sorting could be signifi= cantly shortened and clarified by simply saying that the TXIDs of inputs sh= ould be compared as uint256 integers.=C2=A0
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 amou= nt 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 wallet= s can implement the algorithm however they wish, but should ensure that the= ir output is compliant with the BIP definition. IMHO the algorithm stated i= n the BIP should target test cases rather than implementation, and should l= eave as little room for ambiguity as possible.

--001a1134986cafc4270517e24da1--