0

On Windows I'm trying to mint some NFTs on Cardano testnet using this guide.

The problem is that when I'm trying to generate policyID I'm getting this error even though the JSON is valid:

cardano-cli transaction policyid --script-file policy.script >> policyID
Command failed: transaction policyid  Error: policy.script: Syntax error in script: Error in $: Failed reading: not a valid json value

Script is here:

{
  "scripts": [
    {
      "type": "before",
      "slot": 37102595
    },
    {
      "type": "sig",
      "keyHash": "5d4b345b91acf751d7d591f327c10c731024f25db6daed4cabdXXXXX"
    }
  ],
  "type": "all"
}

At first I thought it was some Windows distro bug, but after rebuilding 1.29 version from source on Ubuntu 20.04 LTS (ran over wsl 2) I get the same error.

Out of desperation I also tried removing all spaces like I read in some other answers to similar error when using cardano-cli, that didn't help.

3
  • Were you able to resolve it. if yes what was the issue Commented Mar 14, 2022 at 17:17
  • If you put a correct key hash it works. Commented Mar 14, 2022 at 17:48
  • Just in case this might be useful for you or for others Typhon Wallet Dapp Connector supports Minting tokens/NFTs using NativeScript using a simple method. ```js const receivingAddress = "addr_test1qz2qzz8d4unvpkes7nt7tjkwx0sff3cfkrvl528mgkdzt5kmt68vuzvz4nzgs00x0shrgywvy674v6r2zcs8fxvvq27qqycj9a"; const decoded = typhonjs.utils.decodeBech32(receivingAddress); const pubKeyHash = decoded.value.slice(2, 56 + 2); const nativeScript = { pubKeyHash: pubKeyHash, }; const nativeScriptFactory = new typhonjs.NativeScriptFactory(nativeScript); const policyId = nativeScriptFactory.policyId().toString("hex Commented Mar 15, 2022 at 5:40

1 Answer 1

0

The error message you are getting is basically telling you that the keyHash value specified (5d4b345b91acf751d7d591f327c10c731024f25db6daed4cabdXXXXX) is not valid.

If you replace that with a valid hash, it works. For example:

{
  "scripts": [
    {
      "type": "before",
      "slot": 37102595
    },
    {
      "type": "sig",
      "keyHash": "50de79c63d672319e20be59c620eb57ed1de8b7cc7fa489d8f22e353"
    }
  ],
  "type": "all"
}

Not the answer you're looking for? Browse other questions tagged or ask your own question.