Transaction Output Order

Suppose I generate a transaction with 5 outputs.

Is there a deterministic way to know how the outputs will be ordered on chain (their .n values) or will they simply appear in the order in which I arranged them when created my rawTxn that I signed?

Answers 1

  • If you create a raw transaction yourself, then that is the raw transaction. Whatever you put in it is exactly what the transaction will be, in the same order.

    There are some conventions around output ordering. Some software will randomly permute the outputs; other software uses BIP69 which specifies a deterministic ordering. There is however no requirement to follow either rule.

Related Questions