<p>You can just define multiple by reusing the same flag multiple times like so:</p>
<pre><code>cardano-cli transaction build \
  --tx-in 123#0
  --tx-in-script-file SCRIPT_FILE1
  --tx-in-datum-file JSON_DATUM_FILE1
  --tx-in 456#0
  --tx-in-script-file SCRIPT_FILE2
  --tx-in-datum-file JSON_DATUM_FILE2
  {...}
</code></pre>
<p>You can see from the cardano-cli documentation notation that you can declare multiple tx-ins, datums and redeemers:</p>
<pre><code>(--tx-in TX-IN
   [--tx-in-script-file FILE
      [
        ( --tx-in-datum-cbor-file CBOR FILE
           | --tx-in-datum-file JSON FILE
           | --tx-in-datum-value JSON VALUE
        )
        ( --tx-in-redeemer-cbor-file CBOR FILE
           | --tx-in-redeemer-file JSON FILE
           | --tx-in-redeemer-value JSON VALUE
        )
      ]
   ]
)
</code></pre>
<p>Inside your validator (onchain) code you can use <code>findDatum</code> to retrieve the respective datum by its hash or pattern matching.</p>

CC BY-SA 4.0
2022-05-16T08:30:29.960Z
2022-05-16T08:30:29.960Z
Will
<p>I am currently testing a plutus script on cardano-cli, I need to use 2 inputs from a SC address that have different datum, how can I specify both <code> --tx-in-datum-file</code> for the transaction?</p>
<p>Thanks</p>

<plutus>
How to specify differerent inputs coming from a smart contract on Cardano Cli
# How to specify differerent inputs coming from a smart contract on Cardano Cli

(Asked by: username_0 on 2022-05-15)

I am currently testing a plutus script on cardano-cli, I need to use 2 inputs from a SC address that have different datum, how can I specify both  `--tx-in-datum-file` for the transaction?

Thanks

**Tags:** plutus

---

## 1 answers

### Answer by username_1 on 2022-05-16. Score: 1 | Accepted answer

You can just define multiple by reusing the same flag multiple times like so:
cardano-cli transaction build \
  --tx-in 123#0
  --tx-in-script-file SCRIPT_FILE1
  --tx-in-datum-file JSON_DATUM_FILE1
  --tx-in 456#0
  --tx-in-script-file SCRIPT_FILE2
  --tx-in-datum-file JSON_DATUM_FILE2
  {...}

You can see from the cardano-cli documentation notation that you can declare multiple tx-ins, datums and redeemers:
(--tx-in TX-IN
   [--tx-in-script-file FILE
      [
        ( --tx-in-datum-cbor-file CBOR FILE
           | --tx-in-datum-file JSON FILE
           | --tx-in-datum-value JSON VALUE
        )
        ( --tx-in-redeemer-cbor-file CBOR FILE
           | --tx-in-redeemer-file JSON FILE
           | --tx-in-redeemer-value JSON VALUE
        )
      ]
   ]
)

Inside your validator (onchain) code you can use findDatum to retrieve the respective datum by its hash or pattern matching.


---

