<p>Problem was that Minting script is expecting Integer as a redeemer:</p>
<pre><code>mkPolicy :: TxOutRef -&gt; Integer -&gt; ScriptContext -&gt; Bool
mkPolicy utxo _ ctx = validate
</code></pre>
<p>And off-chain code with:</p>
<pre><code>TxConstraints.mustMintValueWithRedeemer unitRedeemer val
</code></pre>
<p>call passes unitRedeemer. Validator tries to deconstruct unitRedeemer to Integer and throws an error.</p>
<p>Bonus: <code>Constraint.mustMintValue</code> passes unitRedeemer by default</p>

CC BY-SA 4.0
2022-04-14T09:03:57.847Z
2022-04-14T09:03:57.847Z
KugisMugis
<h1>Source</h1>
<p><a href="https://github.com/tomazvila/plutus_minting_test" rel="nofollow noreferrer">https://github.com/tomazvila/plutus_minting_test</a></p>
<h1>Problem</h1>
<p>Running smart contract with simple minting use case fails to mint.</p>
<h2>Error</h2>
<pre><code>Slot 00001: *** CONTRACT STOPPED WITH ERROR: &quot;\&quot;WalletContractError (ValidationError (ScriptFailure (EvaluationError [] \\\&quot;BuiltinEvaluationFailure of UnIData\\\&quot;)))\&quot;&quot;
</code></pre>
<h2>Setup</h2>
<pre><code>cardano_node@demoserver:~/coreapp_testing/new_repo$ uname -a
Linux demoserver 5.4.0-100-generic #113-Ubuntu SMP Thu Feb 3 18:43:29 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
cardano_node@demoserver:~/coreapp_testing/new_repo$ cabal --version
cabal-install version 3.6.2.0
compiled using version 3.6.2.0 of the Cabal library
cardano_node@demoserver:~/coreapp_testing/new_repo$ ghc --version
The Glorious Glasgow Haskell Compilation System, version 8.10.7
</code></pre>
<p>How to run</p>
<pre><code>cardano run trace
</code></pre>

<plutus><plutus-pioneer-program><minting><offchain>
Emulator trace throws `BuiltinEvaluationFailure of UnIData` error with simple minting policy
# Emulator trace throws `BuiltinEvaluationFailure of UnIData` error with simple minting policy

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

Source
https://github.com/tomazvila/plutus_minting_test
Problem
Running smart contract with simple minting use case fails to mint.
Error
Slot 00001: *** CONTRACT STOPPED WITH ERROR: "\"WalletContractError (ValidationError (ScriptFailure (EvaluationError [] \\\"BuiltinEvaluationFailure of UnIData\\\")))\""

Setup
cardano_node@demoserver:~/coreapp_testing/new_repo$ uname -a
Linux demoserver 5.4.0-100-generic #113-Ubuntu SMP Thu Feb 3 18:43:29 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
cardano_node@demoserver:~/coreapp_testing/new_repo$ cabal --version
cabal-install version 3.6.2.0
compiled using version 3.6.2.0 of the Cabal library
cardano_node@demoserver:~/coreapp_testing/new_repo$ ghc --version
The Glorious Glasgow Haskell Compilation System, version 8.10.7

How to run
cardano run trace

**Tags:** plutus, plutus-pioneer-program, minting, offchain

---

## 1 answers

### Answer by username_0 on 2022-04-14. Score: 0 | Accepted answer

Problem was that Minting script is expecting Integer as a redeemer:
mkPolicy :: TxOutRef -> Integer -> ScriptContext -> Bool
mkPolicy utxo _ ctx = validate

And off-chain code with:
TxConstraints.mustMintValueWithRedeemer unitRedeemer val

call passes unitRedeemer. Validator tries to deconstruct unitRedeemer to Integer and throws an error.
Bonus: Constraint.mustMintValue passes unitRedeemer by default


---

