<p>It does work with the emulator. Here's a test that demonstrates this being validated on-chain.</p>
<p><a href="https://github.com/input-output-hk/plutus-apps/blob/9bb44b617212fa195701f0c4a59d6f0e60b7764d/plutus-contract/test/Spec/Contract/Tx/Constraints/MustReferenceOutput.hs#L195-L196" rel="nofollow noreferrer">https://github.com/input-output-hk/plutus-apps/blob/9bb44b617212fa195701f0c4a59d6f0e60b7764d/plutus-contract/test/Spec/Contract/Tx/Constraints/MustReferenceOutput.hs#L195-L196</a></p>

CC BY-SA 4.0
2022-12-07T11:13:38.020Z
2022-12-07T11:13:38.020Z
james
<p>I have written a script that will fail unless it receives both <code>oref1</code> and <code>oref2</code> as reference inputs. I have the following emulator code:</p>
<pre><code>let rule = mempty
                     &lt;&gt; C.mustReferenceOutput oref1
                     &lt;&gt; C.mustReferenceOutput oref2
                     &lt;&gt; C.mustMintValue val 
                     &lt;&gt; (C.mustBeSignedBy ppkh)
tx &lt;- mkTxConstraints @Void (plutusV2MintingPolicy policy) rule
submitTxConfirmed tx
</code></pre>
<p>The script fails saying that <code>oref1</code> is not a reference input. But if I comment out <code>C.mustReferenceOutput oref2</code> then the script fails saying it has not received <code>oref2</code> as a reference input. It seems I can attach <code>oref1</code> or <code>oref2</code> as a reference input, but not both.</p>
<p>On the testnet, this issue does not occur, so it isn't a problem with the script. Is it not possible with the Plutus emulator to attach more than one reference input to a transaction?</p>

<plutus><minting><offchain>
Unable to attach two reference inputs to a transaction with Plutus Emulator
# Unable to attach two reference inputs to a transaction with Plutus Emulator

(Asked by: username_0 on 2022-12-07)

I have written a script that will fail unless it receives both oref1 and oref2 as reference inputs. I have the following emulator code:
let rule = mempty
                     <> C.mustReferenceOutput oref1
                     <> C.mustReferenceOutput oref2
                     <> C.mustMintValue val 
                     <> (C.mustBeSignedBy ppkh)
tx <- mkTxConstraints @Void (plutusV2MintingPolicy policy) rule
submitTxConfirmed tx

The script fails saying that oref1 is not a reference input. But if I comment out C.mustReferenceOutput oref2 then the script fails saying it has not received oref2 as a reference input. It seems I can attach oref1 or oref2 as a reference input, but not both.
On the testnet, this issue does not occur, so it isn't a problem with the script. Is it not possible with the Plutus emulator to attach more than one reference input to a transaction?

**Tags:** plutus, minting, offchain

---

## 1 answers

### Answer by username_1 on 2022-12-07. Score: 0

It does work with the emulator. Here's a test that demonstrates this being validated on-chain.

<https://github.com/input-output-hk/plutus-apps/blob/9bb44b617212fa195701f0c4a59d6f0e60b7764d/plutus-contract/test/Spec/Contract/Tx/Constraints/MustReferenceOutput.hs#L195-L196>


---

