<p>You are using,</p>
<pre><code>{
    &quot;type&quot;: &quot;after&quot;,
    &quot;slot&quot;: 155761
}
</code></pre>
<p>while the current slot on preprod is <code>~154042</code>. This policy allows using it only <strong>after</strong> slot <code>155761</code>, for more info see <a href="https://github.com/input-output-hk/cardano-node/blob/master/doc/reference/simple-scripts.md" rel="nofollow noreferrer">(1)</a>. Also make sure that,</p>
<pre><code>cardano-cli address key-hash --payment-verification-key-file payment.skey
</code></pre>
<p>is equal to <code>e9ce8633aef95b632bfbffc12a83cc4c589132c46cd03f8dae146ec2</code>.</p>

CC BY-SA 4.0
2022-09-05T13:50:42.193Z
i changes the script ``` {
    "type": "all",
    "scripts":
    [   
        {
            "type": "after",
            "slot": 6702243
        },
        {
            "type": "sig",
            "keyHash": "e9ce8633aef95b632bfbffc12a83cc4c589132c46cd03f8dae146ec2"
        }
     
    ]
}``` and key hash is also the same still same error
Hari Krishna
CC BY-SA 4.0
2022-09-05T14:59:39.497Z
Hmm, that's weird, I also think I had the slot of preprod wrong (your query is correct).
Fermat
CC BY-SA 4.0
2022-09-05T15:55:16.133Z
Can you use the `--invalid-after` to make the transaction valid even if it is send before the `after` slot?
Fermat
CC BY-SA 4.0
2022-09-06T04:08:00.950Z
``` cardano-cli transaction build \
--alonzo-era \
--testnet-magic 1 \
--tx-in $TXIN \
--tx-out $RECIEVER+1500000+"1 $POLICYID.$TOKENNAME" \
--change-address $MINTER \
--mint "1 $POLICYID.$TOKENNAME" \
--minting-script-file ppbl-nft-2.script \
--invalid-hereafter 6753799 \
--metadata-json-file mynft.json \
--protocol-params-file protocol.json \
--out-file nft.raw```
Hari Krishna
CC BY-SA 4.0
2022-09-06T04:26:59.473Z
still same error
Hari Krishna
CC BY-SA 4.0
2022-09-05T07:13:59.417Z
2022-09-05T07:13:59.417Z
Fermat
<p>You're missing the <code>--invalid-before</code> flag when building the transaction. It sets the lower bound of the transaction's validity interval, which is required for the script to determine whether the interval range is greater than slot 155761. You must use a slot that is lower than the current slot.</p>

CC BY-SA 4.0
2022-09-09T12:21:39.153Z
2022-09-09T12:21:39.153Z
james
<p>minting script</p>
<pre><code>    &quot;type&quot;: &quot;all&quot;,
    &quot;scripts&quot;:
    [   
        {
            &quot;type&quot;: &quot;after&quot;,
            &quot;slot&quot;: 155761
        },
        {
            &quot;type&quot;: &quot;sig&quot;,
            &quot;keyHash&quot;: &quot;e9ce8633aef95b632bfbffc12a83cc4c589132c46cd03f8dae146ec2&quot;
        }
     
    ]
}
</code></pre>
<p>metadata-json-file</p>
<pre><code>    &quot;721&quot;: {
        &quot;ca8fc6bf8d698d5752e6c700c8a5818c2abe5a17877121ae99604e24&quot;: {
            &quot;cat&quot;: {
                &quot;name&quot;: &quot;Nikki&quot;,
                &quot;image&quot;: [&quot;ipfs://QmQQqHaitxGkzNTRCSxJxTU5JaVvSoGGxocBcU246BZA7M&quot;],
                &quot;mediaType&quot;: &quot;image/png&quot;,
                &quot;description&quot;: &quot;remember when?&quot;,
                &quot;files&quot;: [
                    {
                        &quot;mediaType&quot;: &quot;image/png&quot;,
                        &quot;src&quot;: [&quot;ipfs://QmQQqHaitxGkzNTRCSxJxTU5JaVvSoGGxocBcU246BZA7M&quot;]
                    },
                    {
                        &quot;mediaType&quot;: &quot;image/png&quot;,
                        &quot;src&quot;: [&quot;ipfs://QmYCbn5Nj3Xq28QwDkerMBAXsLBDa26f1k8jruuKn5gzXn&quot;]
                    }
                    
                ],
                &quot;type&quot;: &quot;Nadan&quot;,
                &quot;color&quot;: &quot;white and brown&quot;
            }
        }
    }
}
</code></pre>
<p>cardano-cli query tip --testnet-magic 1</p>
<pre><code>{
    &quot;block&quot;: 153845,
    &quot;epoch&quot;: 19,
    &quot;era&quot;: &quot;Alonzo&quot;,
    &quot;hash&quot;: &quot;789909e77ba308c069b0e09809a6ec7508da0d2c0c474565caed2688afe3618e&quot;,
    &quot;slot&quot;: 6674546,
    &quot;syncProgress&quot;: &quot;100.00&quot;
}
</code></pre>
<p>command line variables</p>
<pre><code>POLICYID=ca8fc6bf8d698d5752e6c700c8a5818c2abe5a17877121ae99604e24
TXIN=&quot;02a037b9649eb62f17549bf33114763568b59a4be20beba6132f7b996a0825e2#0&quot;
TOKENNAME1=&quot;6e696b6b69&quot;
POLICYSCRIPT=&quot;ppbl-nft-2.script&quot;
MINTER=addr_test1vr5uap3n4mu4kcetl0luz25re3x93yfjc3kdq0ud4c2xassvq0wsd
METADATA_JSON_FILE=&quot;mynft.json&quot;
RECIEVER=addr_test1qzdquurtx940tpyfgt7pu2h8zgrgfepf7quwcqqh3kmacd83z2naq8a2cltaqyxexml30wh77uyu3sll7feyp2nzqgnqfdpnsa
</code></pre>
<p>// transaction <code>cardano-cli transaction build \ --alonzo-era \ --testnet-magic 1 \ --tx-in $TXIN \ --tx-out $RECIEVER+1500000+&quot;1 $POLICYID.$TOKENNAME&quot; \ --change-address $MINTER \ --mint &quot;1 $POLICYID.$TOKENNAME&quot; \ --minting-script-file ppbl-nft-2.script \ --metadata-json-file mynft.json \ --protocol-params-file protocol.json \ --out-file nft.raw</code></p>
<p>//transaction sign</p>
<pre><code>cardano-cli transaction sign \
--signing-key-file payment.skey \
--testnet-magic 1 \
--tx-body-file nft.raw \
--out-file mint-nft.signed
</code></pre>
<p>//submit transaction</p>
<pre><code>cardano-cli transaction submit \
--tx-file mint-nft.signed \
--testnet-magic 1
</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;c867c502e249d681b35a8df2e3df5e58ec2c16d3df445429484a1793&quot;])))])
</code></pre>

<cardano-cli><wallet><cardano-node>
ScriptWitnessNotValidatingUTXOW while trying to mint NFT in preprod testnet
# ScriptWitnessNotValidatingUTXOW while trying to mint NFT in preprod testnet

(Asked by: username_0 on 2022-09-05)

minting script
    "type": "all",
    "scripts":
    [   
        {
            "type": "after",
            "slot": 155761
        },
        {
            "type": "sig",
            "keyHash": "e9ce8633aef95b632bfbffc12a83cc4c589132c46cd03f8dae146ec2"
        }
     
    ]
}

metadata-json-file
    "721": {
        "ca8fc6bf8d698d5752e6c700c8a5818c2abe5a17877121ae99604e24": {
            "cat": {
                "name": "Nikki",
                "image": ["ipfs://QmQQqHaitxGkzNTRCSxJxTU5JaVvSoGGxocBcU246BZA7M"],
                "mediaType": "image/png",
                "description": "remember when?",
                "files": [
                    {
                        "mediaType": "image/png",
                        "src": ["ipfs://QmQQqHaitxGkzNTRCSxJxTU5JaVvSoGGxocBcU246BZA7M"]
                    },
                    {
                        "mediaType": "image/png",
                        "src": ["ipfs://QmYCbn5Nj3Xq28QwDkerMBAXsLBDa26f1k8jruuKn5gzXn"]
                    }
                    
                ],
                "type": "Nadan",
                "color": "white and brown"
            }
        }
    }
}

cardano-cli query tip --testnet-magic 1
{
    "block": 153845,
    "epoch": 19,
    "era": "Alonzo",
    "hash": "789909e77ba308c069b0e09809a6ec7508da0d2c0c474565caed2688afe3618e",
    "slot": 6674546,
    "syncProgress": "100.00"
}

command line variables
POLICYID=ca8fc6bf8d698d5752e6c700c8a5818c2abe5a17877121ae99604e24
TXIN="02a037b9649eb62f17549bf33114763568b59a4be20beba6132f7b996a0825e2#0"
TOKENNAME1="6e696b6b69"
POLICYSCRIPT="ppbl-nft-2.script"
MINTER=addr_test1vr5uap3n4mu4kcetl0luz25re3x93yfjc3kdq0ud4c2xassvq0wsd
METADATA_JSON_FILE="mynft.json"
RECIEVER=addr_test1qzdquurtx940tpyfgt7pu2h8zgrgfepf7quwcqqh3kmacd83z2naq8a2cltaqyxexml30wh77uyu3sll7feyp2nzqgnqfdpnsa

// transaction cardano-cli transaction build \ --alonzo-era \ --testnet-magic 1 \ --tx-in $TXIN \ --tx-out $RECIEVER+1500000+"1 $POLICYID.$TOKENNAME" \ --change-address $MINTER \ --mint "1 $POLICYID.$TOKENNAME" \ --minting-script-file ppbl-nft-2.script \ --metadata-json-file mynft.json \ --protocol-params-file protocol.json \ --out-file nft.raw
//transaction sign
cardano-cli transaction sign \
--signing-key-file payment.skey \
--testnet-magic 1 \
--tx-body-file nft.raw \
--out-file mint-nft.signed

//submit transaction
cardano-cli transaction submit \
--tx-file mint-nft.signed \
--testnet-magic 1

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

**Tags:** cardano-cli, wallet, cardano-node

---

## 2 answers

### Answer by username_1 on 2022-09-05. Score: 0

You are using,
{
    "type": "after",
    "slot": 155761
}

while the current slot on preprod is ~154042. This policy allows using it only after slot 155761, for more info see (1). Also make sure that,
cardano-cli address key-hash --payment-verification-key-file payment.skey

is equal to e9ce8633aef95b632bfbffc12a83cc4c589132c46cd03f8dae146ec2.

> **Comments:**
> **username_0**: i changes the script ``` {     "type": "all",     "scripts":     [            {             "type": "after",             "slot": 6702243         },         {             "type": "sig",             "keyHash": "e9ce8633aef95b632bfbffc12a83cc4c589132c46cd03f8dae146ec2"         }           ] }``` and key hash is also the same still same error  
> **username_1**: Hmm, that's weird, I also think I had the slot of preprod wrong (your query is correct).  
> **username_1**: Can you use the `--invalid-after` to make the transaction valid even if it is send before the `after` slot?  
> **username_0**: ``` cardano-cli transaction build \ --alonzo-era \ --testnet-magic 1 \ --tx-in $TXIN \ --tx-out $RECIEVER+1500000+"1 $POLICYID.$TOKENNAME" \ --change-address $MINTER \ --mint "1 $POLICYID.$TOKENNAME" \ --minting-script-file ppbl-nft-2.script \ --invalid-hereafter 6753799 \ --metadata-json-file mynft.json \ --protocol-params-file protocol.json \ --out-file nft.raw```  
> **username_0**: still same error  

---

### Answer by username_2 on 2022-09-09. Score: 0

You're missing the `--invalid-before` flag when building the transaction. It sets the lower bound of the transaction's validity interval, which is required for the script to determine whether the interval range is greater than slot 155761. You must use a slot that is lower than the current slot.


---

