user4433: I can send simple transactions to yoroi without any errors. However when I submit a transaction with NFT policy cardano-cli returns an error.
node version 1.30.1 (relay node)
system: ubuntu 20.4
tip:
{
    "epoch": 296,
    "hash": "32a29af3a31fa24e6d731e9adfeb35eb065eb8f688a611da9b479f2770870a01",
    "slot": 42857090,
    "block": 6380067,
    "era": "Alonzo",
    "syncProgress": "100.00"
}

nft meta :
{
  "721": {
    "policyid": {
      "name": {
        "name": "name",
        "artist": "artist",
        "description": "",
        "image": "ipfs://"
      }
    }
  }
}

create policy
cardano-cli address key-gen \
--verification-key-file policy/policy.vkey \
--signing-key-file policy/policy.skey

keyhash:
cardano-cli address key-hash --payment-verification-key-file policy/policy.vkey

policy script:
{
    "type": "all",
    "scripts": [
        {
            "type": "before",
            "slot": 42862090
        },
        {
            "keyHash": "keyhash",
            "type": "sig"
        }
    ]
}

address:
hash     0        5000000 lovelace + TxOutDatumHashNone

calculate fee:
cardano-cli transaction calculate-min-fee --tx-body-file keys/nfttx.raw --tx-in-count 1 --tx-out-count 2 --witness-count 2 --mainnet --protocol-params-file keys/protocol.json --byron-witness-count 0 

transaction:
cardano-cli transaction build-raw --fee 198721 --tx-in hash#0 --tx-out $(cat keys/payment.addr)+2000000 --tx-out $(cat keys/payment.addr)+2801279+"1 $(cat policy/nft/policy.id).head00" --mint="1 $(cat policy/nft/policy.id).head00" --minting-script-file policy/nft/nft_policy.script --metadata-json-file policy/nft/nft_meta.json --invalid-hereafter=42862090 --out-file keys/nfttx.raw --invalid-before 42857090

sign transaction
cardano-cli transaction sign  --tx-body-file keys/nfttx.raw  --signing-key-file keys/payment.skey --mainnet  --out-file keys/tx.signed

error:
Command failed: transaction submit  Error: Error while submitting tx: ShelleyTxValidationError ShelleyBasedEraAlonzo (ApplyTxError [UtxowFailure (WrappedShelleyEraFailure (ScriptWitnessNotValidatingUTXOW (fromList [ScriptHash "keyhash"])))])

EDIT: I get the same error even when submitting a transaction without the invalidation of the policy script part.

user12: Would you mind changing the

`"keyHash": "keyhash",

in the policy script with you key hash. You can generate key hash using

cardano-cli address key-hash --payment-verification-key-file policy.vkey

exact command will depend on the location of your key files.
After including this Key Hash in the policy script, the minting transaction must be signed by the corresponding signing ket(policy.skey). The transaction also has to be signed by the wallet which is paying the fee.
Unless these two signing keys are proper the transaction will not get submitted.

user326: I also got this error trying to mint a native token. In my case, adding the invalid-hereafter parameter to the cardano-cli transaction build-raw command fixed it.  I made sure the value was the same slot number as the policy script before value.
I did not include the invalid-before parameter like the OP.

4433: <p>I can send simple transactions to yoroi without any errors. However when I submit a transaction with NFT policy cardano-cli returns an error.</p>
<p>node version 1.30.1 (relay node)</p>
<p>system: ubuntu 20.4</p>
<p>tip:</p>
<pre><code>{
    &quot;epoch&quot;: 296,
    &quot;hash&quot;: &quot;32a29af3a31fa24e6d731e9adfeb35eb065eb8f688a611da9b479f2770870a01&quot;,
    &quot;slot&quot;: 42857090,
    &quot;block&quot;: 6380067,
    &quot;era&quot;: &quot;Alonzo&quot;,
    &quot;syncProgress&quot;: &quot;100.00&quot;
}
</code></pre>
<p>nft meta :</p>
<pre><code>{
  &quot;721&quot;: {
    &quot;policyid&quot;: {
      &quot;name&quot;: {
        &quot;name&quot;: &quot;name&quot;,
        &quot;artist&quot;: &quot;artist&quot;,
        &quot;description&quot;: &quot;&quot;,
        &quot;image&quot;: &quot;ipfs://&quot;
      }
    }
  }
}
</code></pre>
<p>create policy</p>
<pre><code>cardano-cli address key-gen \
--verification-key-file policy/policy.vkey \
--signing-key-file policy/policy.skey
</code></pre>
<p>keyhash:</p>
<pre><code>cardano-cli address key-hash --payment-verification-key-file policy/policy.vkey
</code></pre>
<p>policy script:</p>
<pre><code>{
    &quot;type&quot;: &quot;all&quot;,
    &quot;scripts&quot;: [
        {
            &quot;type&quot;: &quot;before&quot;,
            &quot;slot&quot;: 42862090
        },
        {
            &quot;keyHash&quot;: &quot;keyhash&quot;,
            &quot;type&quot;: &quot;sig&quot;
        }
    ]
}
</code></pre>
<p>address:</p>
<pre><code>hash     0        5000000 lovelace + TxOutDatumHashNone
</code></pre>
<p>calculate fee:</p>
<pre><code>cardano-cli transaction calculate-min-fee --tx-body-file keys/nfttx.raw --tx-in-count 1 --tx-out-count 2 --witness-count 2 --mainnet --protocol-params-file keys/protocol.json --byron-witness-count 0 
</code></pre>
<p>transaction:</p>
<pre><code>cardano-cli transaction build-raw --fee 198721 --tx-in hash#0 --tx-out $(cat keys/payment.addr)+2000000 --tx-out $(cat keys/payment.addr)+2801279+&quot;1 $(cat policy/nft/policy.id).head00&quot; --mint=&quot;1 $(cat policy/nft/policy.id).head00&quot; --minting-script-file policy/nft/nft_policy.script --metadata-json-file policy/nft/nft_meta.json --invalid-hereafter=42862090 --out-file keys/nfttx.raw --invalid-before 42857090
</code></pre>
<p>sign transaction</p>
<pre><code>cardano-cli transaction sign  --tx-body-file keys/nfttx.raw  --signing-key-file keys/payment.skey --mainnet  --out-file keys/tx.signed
</code></pre>
<p>error:</p>
<pre><code>Command failed: transaction submit  Error: Error while submitting tx: ShelleyTxValidationError ShelleyBasedEraAlonzo (ApplyTxError [UtxowFailure (WrappedShelleyEraFailure (ScriptWitnessNotValidatingUTXOW (fromList [ScriptHash &quot;keyhash&quot;])))])
</code></pre>
<p>EDIT: I get the same error even when submitting a transaction without the invalidation of the policy script part.</p>
 12: <p>Would you mind changing the</p>
<blockquote>
<p>`&quot;keyHash&quot;: &quot;keyhash&quot;,</p>
</blockquote>
<p>in the policy script with you key hash. You can generate key hash using</p>
<blockquote>
<p><code>cardano-cli address key-hash --payment-verification-key-file policy.vkey</code></p>
</blockquote>
<p>exact command will depend on the location of your key files.</p>
<p>After including this Key Hash in the policy script, the minting transaction must be signed by the corresponding signing ket(policy.skey). The transaction also has to be signed by the wallet which is paying the fee.
Unless these two signing keys are proper the transaction will not get submitted.</p>
 326: <p>I also got this error trying to mint a native token. In my case, adding the <code>invalid-hereafter</code> parameter to the <code>cardano-cli transaction build-raw</code> command fixed it.  I made sure the value was the same slot number as the policy script <code>before</code> value.</p>
<p>I did not include the <code>invalid-before</code> parameter like the OP.</p>
