API, reference inputs and redeemer tx_index

AIUI, when using the API, the tx_index field in a redeemer contains the index of the enclosing transaction’s input that it consumes (is that true ?).

However, with reference inputs, it seems that in this API the reference inputs and “regular” inputs are all merged in the transaction’s utxos.inputs list.

In that case, it looks the tx_index field in the redeemer no longer matches the index of the referenced input in the inputs list, but rather the position of the Nth non-reference input in the list.


  • without reference inputs:
utxos.inputs = [i1,i2,i3]`

In that case, the redeemer points at i3

  • with reference inputs (marked as ri):
utxos.inputs = [ri1, ri2, i1,i2,i3]`

In that case, the redeemer also points at i3 because the reference inputs are ignored in the indexing.

Can someone confirm that this understanding is correct, or provide the correct way of interpreting the redeemer’s tx_index field ?