<p>It appears that you need to call one of the signature methods from ForgeScript. In most of the examples, they use ForgeScript.withOneSignature(address). However there are <a href="https://github.com/MeshJS/mesh/blob/01787c877737575767a43828492a3319a7ce570d/packages/module/src/scripts/forge.script.ts" rel="nofollow noreferrer">multiple options</a>:</p>
<ol>
<li>withOneSignature</li>
<li>withAtLeastNSignatures</li>
<li>withAnySignature</li>
<li>withAllSignatures</li>
</ol>
<p>This looks like it needs to be done before your call to <code>ForgeScript.fromNativeScript(nativeScript)</code>. This might set the witness count in some way.</p>
<p>&quot;The --witness-count 1 basically tells cardano-cli that there will be only 1 signing key required for this transaction to be valid. Since the UTXO input involved in this transaction will only be coming from payment1 wallet, so that means we indeed only need 1 key to sign the transaction.&quot;
<a href="https://developers.cardano.org/docs/integrate-cardano/creating-wallet-faucet" rel="nofollow noreferrer">https://developers.cardano.org/docs/integrate-cardano/creating-wallet-faucet</a></p>

CC BY-SA 4.0
2023-03-22T13:52:33.800Z
2023-03-22T13:52:33.800Z
PREEB
<p>Having an issue trying to mint an NFT with my own policy. It's throwing the error below:</p>
<p>Missing key witness for: 1e101f14d07f203b01f8.....</p>
<p>I am not sure what to do here and any assistance would be appreciated. Long time developer, short time developing on Cardano.</p>
<p>Here is my code:</p>
<pre><code>const nativeScript: NativeScript = {
  type: 'all',
  scripts:
  [
     {
      type: 'sig',
      keyHash: '1e101f14d07f203b01f89d1562831374f....'
    },
    {
      type: 'before',
      slot: '317614504'
    }
   
  ]
};

const forgingScript = ForgeScript.fromNativeScript(nativeScript);

const { wallet, connected } = useWallet();
const [txHash, setTxHash] = useState&lt;string | null&gt;(null);
const [loading, setLoading] = useState&lt;boolean&gt;(false);

 const wallet_for_mint = new AppWallet({
    networkId: 1,
    fetcher: blockchainProvider,
    submitter: blockchainProvider,
    key: {
      type: &quot;mnemonic&quot;,
      words: [
    'tenant',
....
      ],
    },
  });


 const assetMetadata1: AssetMetadata = {
      name: &quot;ASSETNAME&quot;,
      type: &quot;TYPE1&quot;,
      item: &quot;FLAG&quot;,
      image: &quot;ipfs://Qmb18wvCu.....&quot;,
    };

    const asset1: Mint = {
      assetName: &quot;TESTASSET&quot;,
      assetQuantity: &quot;1&quot;,
      metadata: assetMetadata1,
      label: &quot;721&quot;,
      recipient:
   
      &quot;addr.........e&quot;,
    };


    

    const txMint = new Transaction({ initiator: wallet_for_mint });
    txMint.mintAsset(forgingScript, asset1);

    const unsignedTxMint = await txMint.build();
    const signedTxMint = await wallet_for_mint.signTx(unsignedTxMint);
    const txHash = await wallet_for_mint.submitTx(signedTxMint);

</code></pre>

CC BY-SA 4.0
2023-03-21T20:35:23.710Z
Is this all the code? Where do you set the witness count?
PREEB
CC BY-SA 4.0
2023-03-22T09:41:09.113Z
Hey. Thanks for the reply. That is all the code. I dont see in the sample code where the witness count is set.
cardano dev 12
<error><mint><mesh>
Minting with MESH - Error Missing key witness for: 1e101f14d
# Minting with MESH - Error Missing key witness for: 1e101f14d

(Asked by: username_0 on 2023-03-21)

Having an issue trying to mint an NFT with my own policy. It's throwing the error below:
Missing key witness for: 1e101f14d07f203b01f8.....
I am not sure what to do here and any assistance would be appreciated. Long time developer, short time developing on Cardano.
Here is my code:
const nativeScript: NativeScript = {
  type: 'all',
  scripts:
  [
     {
      type: 'sig',
      keyHash: '1e101f14d07f203b01f89d1562831374f....'
    },
    {
      type: 'before',
      slot: '317614504'
    }
   
  ]
};

const forgingScript = ForgeScript.fromNativeScript(nativeScript);

const { wallet, connected } = useWallet();
const [txHash, setTxHash] = useState(null);
const [loading, setLoading] = useState(false);

 const wallet_for_mint = new AppWallet({
    networkId: 1,
    fetcher: blockchainProvider,
    submitter: blockchainProvider,
    key: {
      type: "mnemonic",
      words: [
    'tenant',
....
      ],
    },
  });


 const assetMetadata1: AssetMetadata = {
      name: "ASSETNAME",
      type: "TYPE1",
      item: "FLAG",
      image: "ipfs://Qmb18wvCu.....",
    };

    const asset1: Mint = {
      assetName: "TESTASSET",
      assetQuantity: "1",
      metadata: assetMetadata1,
      label: "721",
      recipient:
   
      "addr.........e",
    };


    

    const txMint = new Transaction({ initiator: wallet_for_mint });
    txMint.mintAsset(forgingScript, asset1);

    const unsignedTxMint = await txMint.build();
    const signedTxMint = await wallet_for_mint.signTx(unsignedTxMint);
    const txHash = await wallet_for_mint.submitTx(signedTxMint);

**Tags:** error, mint, mesh
> **Comments:**
> **username_1**: Is this all the code? Where do you set the witness count?  
> **username_0**: Hey. Thanks for the reply. That is all the code. I dont see in the sample code where the witness count is set.  

---

## 1 answers

### Answer by username_1 on 2023-03-22. Score: 0

It appears that you need to call one of the signature methods from ForgeScript. In most of the examples, they use ForgeScript.withOneSignature(address). However there are [multiple options](https://github.com/MeshJS/mesh/blob/01787c877737575767a43828492a3319a7ce570d/packages/module/src/scripts/forge.script.ts):

1. withOneSignature
2. withAtLeastNSignatures
3. withAnySignature
4. withAllSignatures

This looks like it needs to be done before your call to `ForgeScript.fromNativeScript(nativeScript)`. This might set the witness count in some way.

"The --witness-count 1 basically tells cardano-cli that there will be only 1 signing key required for this transaction to be valid. Since the UTXO input involved in this transaction will only be coming from payment1 wallet, so that means we indeed only need 1 key to sign the transaction."
<https://developers.cardano.org/docs/integrate-cardano/creating-wallet-faucet>


---

