[Bitcoin-development] Lexicographical Indexing of Transaction Inputs and Outputs
kristovatlas.lists at gmail.com
Sun Jun 7 00:06:56 UTC 2015
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
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
“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:
* SIGHASH_SINGLE hash type.  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.
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.
On Sat, Jun 6, 2015 at 2:24 AM, Kristov Atlas <kristovatlas.lists at gmail.com>
> Hey Stephen,
> Thanks for your feedback
> On Fri, Jun 5, 2015 at 11:20 PM, Stephen <stephencalebmorse at gmail.com>
>> - 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.
> 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.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the bitcoin-dev