Error when submitting transaction for minting native tokens

Hi! Can someone please help me understand why this error keeps on happening when trying to mint some native tokens with a locked policy? I tried minting with a simple open policy and it worked just fine.

Here’s how i built the transaction:

cardano-cli transaction build-raw \
--fee 181781 \
--tx-in c3d6db8c677afa505f3eb87d97397eca869967fef118928a60fb77ab8deb84e9#0  \
--tx-out addr1v92pewjpnrljgd3tzk69f43h6vykyscnp7k6ck27xzvp6pq6a5up1+377861020+"500000000 6a05c09ae0dd610182acb6be893a5ac206424106c602224a4fb55d72.50524551" \
--mint "500000000 6a05c09ae0dd610182acb6be893a5ac206424106c602224a4fb55d72.50524551" \
--minting-script-file policy1/policy.script \
--out-file matx.raw

Really grateful for any piece of advice. Cheers!

ScriptWitnessNotValiditingUTXOW sounds like it is maybe not the policy script for the policy ID you are trying to mint for.

MissingVKeyWitnessesUTXOW is usually that you haven’t signed with the key for the --tx-in you are trying to spend.

ValueNotConservedUTxO is because there already are tokens on the input that you have to also put on the output.

1 Like

Thanks for the response! @HeptaSean

Regarding MissingVKeyWitnessesUTXOW and ValueNotConservedUTxO, I’ve already tried minting a set of tokens using the same key and it worked fine so I doubt these are the reasons.

When I used a simple open minting policy, I was able to mint the native tokens properly. I was wondering if maybe there is something wrong with how I wrote the time-locked policy?

  "type": "all",
     "type": "before",
     "slot": 82064168
     "type": "sig",
     "keyHash": "6f79dea3b5a42768d24f5dda04f555d58e8c399152f22a9a72a5ff7f"


You can doubt all the way, but that is what ValueNotConservedUTxO means. It even gives you the details of what it would have expected in the output in the first (Value …) after it and what it got instead in the second (Value …).

That you previously had it working with another UTxO means nothing. You have to do fee calculation and balance outputs anew for each new transaction.

If the input to this transaction contains additional tokens (presumably the ones you minted before), you have to tell that they should go in the output (which you didn’t have to do in the first mint, since there were no other tokens). Moreover, the ADA output is also wrong according to the error message.

Since you seemingly anonymised your build-raw command (I can find neither the input nor the address on-chain), I can’t show you the details in an explorer.

The policy looks good. But its policy ID is 2bbab48d7e8e588573d20d09ae63da2357b765bf4439f971ba434e03, not 6a05c09ae0dd610182acb6be893a5ac206424106c602224a4fb55d72. That would explain the ScriptWitnessNotValiditingUTXOW error.

1 Like

Also: If you have a before clause in the policy, the transaction has to be built with an --invalid-hereafter option with the same (or an earlier) slot, so that it is ensured that the policy is fulfilled.

1 Like

Thank you so much for the effort in explaining. You are right. I must review my inputs once again. Might as well redo everything to make sure everything’s sorted out correctly.

Will take all your responses into consideration. Gladly appreciate it!

I see. Thanks once again

*EDITED: I finally got it right… it turns out I’m also simply using an incorrect TxID.

Thank you so much for the help! Learned now that I need to triple- or maybe quadruple-check everything next time.

1 Like