<p>Finally I got it and resolved. As I was locking lovelace in a script following the locking of assets. So i didnt made one change according to lovelace. So here is my modified function</p>
<pre><code>  const assets = [
    {
      unit: &quot;lovelace&quot;,
      quantity: 1000000,
    },
  ];  
  
  const assetUTXO = await _getAssetUTXO ({
    scriptAddress: myScriptAddress,
    asset: assets[0].unit,
    datum: 0,
  });
  console.log(&quot;asset UTXO = &quot;, assetUTXO);
  
  const myRedeemer: Partial&lt;Action&gt; = {
    data: 42,
  };
  const tx =  new Transaction ({initiator:wallet})
    .redeemValue({
      value: assetUTXO,
      script:myScript,
      datum: 0 , 
      redeemer: myRedeemer,
})
    .sendValue(myAddress, assetUTXO)      
    
  const unsignedTx = await tx.build();
  const signedTx = await wallet.signTx(unsignedTx, true);
  const txHash = await wallet.submitTx(signedTx);  
  console.log (&quot;txHash of unlocking= &quot;, txHash);
} 
</code></pre>

CC BY-SA 4.0
2023-02-03T11:39:20.120Z
2023-02-03T11:39:20.120Z
duaa azhar
<p>I am getting this error on transaction submission.
<code>&quot;&quot;transaction submit error ShelleyTxValidationError ShelleyBasedEraBabbage (ApplyTxError [UtxowFailure (UtxoFailure (FromAlonzoUtxoFail (UtxosFailure (ValidationTagMismatch (IsValid True) (FailedUnexpectedly (PlutusFailure \&quot;\\nThe 3 arg plutus script (PlutusScript PlutusV1 ScriptHash \\\&quot;ae7b1ca9255aa4000270f38e5ee7d75b0af4955866123b5d794b54f0\\\&quot;) fails.\\nCekError An error has occurred:  User error:\\nThe machine terminated because of an error, either from a built-in function or from an explicit use of 'error'.\\nThe protocol version is: ProtVer {pvMajor = 8, pvMinor = 0}\\nThe data is: I 0\\nThe redeemer is: Constr 0 []\\nThe context is:\\nPurpose: Spending (TxOutRef {txOutRefId = bac7a90f9efc79aa7af175d119bb55140423cea4f6b7c72f3141b96ccbc7e31c, txOutRefIdx = 0})\\nTxInfo:\\n  TxId: 2af255afcb495512d1aa502ae7c985f97c1e66ad97328c8d8db9555936b9839b\\n  Inputs: [ bac7a90f9efc79aa7af175d119bb55140423cea4f6b7c72f3141b96ccbc7e31c!0 -&gt; - Value (Map [(,Map [(\\\&quot;\\\&quot;,1000000)])]) addressed to\\n                                                                                    ScriptCredential: ae7b1ca9255aa4000270f38e5ee7d75b0af4955866123b5d794b54f0 (no staking credential)\\n          , bac7a90f9efc79aa7af175d119bb55140423cea4f6b7c72f3141b96ccbc7e31c!1 -&gt; - Value (Map [(,Map [(\\\&quot;\\\&quot;,9993127795)]),(65b00f2037ae0e74172da23589a121a34861bfe51d4c436a21483cf5,Map [(\\\&quot;myNFT2\\\&quot;,1)])]) addressed to\\n                                                                                    PubKeyCredential: d38f63fe3306e5f63e0e29691f50b0357e2f6d56ab18bfbd9a97bc2f (StakingHash PubKeyCredential: e53568cb1de2a784ad8c67d3273057c714472528dd27b09cc7687b26) ]\\n  Outputs: [ - Value (Map [(,Map [(\\\&quot;\\\&quot;,1000000)])]) addressed to\\n               PubKeyCredential: d38f63fe3306e5f63e0e29691f50b0357e2f6d56ab18bfbd9a97bc2f (StakingHash PubKeyCredential: e53568cb1de2a784ad8c67d3273057c714472528dd27b09cc7687b26)\\n           , - Value (Map [(,Map [(\\\&quot;\\\&quot;,9992327046)]), </code>
-&gt; Just cut the half error as it full of numbers and unreadable.
My plutus script onchain has validation of we can unlock from the script by giving the redeemer 42. I am using mesh library to write the offchain code. My unlock function is here</p>
<pre><code>  const utxos= await blockfrost.fetchAddressUTxOs (
    scriptAddress
  );
  const dataHash = resolveDataHash(datum);
  let utxo = utxos.find ((utxo:any)=&gt;{
    return utxo.output.dataHash == dataHash;
  });

  return utxo;
}

async function unLock() {
  const assetUTXO = await _getAssetUTXO ({
    scriptAddress: scriptAddr,
    datum: 0,
  });

  const tx =  new Transaction ({initiator:wallet})
    .redeemValue({
      value: assetUTXO,
      script:fortyTwoScript,
      datum: 0 , 
      redeemer: 42,
})
    .sendValue(myAddress, assetUTXO)
    .setRequiredSigners([myAddress]);
      
    
  const unsignedTx = await tx.build();
  const signedTx = await wallet.signTx(unsignedTx, true);
  const txHash = await wallet.submitTx(signedTx);  
  console.log (&quot;txHash of unlocking= &quot;, txHash);
}
</code></pre>
<p>I was wondering that may be there is an issue in my script, but i have tested my script by locking and unlocking ADA with cardano cli. And it all went good.
<strong>Please guide me with this error, I am stuck on this</strong></p>

<plutus><cardano-cli><smart-contract><offchain><mesh>
How to resolve this "(FromAlonzoUtxoFail (UtxosFailure (ValidationTagMismatch (IsValid True)" transaction submission error on mesh library
# How to resolve this "(FromAlonzoUtxoFail (UtxosFailure (ValidationTagMismatch (IsValid True)" transaction submission error on mesh library

(Asked by: username_0 on 2023-02-02)

I am getting this error on transaction submission.
""transaction submit error ShelleyTxValidationError ShelleyBasedEraBabbage (ApplyTxError [UtxowFailure (UtxoFailure (FromAlonzoUtxoFail (UtxosFailure (ValidationTagMismatch (IsValid True) (FailedUnexpectedly (PlutusFailure \"\\nThe 3 arg plutus script (PlutusScript PlutusV1 ScriptHash \\\"ae7b1ca9255aa4000270f38e5ee7d75b0af4955866123b5d794b54f0\\\") fails.\\nCekError An error has occurred:  User error:\\nThe machine terminated because of an error, either from a built-in function or from an explicit use of 'error'.\\nThe protocol version is: ProtVer {pvMajor = 8, pvMinor = 0}\\nThe data is: I 0\\nThe redeemer is: Constr 0 []\\nThe context is:\\nPurpose: Spending (TxOutRef {txOutRefId = bac7a90f9efc79aa7af175d119bb55140423cea4f6b7c72f3141b96ccbc7e31c, txOutRefIdx = 0})\\nTxInfo:\\n  TxId: 2af255afcb495512d1aa502ae7c985f97c1e66ad97328c8d8db9555936b9839b\\n  Inputs: [ bac7a90f9efc79aa7af175d119bb55140423cea4f6b7c72f3141b96ccbc7e31c!0 -> - Value (Map [(,Map [(\\\"\\\",1000000)])]) addressed to\\n                                                                                    ScriptCredential: ae7b1ca9255aa4000270f38e5ee7d75b0af4955866123b5d794b54f0 (no staking credential)\\n          , bac7a90f9efc79aa7af175d119bb55140423cea4f6b7c72f3141b96ccbc7e31c!1 -> - Value (Map [(,Map [(\\\"\\\",9993127795)]),(65b00f2037ae0e74172da23589a121a34861bfe51d4c436a21483cf5,Map [(\\\"myNFT2\\\",1)])]) addressed to\\n                                                                                    PubKeyCredential: d38f63fe3306e5f63e0e29691f50b0357e2f6d56ab18bfbd9a97bc2f (StakingHash PubKeyCredential: e53568cb1de2a784ad8c67d3273057c714472528dd27b09cc7687b26) ]\\n  Outputs: [ - Value (Map [(,Map [(\\\"\\\",1000000)])]) addressed to\\n               PubKeyCredential: d38f63fe3306e5f63e0e29691f50b0357e2f6d56ab18bfbd9a97bc2f (StakingHash PubKeyCredential: e53568cb1de2a784ad8c67d3273057c714472528dd27b09cc7687b26)\\n           , - Value (Map [(,Map [(\\\"\\\",9992327046)]), 
-> Just cut the half error as it full of numbers and unreadable.
My plutus script onchain has validation of we can unlock from the script by giving the redeemer 42. I am using mesh library to write the offchain code. My unlock function is here
  const utxos= await blockfrost.fetchAddressUTxOs (
    scriptAddress
  );
  const dataHash = resolveDataHash(datum);
  let utxo = utxos.find ((utxo:any)=>{
    return utxo.output.dataHash == dataHash;
  });

  return utxo;
}

async function unLock() {
  const assetUTXO = await _getAssetUTXO ({
    scriptAddress: scriptAddr,
    datum: 0,
  });

  const tx =  new Transaction ({initiator:wallet})
    .redeemValue({
      value: assetUTXO,
      script:fortyTwoScript,
      datum: 0 , 
      redeemer: 42,
})
    .sendValue(myAddress, assetUTXO)
    .setRequiredSigners([myAddress]);
      
    
  const unsignedTx = await tx.build();
  const signedTx = await wallet.signTx(unsignedTx, true);
  const txHash = await wallet.submitTx(signedTx);  
  console.log ("txHash of unlocking= ", txHash);
}

I was wondering that may be there is an issue in my script, but i have tested my script by locking and unlocking ADA with cardano cli. And it all went good.
Please guide me with this error, I am stuck on this

**Tags:** plutus, cardano-cli, smart-contract, offchain, mesh

---

## 1 answers

### Answer by username_0 on 2023-02-03. Score: 1

Finally I got it and resolved. As I was locking lovelace in a script following the locking of assets. So i didnt made one change according to lovelace. So here is my modified function
  const assets = [
    {
      unit: "lovelace",
      quantity: 1000000,
    },
  ];  
  
  const assetUTXO = await _getAssetUTXO ({
    scriptAddress: myScriptAddress,
    asset: assets[0].unit,
    datum: 0,
  });
  console.log("asset UTXO = ", assetUTXO);
  
  const myRedeemer: Partial = {
    data: 42,
  };
  const tx =  new Transaction ({initiator:wallet})
    .redeemValue({
      value: assetUTXO,
      script:myScript,
      datum: 0 , 
      redeemer: myRedeemer,
})
    .sendValue(myAddress, assetUTXO)      
    
  const unsignedTx = await tx.build();
  const signedTx = await wallet.signTx(unsignedTx, true);
  const txHash = await wallet.submitTx(signedTx);  
  console.log ("txHash of unlocking= ", txHash);
}


---

