<p>As james noted in a comment a simple update to the head of <code>next-node</code> resolved the issue. now tokens are minted correctly</p>

CC BY-SA 4.0
2022-10-04T05:58:24.287Z
2022-10-04T05:58:24.287Z
CantTouchDis
<p>I am trying to mint some example tokens in offchain plutus code on tag <code>v1.0.0-alpha1</code>.</p>
<p>This is the OffChain code I am currently using:</p>
<pre><code>mintFactoryToken :: Contract () MintFactorySchema Text ()
mintFactoryToken = do
  outRef &lt;- getUnspentOutput
  pkh    &lt;- ownFirstPaymentPubKeyHash
  o      &lt;- fromJust &lt;$&gt; unspentTxOutFromRef outRef
  let
    !policy     = mintValidator outRef
    symbol     = scriptCurrencySymbol policy
    mintValue  = Value.singleton symbol contractDataTokenName 1 &lt;&gt; Value.singleton symbol chunkCreationTokenName 1
  Contract.logDebug outRef
  Contract.logDebug policy
  Contract.logDebug symbol
  Contract.logDebug mintValue
  let
    l          = Constraints.plutusV2MintingPolicy policy &lt;&gt;
                 Constraints.unspentOutputs (Map.singleton outRef o)
    constr     = Constraints.mustMintValue mintValue
  unbalanced &lt;- Contract.mkTxConstraints @Any l constr
  Contract.logDebug @Text &quot;Unbalanced&quot;
  adjusted  &lt;- Contract.adjustUnbalancedTx unbalanced
  Contract.logDebug @Text &quot;adjusted&quot;
  unsigned  &lt;- Contract.balanceTx adjusted
  Contract.logDebug @Text &quot;unsigned&quot;
  signed    &lt;- Contract.submitBalancedTx unsigned
  Contract.logDebug @Text &quot;signed&quot;
  --ledgerTx &lt;- Contract.submitTxConstraintsWith @Void l constr
  Contract.awaitTxConfirmed $ getCardanoTxId signed
  Contract.logDebug @Text &quot;signed&quot;
</code></pre>
<p>But as soon as it reaches <code>Contract.balanceTx adjusted</code> I encounter the following error:</p>
<pre><code>Slot 00001: *** CONTRACT STOPPED WITH ERROR: &quot;\&quot;WalletContractError (ValidationError (CardanoLedgerValidationError \\\&quot;MissingScript (RdmrPtr Mint 0) (fromList [(RdmrPtr Mint 0,(Minting (PolicyID {policyID = ScriptHash \\\\\\\&quot;2fcc3c79d2cb27a9784a7d3e69de5f1909406fcbc33567e6dd24288b\\\\\\\&quot;}),Nothing,ScriptHash \\\\\\\&quot;2fcc3c79d2cb27a9784a7d3e69de5f1909406fcbc33567e6dd24288b\\\\\\\&quot;))])\\\&quot;))\&quot;&quot;
</code></pre>
<p>Do I have to do something special in order to get this to work or is this just not supported at the moment?</p>
<p>I've seen in the <a href="https://github.com/input-output-hk/plutus-apps/releases/tag/v1.0.0-alpha1" rel="nofollow noreferrer">Relese Notes</a> that some custom validation rules are used at the moment:</p>
<blockquote>
<p>...</p>
<ul>
<li><code>plutus-contract</code> emulator has been updated to work with Babbage era types. However, the UTxO index in the emulator does not support transaction outputs with reference scripts and inline datums.</li>
<li><code>plutus-contract</code> emulator uses the Babbage era validation rules from cardano-ledger. However, we continue to use our old custom validation rules which we plan to remove in the next alpha release in order to fully commit with cardano-ledger 's validation rules.</li>
</ul>
<p>...</p>
</blockquote>
<p>But I am not sure if this causes my problem or not.</p>
<p>Signatures of the OnChain code:</p>
<pre><code>{-# INLINABLE validateMinting #-}
validateMinting :: TxOutRef -&gt; BuiltinData -&gt; BuiltinData -&gt; ()
...

mintValidator :: TxOutRef -&gt; MintingPolicy
mintValidator oRef = mkMintingPolicyScript
   ($$(Tx.compile [|| validateMinting ||]) `Tx.applyCode` Tx.liftCode oRef)

mintCurrencySymbol :: TxOutRef -&gt; CurrencySymbol
mintCurrencySymbol = scriptCurrencySymbol . mintValidator
</code></pre>

CC BY-SA 4.0
2022-10-03T12:11:24.460Z
Can't see anything wrong with what you're doing. A lot has changed since `v1.0.0-alpha1` so could you try with latest from `next-node` branch and see if it helps.
james
<plutus><minting>
"plutusV2MintingPolicy" lookup not found by "balanceTx"
# "plutusV2MintingPolicy" lookup not found by "balanceTx"

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

I am trying to mint some example tokens in offchain plutus code on tag v1.0.0-alpha1.
This is the OffChain code I am currently using:
mintFactoryToken :: Contract () MintFactorySchema Text ()
mintFactoryToken = do
  outRef <- getUnspentOutput
  pkh    <- ownFirstPaymentPubKeyHash
  o      <- fromJust <$> unspentTxOutFromRef outRef
  let
    !policy     = mintValidator outRef
    symbol     = scriptCurrencySymbol policy
    mintValue  = Value.singleton symbol contractDataTokenName 1 <> Value.singleton symbol chunkCreationTokenName 1
  Contract.logDebug outRef
  Contract.logDebug policy
  Contract.logDebug symbol
  Contract.logDebug mintValue
  let
    l          = Constraints.plutusV2MintingPolicy policy <>
                 Constraints.unspentOutputs (Map.singleton outRef o)
    constr     = Constraints.mustMintValue mintValue
  unbalanced <- Contract.mkTxConstraints @Any l constr
  Contract.logDebug @Text "Unbalanced"
  adjusted  <- Contract.adjustUnbalancedTx unbalanced
  Contract.logDebug @Text "adjusted"
  unsigned  <- Contract.balanceTx adjusted
  Contract.logDebug @Text "unsigned"
  signed    <- Contract.submitBalancedTx unsigned
  Contract.logDebug @Text "signed"
  --ledgerTx <- Contract.submitTxConstraintsWith @Void l constr
  Contract.awaitTxConfirmed $ getCardanoTxId signed
  Contract.logDebug @Text "signed"

But as soon as it reaches Contract.balanceTx adjusted I encounter the following error:
Slot 00001: *** CONTRACT STOPPED WITH ERROR: "\"WalletContractError (ValidationError (CardanoLedgerValidationError \\\"MissingScript (RdmrPtr Mint 0) (fromList [(RdmrPtr Mint 0,(Minting (PolicyID {policyID = ScriptHash \\\\\\\"2fcc3c79d2cb27a9784a7d3e69de5f1909406fcbc33567e6dd24288b\\\\\\\"}),Nothing,ScriptHash \\\\\\\"2fcc3c79d2cb27a9784a7d3e69de5f1909406fcbc33567e6dd24288b\\\\\\\"))])\\\"))\""

Do I have to do something special in order to get this to work or is this just not supported at the moment?
I've seen in the Relese Notes that some custom validation rules are used at the moment:

...

plutus-contract emulator has been updated to work with Babbage era types. However, the UTxO index in the emulator does not support transaction outputs with reference scripts and inline datums.
plutus-contract emulator uses the Babbage era validation rules from cardano-ledger. However, we continue to use our old custom validation rules which we plan to remove in the next alpha release in order to fully commit with cardano-ledger 's validation rules.

...

But I am not sure if this causes my problem or not.
Signatures of the OnChain code:
{-# INLINABLE validateMinting #-}
validateMinting :: TxOutRef -> BuiltinData -> BuiltinData -> ()
...

mintValidator :: TxOutRef -> MintingPolicy
mintValidator oRef = mkMintingPolicyScript
   ($$(Tx.compile [|| validateMinting ||]) `Tx.applyCode` Tx.liftCode oRef)

mintCurrencySymbol :: TxOutRef -> CurrencySymbol
mintCurrencySymbol = scriptCurrencySymbol . mintValidator

**Tags:** plutus, minting
> **Comments:**
> **username_1**: Can't see anything wrong with what you're doing. A lot has changed since `v1.0.0-alpha1` so could you try with latest from `next-node` branch and see if it helps.  

---

## 1 answers

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

As james noted in a comment a simple update to the head of `next-node` resolved the issue. now tokens are minted correctly


---

