The "--mint" flag specifies an asset with a policy Id, but no corresponding monetary policy script has been provided as a witness

Hey,

I am trying to mint an NFT on the testnet to learn and see how it works. But while doing so I am encountring the following error:

Command failed: transaction build-raw  Error: The "--mint" flag specifies an asset with a policy Id, but no corresponding monetary policy script has been provided as a witness (via the "--minting-script-file" flag). The policy Id in question is: 7f6bd7c68b70f583f9c03fa3f2391c207c949cd50262f60a85428995

Below are the steps that I did:

  1. Generated 2 payments Keys and address (addr1, addr2)
  2. Used the testnet faucet to get some testing lovelace in addr1
  3. Generated a policy keys and wrote a policy script. Below are the content of my policy script:
{
  "type": "all",
  "scripts":
  [
    {
      "type": "before",
      "slot": 37544273
    },
    {
      "type": "sig",
      "keyHash": "7f6bd7c68b70f583f9c03fa3f2391c207c949cd50262f60a85428995"
    }
  ]
}
  1. made a file called metadata.json
  2. I ran the following command to build a raw-transaction
cardano-cli transaction build-raw \  
     --tx-in 6b87cf26a6fc1822c4f14d73d0b8f841bff65f31b65004994274dca859e4967a#0 \
     --tx-out addr2+0+"1 7f6bd7c68b70f583f9c03fa3f2391c207c949cd50262f60a85428995.Maker289" \
     --mint="1 7f6bd7c68b70f583f9c03fa3f2391c207c949cd50262f60a85428995.Maker289" \
     --minting-script-file policy/policy.script \
     --tx-out addr1+0 \
     --metadata-json-file mint_record/metadata.json \
     --fee 0 \
     --invalid-hereafter 37544273 \
     --out-file tx.raw

And when I run the above command I encounter the error I mentioned above. I’m not sure what I’m doing wrong. Can anyone help me with this?

Thanks

same issue

7f6bd7c68b70f583f9c03fa3f2391c207c949cd50262f60a85428995 is the key hash, not the policy ID. To compute the policy ID, you need to run cardano-cli transaction policyid --script-file policy/policy.script. See the last line of Step 1.

1 Like

Hey,

thanks for answering that. Yes the issue was that I used keyHash value in place of the policyID.

Generating a proper ID helped. Thanks :slight_smile:

1 Like