FWIW, The Open Assets colored coin protocol (CoinPrism) places special significance on the zeroth input and the position of the OP_RETURN colored coin marker output to distinguish colored coin issuance outputs from transfer outputs. Reordering the inputs or the outputs breaks the colored coin representation.

Recommending sorting of the inputs and outputs as a best practice is fine (and better than random, IMO), but not as part of IsStandard() or consensus rules.  There are cases where the order of the inputs and outputs is significant.

-Danny

On Fri, Jun 5, 2015 at 9:42 PM, Rusty Russell <rusty@rustcorp.com.au> wrote:
Title: Canonical Input and Output Ordering
Author: Rusty Russell <rusty@rustcorp.com.au>
Discussions-To: "Bitcoin Dev" <bitcoin-development@lists.sourceforge.net>
Status: Draft
Type: Standards Track
Created: 2015-06-06

Abstract

This BIP provides a canonical ordering of inputs and outputs when
creating transactions.

Motivation

Most bitcoin wallet implementations randomize the outputs of
transactions they create to avoid trivial linkage analysis (especially
change outputs), however implementations have made mistakes in this area
in the past.

Using a canonical ordering has the same effect, but is simpler, more
obvious if incorrect, and can eventually be enforced by IsStandard() and
even a soft-fork to enforce it.

Specification

Inputs should be ordered like so:
        index (lower value first)
        txid (little endian order, lower byte first)

Outputs should be ordered like so:
        amount (lower value first)
        script (starting from first byte, lower byte first, shorter wins)

Rationale

Any single wallet is already free to implement this, but if other
wallets do not it would reduce privacy by making those transactions
stand out.  Thus a BIP is appropriate, especially if this were to
become an IsStandard() rule once widely adopted.

Because integers are fast to compare, they're sorted first, before the
lexographical ordering.

The other input fields do not influence the sort order, as any valid
transactions cannot have two inputs with the same index and txid.

Reference Implementation

https://github.com/rustyrussell/bitcoin/tree/bip-in-out-ordering

------------------------------------------------------------------------------
_______________________________________________
Bitcoin-development mailing list
Bitcoin-development@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bitcoin-development