<p>It should. <code>writeScriptsTo</code> is <a href="https://github.com/input-output-hk/plutus-apps/blob/main/plutus-contract/src/Plutus/Trace/Emulator/Extract.hs#L89" rel="nofollow noreferrer">buggy at the moment</a> (not sure why, probably a placeholder has been set while we were working on it and we forgot to change it afterwards).</p>
<p>I'm creating a ticket to fix it.</p>

CC BY-SA 4.0
2023-04-19T08:55:35.807Z
Is there any other way to find out how much resources my script is taking in the meantime?
Eric
CC BY-SA 4.0
2023-04-19T09:42:18.277Z
I didn't try it but you can use [plutus profiling](https://plutus.readthedocs.io/en/latest/howtos/profiling-scripts.html) directly.
Nicolas
CC BY-SA 4.0
2023-04-19T21:37:18.783Z
But how do I obtain the uplc executable? Running "cabal build" in the plutus-apps directory results in an error.
Eric
CC BY-SA 4.0
2023-04-19T06:07:52.140Z
2023-04-19T06:07:52.140Z
Nicolas
<p>I have the following minting script:</p>
<pre><code>{-# INLINABLE verify_mint #-}
script :: () -&gt; V2.ScriptContext  -&gt; Bool
script () _ = (3::Integer) == 2+1
</code></pre>
<p>and the following off-chain code to mint a token:</p>
<pre><code>trace :: Trace.EmulatorTrace ()
        trace = do 
            Extras.logInfo @Haskell.String &quot;Starting...&quot;
            handle &lt;- Trace.activateContractWallet Test.w1 contract

            Trace.callEndpoint @&quot;mint&quot; handle ()
            Functor.void $ Trace.waitNSlots 5

        contract :: Contract () Schema Text ()
        contract = do
            Contract.logInfo @Haskell.String &quot;Waiting...&quot;
            Contract.selectList [ mint ] &gt;&gt; contract

        mint :: Promise () Schema Text ()
        mint  = Contract.endpoint @&quot;mint&quot; $ \() -&gt; do
            let constraint = Constraints.mustMintCurrency (Scripts.mintingPolicyHash policy) &quot;ABC&quot; 1
            tx &lt;- Contract.submitTxConstraintsWith @TScripts.Any (Constraints.plutusV2MintingPolicy policy) constraint
            Functor.void $ Contract.awaitTxConfirmed (Ledger.getCardanoTxId tx)
            Contract.logInfo @Haskell.String &quot;Minted!&quot;
</code></pre>
<p>However when I run <code>writeToScript</code> as follows:</p>
<pre><code>let cmd = Scripts UnappliedValidators
    let config = ScriptsConfig &quot;keystore-stats&quot; cmd
    Haskell.print =&lt;&lt; writeScriptsTo config &quot;x&quot; trace Default.def
</code></pre>
<p>I get the following result:</p>
<pre><code>(Sum {getSum = 0},ExBudget {exBudgetCPU = ExCPU 0, exBudgetMemory = ExMemory 0})
</code></pre>
<p>How can this be? Shouldn't minting require some resources?</p>

<plutus><minting><emulator><cost>
Why is writeToScript reporting that my script costs 0 resources?
# Why is writeToScript reporting that my script costs 0 resources?

(Asked by: username_0 on 2023-04-18)

I have the following minting script:
{-# INLINABLE verify_mint #-}
script :: () -> V2.ScriptContext  -> Bool
script () _ = (3::Integer) == 2+1

and the following off-chain code to mint a token:
trace :: Trace.EmulatorTrace ()
        trace = do 
            Extras.logInfo @Haskell.String "Starting..."
            handle <- Trace.activateContractWallet Test.w1 contract

            Trace.callEndpoint @"mint" handle ()
            Functor.void $ Trace.waitNSlots 5

        contract :: Contract () Schema Text ()
        contract = do
            Contract.logInfo @Haskell.String "Waiting..."
            Contract.selectList [ mint ] >> contract

        mint :: Promise () Schema Text ()
        mint  = Contract.endpoint @"mint" $ \() -> do
            let constraint = Constraints.mustMintCurrency (Scripts.mintingPolicyHash policy) "ABC" 1
            tx <- Contract.submitTxConstraintsWith @TScripts.Any (Constraints.plutusV2MintingPolicy policy) constraint
            Functor.void $ Contract.awaitTxConfirmed (Ledger.getCardanoTxId tx)
            Contract.logInfo @Haskell.String "Minted!"

However when I run writeToScript as follows:
let cmd = Scripts UnappliedValidators
    let config = ScriptsConfig "keystore-stats" cmd
    Haskell.print =<< writeScriptsTo config "x" trace Default.def

I get the following result:
(Sum {getSum = 0},ExBudget {exBudgetCPU = ExCPU 0, exBudgetMemory = ExMemory 0})

How can this be? Shouldn't minting require some resources?

**Tags:** plutus, minting, emulator, cost

---

## 1 answers

### Answer by username_1 on 2023-04-19. Score: 0

It should. `writeScriptsTo` is [buggy at the moment](https://github.com/input-output-hk/plutus-apps/blob/main/plutus-contract/src/Plutus/Trace/Emulator/Extract.hs#L89) (not sure why, probably a placeholder has been set while we were working on it and we forgot to change it afterwards).

I'm creating a ticket to fix it.

> **Comments:**
> **username_0**: Is there any other way to find out how much resources my script is taking in the meantime?  
> **username_1**: I didn't try it but you can use [plutus profiling](https://plutus.readthedocs.io/en/latest/howtos/profiling-scripts.html) directly.  
> **username_0**: But how do I obtain the uplc executable? Running "cabal build" in the plutus-apps directory results in an error.  

---

