[RFC] Canonical input and output ordering in transactions



Summary:

The Canonical Input and Output Ordering proposal, authored by Rusty Russell, provides a canonical ordering of inputs and outputs while creating transactions. Most Bitcoin wallet implementations randomize the outputs of transactions they create to avoid trivial linkage analysis, but mistakes have been made in the past. The use of a canonical ordering can have the same effect as randomized outputs but is simpler, more obvious, and can eventually be enforced by IsStandard() and even a soft-fork to enforce it. The specification states that inputs should be ordered by index (lower value first) and txid (little endian order, lower byte first). Outputs should be ordered by amount (lower value first) and script (starting from first byte, lower byte first, shorter wins). The rationale for this is that any single wallet can already implement this, but if other wallets do not, it could 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.The reference implementation for this proposal can be found on Github.


Updated on: 2023-06-09T22:17:36.473582+00:00