1

AIUI, when using the blockfrost.io 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.

Example:

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

In that case, the redeemer points at i3

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

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 ?

1 Answer 1

1

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

The index holds different meaning for different purposes. For instance, if minting policies are involved in a transaction, index for a particular minting policy would be it's position in lexicographic ordering of the involved minting policies. For more information, see indexOf function in Alonzo ledger documentation. So, if you are only looking for indexes where purpose in response is set to spend then your understanding of tx_index is correct.

Now any output which is inside transaction_input then it is indeed getting consumed by the transaction (if it is of course successful), reference input(s) cannot be inside this transaction_input list. Provider's might mention it in input(s) but then they would also mention whether it's a reference input (in which case you can ignore it) or not. So, yes, your understanding on ignoring reference input(s) to determine for index is correct.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.