<p>I was digging in this topic because I struggled with some transactions. I was reading the CDLL, the serialization lib, docs, etc.. but I couldn't find anything about the meaning of this index.</p>
<p>After some research in the cardano node source code, I found that the index is referred to the TxIn but those must be ordered alphabetical.</p>
<p>Here is some code from the cardano-node:</p>
<pre><code>    scriptWitnessesTxIns
      :: [(TxIn, BuildTxWith BuildTx (Witness WitCtxTxIn era))]
      -&gt; [(ScriptWitnessIndex, AnyScriptWitness era)]
    scriptWitnessesTxIns txins =
        [ (ScriptWitnessIndexTxIn ix, AnyScriptWitness witness)
          -- The tx ins are indexed in the map order by txid
        | (ix, (_, BuildTxWith (ScriptWitness _ witness)))
            &lt;- zip [0..] (orderTxIns txins)
        ]
</code></pre>
<p>My problem was that I was using this index according to the add order with the add_plutus_script_input and add_input method.</p>
<p>I hope it helps.</p>

CC BY-SA 4.0
2022-06-05T23:11:15.390Z
What tool are you using to make the transactions?
Alicia Basilio
CC BY-SA 4.0
2022-06-06T22:20:01.297Z
I'm using the Cardano serialization lib and a own version of the cardano-js-sdk from IOHK
Juantxu
CC BY-SA 4.0
2022-06-05T09:12:20.580Z
2022-06-05T09:12:20.580Z
Juantxu
<p>What is the meaning of the index in the redeemer ?</p>
<pre><code>redeemer = [ tag: redeemer_tag, index: uint, data: plutus_data, ex_units: ex_units 
</code></pre>
<p>for context see:</p>
<p><a href="https://github.com/input-output-hk/cardano-ledger/blob/master/eras/alonzo/test-suite/cddl-files/alonzo.cddl" rel="nofollow noreferrer">https://github.com/input-output-hk/cardano-ledger/blob/master/eras/alonzo/test-suite/cddl-files/alonzo.cddl</a></p>
<p>I think in Serialization version 9 it used to be the index of the inputs. There was even a method for getting the index of the input in the class Transaction Builder. But now in 10.4 this method is not longer available and in fact for the experiments i have done so far the index of the redeemer needed for the transaction to be validated by the node seems not to be the same as the index of the input in the transaction, so I have not a method for computing the index that i should attach to the redeemer.</p>

CC BY-SA 4.0
2022-08-24T08:38:02.587Z
did you figure this out .?
Dawar Ejaz
CC BY-SA 4.0
2022-08-25T11:33:09.260Z
Yes, order them by alphanumeric... Y Not by the order they are added
Alicia Basilio
<cardano-serialization-lib><redeemer>
Meaning of Index of Redeemer in Serialization Lib 10.4
# Meaning of Index of Redeemer in Serialization Lib 10.4

(Asked by: username_0 on 2022-04-19)

What is the meaning of the index in the redeemer ?
redeemer = [ tag: redeemer_tag, index: uint, data: plutus_data, ex_units: ex_units 

for context see:
https://github.com/input-output-hk/cardano-ledger/blob/master/eras/alonzo/test-suite/cddl-files/alonzo.cddl
I think in Serialization version 9 it used to be the index of the inputs. There was even a method for getting the index of the input in the class Transaction Builder. But now in 10.4 this method is not longer available and in fact for the experiments i have done so far the index of the redeemer needed for the transaction to be validated by the node seems not to be the same as the index of the input in the transaction, so I have not a method for computing the index that i should attach to the redeemer.

**Tags:** cardano-serialization-lib, redeemer
> **Comments:**
> **username_1**: did you figure this out .?  
> **username_0**: Yes, order them by alphanumeric... Y Not by the order they are added  

---

## 1 answers

### Answer by username_2 on 2022-06-05. Score: 2

I was digging in this topic because I struggled with some transactions. I was reading the CDLL, the serialization lib, docs, etc.. but I couldn't find anything about the meaning of this index.
After some research in the cardano node source code, I found that the index is referred to the TxIn but those must be ordered alphabetical.
Here is some code from the cardano-node:
    scriptWitnessesTxIns
      :: [(TxIn, BuildTxWith BuildTx (Witness WitCtxTxIn era))]
      -> [(ScriptWitnessIndex, AnyScriptWitness era)]
    scriptWitnessesTxIns txins =
        [ (ScriptWitnessIndexTxIn ix, AnyScriptWitness witness)
          -- The tx ins are indexed in the map order by txid
        | (ix, (_, BuildTxWith (ScriptWitness _ witness)))
            <- zip [0..] (orderTxIns txins)
        ]

My problem was that I was using this index according to the add order with the add_plutus_script_input and add_input method.
I hope it helps.

> **Comments:**
> **username_0**: What tool are you using to make the transactions?  
> **username_2**: I'm using the Cardano serialization lib and a own version of the cardano-js-sdk from IOHK  

---

