<p>The error message you are getting is basically telling you that the <code>keyHash</code> value specified (<code>5d4b345b91acf751d7d591f327c10c731024f25db6daed4cabdXXXXX</code>) is not valid.</p>
<p>If you replace that with a valid hash, it works. For example:</p>
<pre><code>{
  &quot;scripts&quot;: [
    {
      &quot;type&quot;: &quot;before&quot;,
      &quot;slot&quot;: 37102595
    },
    {
      &quot;type&quot;: &quot;sig&quot;,
      &quot;keyHash&quot;: &quot;50de79c63d672319e20be59c620eb57ed1de8b7cc7fa489d8f22e353&quot;
    }
  ],
  &quot;type&quot;: &quot;all&quot;
}
</code></pre>

CC BY-SA 4.0
2024-06-04T07:53:27.690Z
2024-06-04T07:53:27.690Z
Falcon Stakepool
<p>On Windows I'm trying to mint some NFTs on Cardano testnet using <a href="https://developers.cardano.org/docs/native-tokens/minting-nfts/" rel="nofollow noreferrer">this guide</a>.</p>
<p>The problem is that when I'm trying to generate policyID I'm getting this error even though the JSON is valid:</p>
<pre><code>cardano-cli transaction policyid --script-file policy.script &gt;&gt; policyID
Command failed: transaction policyid  Error: policy.script: Syntax error in script: Error in $: Failed reading: not a valid json value
</code></pre>
<p>Script is here:</p>
<pre><code>{
  &quot;scripts&quot;: [
    {
      &quot;type&quot;: &quot;before&quot;,
      &quot;slot&quot;: 37102595
    },
    {
      &quot;type&quot;: &quot;sig&quot;,
      &quot;keyHash&quot;: &quot;5d4b345b91acf751d7d591f327c10c731024f25db6daed4cabdXXXXX&quot;
    }
  ],
  &quot;type&quot;: &quot;all&quot;
}
</code></pre>
<p>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.</p>
<p>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.</p>

CC BY-SA 4.0
2022-03-14T17:17:40.590Z
Were you able to resolve it. if yes what was the issue
Hemendra Singh
CC BY-SA 4.0
2022-03-14T17:48:26.970Z
If you put a correct key hash it works.
George - APEX Stake Pool
CC BY-SA 4.0
2022-03-15T05:40:57.507Z
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
Mehul Prajapati
<cardano-cli><transaction><policy>
Syntax error in script when generating policyid
# Syntax error in script when generating policyid

(Asked by: username_0 on 2021-09-13)

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.

**Tags:** cardano-cli, transaction, policy
> **Comments:**
> **username_1**: Were you able to resolve it. if yes what was the issue  
> **username_2**: If you put a correct key hash it works.  
> **username_3**: 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  

---

## 1 answers

### Answer by username_4 on 2024-06-04. Score: 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"
}


---

