<p>I had this exact same issue with a StateMachine. I solved it by using <code>runStepWith</code> instead of <code>runStep</code>, which allows you to also supply the minting policy.</p>
<p>See <a href="https://playground.plutus.iohkdev.io/doc/haddock/plutus-contract/html/Plutus-Contract-StateMachine.html#:%7E:text=lookups%20for%20transaction.-,runStepWith,Source,-%23" rel="nofollow noreferrer">the haddock documentation</a> for details on how to use <code>runStepWith</code></p>

CC BY-SA 4.0
2022-10-19T22:08:27.650Z
2022-10-19T22:08:27.650Z
Rohan Mitta
<p>I changed <a href="https://github.com/input-output-hk/plutus-pioneer-program/blob/1ab1d5c11a94da0b709ad05f921d91795a2fc209/code/week08/src/Week08/TokenSale.hs#L63" rel="nofollow noreferrer">transition function in Lecture 7</a> and added constraint for minting Constraints.mustMintValue:</p>
<pre><code>transition ts s r = case (stateValue s, stateData s, r) of
    (v, _, SetPrice p)   | p &gt;= 0           -&gt; Just ( Constraints.mustBeSignedBy (tsSeller ts) &lt;&gt;
                                                      Constraints.mustMintValue (assetClassValue (tsToken ts) 100)
                                                    , State p v
                                                    )
</code></pre>
<p>When I start emulator trace monad I am getting error in log:</p>
<pre><code>Slot 00007: *** CONTRACT LOG: &quot;SMCContractError (ConstraintResolutionError (MintingPolicyNotFound aa))&quot;
</code></pre>
<p>I tried also with a different currencyPolicy than &quot;aa&quot;, the real one that I got from Lecture 5 - Free.hs but I am getting the same result.</p>
<p>What is the proper way to do minting from State Machine?</p>

CC BY-SA 4.0
2022-02-07T09:09:17.093Z
HI , Did you solve this issue.? I am Facing the same issue
Dawar Ejaz
CC BY-SA 4.0
2022-04-06T10:35:46.037Z
Try adding a lookup specifying a minting policy. Not sure how to do it in the StateMachine context, but elsewhere I did something like: `let lookups = Constraints.mintingPolicy (policy oref)`.
Wojciech Gac
<plutus><minting><statemachines>
Tried minting from transition in StateMachine an got error MintingPolicyNotFound
# Tried minting from transition in StateMachine an got error MintingPolicyNotFound

(Asked by: username_0 on 2021-11-28)

I changed transition function in Lecture 7 and added constraint for minting Constraints.mustMintValue:
transition ts s r = case (stateValue s, stateData s, r) of
    (v, _, SetPrice p)   | p >= 0           -> Just ( Constraints.mustBeSignedBy (tsSeller ts) <>
                                                      Constraints.mustMintValue (assetClassValue (tsToken ts) 100)
                                                    , State p v
                                                    )

When I start emulator trace monad I am getting error in log:
Slot 00007: *** CONTRACT LOG: "SMCContractError (ConstraintResolutionError (MintingPolicyNotFound aa))"

I tried also with a different currencyPolicy than "aa", the real one that I got from Lecture 5 - Free.hs but I am getting the same result.
What is the proper way to do minting from State Machine?

**Tags:** plutus, minting, statemachines
> **Comments:**
> **username_1**: HI , Did you solve this issue.? I am Facing the same issue  
> **username_2**: Try adding a lookup specifying a minting policy. Not sure how to do it in the StateMachine context, but elsewhere I did something like: `let lookups = Constraints.mintingPolicy (policy oref)`.  

---

## 1 answers

### Answer by username_3 on 2022-10-19. Score: 1

I had this exact same issue with a StateMachine. I solved it by using `runStepWith` instead of `runStep`, which allows you to also supply the minting policy.

See [the haddock documentation](https://playground.plutus.iohkdev.io/doc/haddock/plutus-contract/html/Plutus-Contract-StateMachine.html#:%7E:text=lookups%20for%20transaction.-,runStepWith,Source,-%23) for details on how to use `runStepWith`


---

