<p>So I was able to resolve the issue. The problem was caused by the way I attached the datum as <code>PlutusWitness</code>. So instead of creating directly instantiating a <code>PlutusWitness</code> I created one with the help of the newly made available constructor <code>PlutusWitness.new_with_ref</code> in <strong>CSL version 11.1.0</strong>:</p>
<pre><code>const txIn = TransactionInput.new(TransactionHash.from_bytes(Buffer.from(o.txId, 'hex')), o.idx);
...
// Caused error:
const errorCausingPlutusWitness = PlutusWitness.new(myContract, myDatum, myRedeemer);

// Valid way:
const plutusWitness = PlutusWitness.new_with_ref(PlutusScriptSource.new(myContract), DatumSource.new_ref_input(txIn), myRedeemer);

const amt = Value.new(BigNum.from_str(`${o.value.coins}`));

// The script input to be spent
txBuilder.add_plutus_script_input(plutusWitness, txIn, amt);

</code></pre>

CC BY-SA 4.0
2022-10-04T14:23:10.957Z
This essentially allowed me to spend an `inline-datum` script output.
Will
CC BY-SA 4.0
2022-10-04T14:22:20.110Z
2022-10-04T14:22:20.110Z
Will
<p>I don't use cardano-serialization-lib but I can tell you that <code>NonOutputSupplimentaryDatums</code> is the ledger error thrown when datum is unneceserilly included in the tx when using inline datum. When inline datum is being used you can't have the same datum also in the tx body's witness set.</p>

CC BY-SA 4.0
2022-10-03T16:32:35.990Z
Thanks for the error explanation! The only datum I am attaching is via TxBuilder#add_plutus_script_input which requires a PlutusWitness that is made up of the script, the **datum** and redeemer.
Will
CC BY-SA 4.0
2023-05-11T08:01:06.247Z
This actually helped me solving "unspendableDatums" error from Ogmios. I could not find any docs for it, only the mapping from NonOutputSupplimentaryDatums here: https://github.com/CardanoSolutions/ogmios/blob/756b31cfce0a801526745b39e07c69bc0edaae4a/server/src/Ogmios/Data/Json/Alonzo.hs#LL109C18-L109C46
mirelon
CC BY-SA 4.0
2022-10-03T11:49:05.133Z
2022-10-03T11:49:05.133Z
james
<p>I am stuck with this error, what's a <code>NonOutputSupplimentaryDatums</code>?:</p>
<pre><code>&quot;&quot;transaction submit error ShelleyTxValidationError ShelleyBasedEraBabbage (ApplyTxError [UtxowFailure (FromAlonzoUtxowFail (NonOutputSupplimentaryDatums (fromList [SafeHash \&quot;13866df5e21887cb0d2c27b8d8ccf03d1cb7f93e929dffa9a91c8a4b83c98c60\&quot;]) (fromList [])))])&quot;&quot;
</code></pre>
<p>For the reference:</p>
<ul>
<li>I am spending a <strong>script input</strong> with <strong>inline datum</strong></li>
<li>I am using <code>add_plutus_script_input</code> on <code>TransactionBuilder</code> to add the input</li>
<li>I am using <code>txBuilder.calc_script_data_hash(TxBuilderConstants.plutus_vasil_cost_models());</code> to get the script witnesses and script hash set up</li>
</ul>
<p>Thanks for any help!</p>

<plutus><cardano-serialization-lib><plutus-v2><inline-datum>
Plutus V2 Tx Building causing NonOutputSupplimentaryDatums error
# Plutus V2 Tx Building causing NonOutputSupplimentaryDatums error

(Asked by: username_0 on 2022-10-02)

I am stuck with this error, what's a NonOutputSupplimentaryDatums?:
""transaction submit error ShelleyTxValidationError ShelleyBasedEraBabbage (ApplyTxError [UtxowFailure (FromAlonzoUtxowFail (NonOutputSupplimentaryDatums (fromList [SafeHash \"13866df5e21887cb0d2c27b8d8ccf03d1cb7f93e929dffa9a91c8a4b83c98c60\"]) (fromList [])))])""

For the reference:

I am spending a script input with inline datum
I am using add_plutus_script_input on TransactionBuilder to add the input
I am using txBuilder.calc_script_data_hash(TxBuilderConstants.plutus_vasil_cost_models()); to get the script witnesses and script hash set up

Thanks for any help!

**Tags:** plutus, cardano-serialization-lib, plutus-v2, inline-datum

---

## 2 answers

### Answer by username_1 on 2022-10-03. Score: 5 | Accepted answer

I don't use cardano-serialization-lib but I can tell you that `NonOutputSupplimentaryDatums` is the ledger error thrown when datum is unneceserilly included in the tx when using inline datum. When inline datum is being used you can't have the same datum also in the tx body's witness set.

> **Comments:**
> **username_0**: Thanks for the error explanation! The only datum I am attaching is via TxBuilder#add_plutus_script_input which requires a PlutusWitness that is made up of the script, the **datum** and redeemer.  
> **username_2**: This actually helped me solving "unspendableDatums" error from Ogmios. I could not find any docs for it, only the mapping from NonOutputSupplimentaryDatums here: https://github.com/CardanoSolutions/ogmios/blob/756b31cfce0a801526745b39e07c69bc0edaae4a/server/src/Ogmios/Data/Json/Alonzo.hs#LL109C18-L109C46  

---

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

So I was able to resolve the issue. The problem was caused by the way I attached the datum as PlutusWitness. So instead of creating directly instantiating a PlutusWitness I created one with the help of the newly made available constructor PlutusWitness.new_with_ref in CSL version 11.1.0:
const txIn = TransactionInput.new(TransactionHash.from_bytes(Buffer.from(o.txId, 'hex')), o.idx);
...
// Caused error:
const errorCausingPlutusWitness = PlutusWitness.new(myContract, myDatum, myRedeemer);

// Valid way:
const plutusWitness = PlutusWitness.new_with_ref(PlutusScriptSource.new(myContract), DatumSource.new_ref_input(txIn), myRedeemer);

const amt = Value.new(BigNum.from_str(`${o.value.coins}`));

// The script input to be spent
txBuilder.add_plutus_script_input(plutusWitness, txIn, amt);

> **Comments:**
> **username_0**: This essentially allowed me to spend an `inline-datum` script output.  

---

