CLI Transaction Error

I am using the following commands

cardano-cli transaction build \
    --testnet-magic 1 \
    --tx-in 707d19ab31fb18bd28c8662196ef68aa2d2c1913f0a4f9daee14161ba2f91f70#0 \
    --tx-out addr_test1vpt0hgdhy05axv6myrg62pefzfa273a0m65a328fpwehufqzjzu9v+2000000+"10000000 2472f072433f575dcc3a701e69451738e792823748687f5b1ff9fa2d.898d656372e37e9768672bbe833fa032" \
    --tx-out addr_test1qzp3swy8at73yh8myqp0jal2p9na7dae30wvv4gq0972auq4gcgwxzupnzp90lych2a3lp2dlv7njyqntuyy07vn6m0q0mr7rm+999920 \
    --change-address addr_test1qzp3swy8at73yh8myqp0jal2p9na7dae30wvv4gq0972auq4gcgwxzupnzp90lych2a3lp2dlv7njyqntuyy07vn6m0q0mr7rm \
    --mint "10000000 2472f072433f575dcc3a701e69451738e792823748687f5b1ff9fa2d.898d656372e37e9768672bbe833fa032" \
    --minting-script-file ./token_account/policy/policy.script \
    --metadata-json-file ./tempMetadata.json \
    --invalid-hereafter 22028321 \
    --out-file ./token_account/tx/matx.raw
cardano-cli transaction sign \
    --signing-key-file ./token_account/keys/payment.skey \
    --signing-key-file ./token_account/policy/policy.skey \
    --testnet-magic 1 \
    --tx-body-file ./token_account/tx/matx.raw \
    --out-file ./token_account/tx/matx.signed

cardano-cli transaction submit --tx-file ./token_account/tx/matx.signed --testnet-magic 1

But when I submit the transaction, I get the following error, what am I doing wrong?

Command failed: transaction submit Error: Error while submitting tx: ShelleyTxValidationError ShelleyBasedEraBabbage (ApplyTxError [UtxowFailure (FromAlonzoUtxowFail (WrappedShelleyEraFailure (ScriptWitnessNotValidatingUTXOW (fromList [ScriptHash "2472f072433f575dcc3a701e69451738e792823748687f5b1ff9fa2d"])))),UtxowFailure (UtxoFailure (FromAlonzoUtxoFail (FeeTooSmallUTxO (Coin 194233) (Coin 189965))))])

Your transaction build command probably needs a --witness-override 2 option, since you are signing with two keys, cardano-cli cannot necessarily know that at that point and calculates the fee for one signature (for the one input given), and more witnesses make the transaction larger and more expensive.

The script hash is the one of your minting script. Last time, it was an --invalid-hereafter mismatch. Without the contents of policy.script, it’s hard to tell, what it might be this time.

Ok I have added the witness override flag and I am getting this error

Command failed: transaction submit Error: Error while submitting tx: ShelleyTxValidationError ShelleyBasedEraBabbage (ApplyTxError [UtxowFailure (FromAlonzoUtxowFail (WrappedShelleyEraFailure (ScriptWitnessNotValidatingUTXOW (fromList [ScriptHash "2472f072433f575dcc3a701e69451738e792823748687f5b1ff9fa2d"]))))])

This is the policy script as well

{"type":"all","scripts":[{"type":"before","slot":21065074},{"type":"sig","keyHash":"dd863c75a482a21096dc65fbd54b94ec99c1a5XXXXXXXX"}]}

I think this is your problem: --invalid-hereafter has to be equal or less than the time lock given in the policy. (So that the --invalid-hereafter guarantees the requirement of the script.)

Yeah I removed the time lock element of the script and it worked. Thanks for your help. Do you know if there’s a place I can submit my smart contract to to get reviewed please?