<p>Looks like all <code>--tx-in</code> is not in the order like it is provided in <code>cardano-cli</code> command and rather is order ascending by transaction id.</p>

CC BY-SA 4.0
2022-04-21T15:48:16.007Z
Not very intuitive behavior. Where did you find that answer?
eddex
CC BY-SA 4.0
2022-04-24T09:19:33.310Z
I just guess it, and then I did sort utxos and that proved my assumption.
zarej
CC BY-SA 4.0
2022-04-25T14:41:33.717Z
I created a PR in the `cardano-node` repo to make the errors more explicit: https://github.com/input-output-hk/cardano-node/pull/3811
eddex
CC BY-SA 4.0
2022-04-21T15:45:37.063Z
2022-04-21T15:45:37.063Z
zarej
<p>If I have the following transaction:</p>
<pre><code>cardano-cli transaction build                 \
--tx-in dd3dbc1cbd4627da3b74fae8c7bcc3f05f3b41ec36feb33f81cf885390b634d6#0      \
--tx-in 40917b278a9bf960fcc0a3de9eb5945113c025323d7d73c19dd6d26cfe92e04b#0      \
--tx-in e98a07b5ff0b048950ce4ffdfbfb53def61e2b52e9bf39cdd82b3eb91c40e2a6#0 \
--tx-in-script-file plutus/order-v11-buy-token.plutus   \
--tx-in-datum-file 'tmp/batch_datum_file_0.json'   \
--tx-in-redeemer-file 'plutus/match-order-redeemer.json'  \
--tx-in 2c759a6606692c021c266025cbd569a1b451e184fb44e001d18152528a3a2161#0 \
--tx-in-script-file plutus/order-v11-buy-token.plutus   \
--tx-in-datum-file 'tmp/batch_datum_file_1.json'   \
--tx-in-redeemer-file 'plutus/match-order-redeemer.json'  \
--tx-in cfbf555aebbf879e2313c32f4d8b839d63d7f7b12fd1027cb3ccd7e9f790e014#0 \
--tx-in-script-file plutus/order-v11-buy-ada.plutus   \
--tx-in-datum-file 'tmp/batch_datum_file_2.json'   \
--tx-in-redeemer-file 'plutus/match-order-redeemer.json'  
</code></pre>
<p>I am getting the following error:</p>
<pre><code>Command failed: transaction build  Error: The following scripts have execution failures:
the script for transaction input 0 (in the order of the TxIds) failed with: 
The Plutus script evaluation failed: An error has occurred:  User error:
The provided Plutus code called 'error'.
Script debugging logs: 
the script for transaction input 4 (in the order of the TxIds) failed with: 
The Plutus script evaluation failed: An error has occurred:  User error:
The provided Plutus code called 'error'.
</code></pre>
<p>How to realize which scripts reported the error, it is saying <code>the script for transaction input 0</code> and <code>the script for transaction input 4</code> but with the above command, I cannot find on tx-in position 0 any script. How to determine the order of transaction input (in the order of the TxIds)?</p>

<cardano-cli><script>
How to determine the order of transaction input (in the order of the TxIds)?
# How to determine the order of transaction input (in the order of the TxIds)?

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

If I have the following transaction:
cardano-cli transaction build                 \
--tx-in dd3dbc1cbd4627da3b74fae8c7bcc3f05f3b41ec36feb33f81cf885390b634d6#0      \
--tx-in 40917b278a9bf960fcc0a3de9eb5945113c025323d7d73c19dd6d26cfe92e04b#0      \
--tx-in e98a07b5ff0b048950ce4ffdfbfb53def61e2b52e9bf39cdd82b3eb91c40e2a6#0 \
--tx-in-script-file plutus/order-v11-buy-token.plutus   \
--tx-in-datum-file 'tmp/batch_datum_file_0.json'   \
--tx-in-redeemer-file 'plutus/match-order-redeemer.json'  \
--tx-in 2c759a6606692c021c266025cbd569a1b451e184fb44e001d18152528a3a2161#0 \
--tx-in-script-file plutus/order-v11-buy-token.plutus   \
--tx-in-datum-file 'tmp/batch_datum_file_1.json'   \
--tx-in-redeemer-file 'plutus/match-order-redeemer.json'  \
--tx-in cfbf555aebbf879e2313c32f4d8b839d63d7f7b12fd1027cb3ccd7e9f790e014#0 \
--tx-in-script-file plutus/order-v11-buy-ada.plutus   \
--tx-in-datum-file 'tmp/batch_datum_file_2.json'   \
--tx-in-redeemer-file 'plutus/match-order-redeemer.json'  

I am getting the following error:
Command failed: transaction build  Error: The following scripts have execution failures:
the script for transaction input 0 (in the order of the TxIds) failed with: 
The Plutus script evaluation failed: An error has occurred:  User error:
The provided Plutus code called 'error'.
Script debugging logs: 
the script for transaction input 4 (in the order of the TxIds) failed with: 
The Plutus script evaluation failed: An error has occurred:  User error:
The provided Plutus code called 'error'.

How to realize which scripts reported the error, it is saying the script for transaction input 0 and the script for transaction input 4 but with the above command, I cannot find on tx-in position 0 any script. How to determine the order of transaction input (in the order of the TxIds)?

**Tags:** cardano-cli, script

---

## 1 answers

### Answer by username_0 on 2022-04-21. Score: 1

Looks like all `--tx-in` is not in the order like it is provided in `cardano-cli` command and rather is order ascending by transaction id.

> **Comments:**
> **username_1**: Not very intuitive behavior. Where did you find that answer?  
> **username_0**: I just guess it, and then I did sort utxos and that proved my assumption.  
> **username_1**: I created a PR in the `cardano-node` repo to make the errors more explicit: https://github.com/input-output-hk/cardano-node/pull/3811  

---

