<p>A single transaction in Cardano can contain many inputs and outputs. As long as the transaction is signed by all the private keys associated with each address, it will be valid. In other words, the number of inputs doesn't effect the number of signatures needed, only the number of unique addresses does, where each unique address requires a signature.</p>
<p>For example, if I have constructed an transaction with an arbitrary number of inputs, but those inputs all come from N-number of unique addresses, the command would be:</p>
<pre><code>cardano-cli transaction sign \
--tx-body-file &lt;RAW_TX_FILE&gt; \
--signing-key-file &lt;SKEY_1_FILE&gt; \
--signing-key-file &lt;SKEY_2_FILE&gt; \
--signing-key-file &lt;SKEY_N_FILE&gt; \
--mainnet \
--out-file &lt;SIGNED_TX_FILE&gt;
</code></pre>

CC BY-SA 4.0
2022-01-04T07:12:38.070Z
Does it automatically find which file belongs to which address or I should specify that?
Foad
CC BY-SA 4.0
2022-01-04T14:01:15.660Z
it will automatically find them, There is no need, nor an option, to specify.
zhekson
CC BY-SA 4.0
2022-01-04T16:16:21.723Z
Got it, Thanks!
Foad
CC BY-SA 4.0
2022-01-04T00:44:09.203Z
2022-01-04T00:44:09.203Z
zhekson
<p>Here's an example of a signing command - just add/remove <strong>--signing-key-file</strong> parameters as necessary!</p>
<p>cardano-cli transaction sign --signing-key-file payment.skey --signing-key-file policy.skey --mainnet --tx-body-file matx.raw --out-file matx.signed</p>

CC BY-SA 4.0
2022-01-03T19:41:25.900Z
2022-01-03T19:41:25.900Z
Tygar Pool
<p>I built a transaction with <code>cardano-cli shelley transaction build-raw</code> command that has multiple inputs. I have the private keys and <em>.skey</em> files of these addresses but I don't know how to sign the transaction with the cardano-cli. How can I do this?</p>

<cardano-cli><transaction>
Sign transaction with multiple inputs
# Sign transaction with multiple inputs

(Asked by: username_0 on 2022-01-03)

I built a transaction with `cardano-cli shelley transaction build-raw` command that has multiple inputs. I have the private keys and *.skey* files of these addresses but I don't know how to sign the transaction with the cardano-cli. How can I do this?

**Tags:** cardano-cli, transaction

---

## 2 answers

### Answer by username_1 on 2022-01-04. Score: 1 | Accepted answer

A single transaction in Cardano can contain many inputs and outputs. As long as the transaction is signed by all the private keys associated with each address, it will be valid. In other words, the number of inputs doesn't effect the number of signatures needed, only the number of unique addresses does, where each unique address requires a signature.
For example, if I have constructed an transaction with an arbitrary number of inputs, but those inputs all come from N-number of unique addresses, the command would be:
cardano-cli transaction sign \
--tx-body-file  \
--signing-key-file  \
--signing-key-file  \
--signing-key-file  \
--mainnet \
--out-file

> **Comments:**
> **username_0**: Does it automatically find which file belongs to which address or I should specify that?  
> **username_1**: it will automatically find them, There is no need, nor an option, to specify.  
> **username_0**: Got it, Thanks!  

---

### Answer by username_2 on 2022-01-03. Score: 0

Here's an example of a signing command - just add/remove **--signing-key-file** parameters as necessary!

cardano-cli transaction sign --signing-key-file payment.skey --signing-key-file policy.skey --mainnet --tx-body-file matx.raw --out-file matx.signed


---

