<p>Mesh version 1.5.1 just got deployed to npm with the updated cost models for Plutus V2. Have a nice day and happy coding!!</p>

CC BY-SA 4.0
2023-02-22T10:04:41.507Z
2023-02-22T10:04:41.507Z
abdelkrimdev
<p>The preprod env was upgraded this weekend and there were cost model updates for the upcoming release.  Blockfrost wasn't in synch for with the latest cost model so you would get that error.  This issue has been fixed and should be working now in preprod.</p>

CC BY-SA 4.0
2023-02-14T21:17:38.753Z
I waited a few days, updated Mesh to 1.5.0, tested with sending native assets and ADA only, tested with Blockfrost and Koios, tested with Nami and Eternl, and still getting the same error.
Jelil Akjaly
CC BY-SA 4.0
2023-02-15T00:34:50.563Z
Well, there is still (most likely) a mismatch between the network protocol parameter file used during transaction construction and what is then submitted to blockfrost.   I am not too familiar with Mesh, but you need to find out what network parameter file is being used when you build the transaction.  Are you using Demeter Run for your dev env.  They should have everything setup and ready to go.
lley154
CC BY-SA 4.0
2023-02-22T12:46:55.350Z
Hi @lley154, the problem was due to the changes in the cost model, this changes was not broadcasted to the community. Or is it? If it is, how can I get subscribe to such update?
Jingles
CC BY-SA 4.0
2023-02-25T00:10:41.657Z
I started noticing a simliar issue on the Helios discord and I suspected it was a protocol parmeter mismtach (eg the cost mode), and then Gavin posted this to IOG techincal discord and one of the SPOs confirmed the change was done on preprod and Gavin confirmed the cost model had changed.  Perhaps IOG can post something in IOG technical discord when a hard fork on preprod occurs, but I suspect there is a SPO discord channel that would broadcast this info as well.  https://discord.com/channels/826816523368005654/826829805387120690/1074254823261745242
lley154
CC BY-SA 4.0
2023-02-13T02:49:51.487Z
2023-02-13T02:49:51.487Z
lley154
<p>This is my setup code.</p>
<pre><code>const wallet = await BrowserWallet.enable('Nami');

// this script always succeeds regardless of the datum or redeemer
const script: PlutusScript = {
  code: '59079559079201...0122212200201',
  version: 'V2',
};

const scriptAddress = resolvePlutusScriptAddress(script, 0);

const myAddress = await wallet.getChangeAddress();

const myDatum: Data = {
  alternative: 0,
  fields: [42]
}

const myRedeemer = {
  data: {
    alternative: 0,
    fields: [21]
  }
}
</code></pre>
<p>I lock the funds in the script address using the function below and it works.</p>
<pre><code>async function lock(ada: string) {
  
  const tx = new Transaction({ initiator: wallet })
    .sendLovelace(
      {
        address: scriptAddress,
        datum: {
          value: myDatum,
        }
      },
      ada + '000000'
    )

  try {
    const unsignedTx = await tx.build();
    const signedTx = await wallet.signTx(unsignedTx);
    const txHash = await wallet.submitTx(signedTx);
  } catch (err) {
    console.log(err.message);
  }
}
</code></pre>
<p>I have a helper function for getting asset utxos from the blockchain.</p>
<pre><code>sync function _getAssetUtxo({ scriptAddress, datum, amount }) {

  try {

    //const koios = new KoiosProvider('preprod');
    //const utxos = await koios.fetchAddressUTxOs(scriptAddress);

    const blockfrostProvider = new BlockfrostProvider('preprod...Rkbm');
    const utxos = await blockfrostProvider.fetchAddressUTxOs(scriptAddress);

    const dataHash = resolveDataHash(datum);

    let utxo = utxos.find((utxo: UTxO) =&gt; {
      return utxo.output.dataHash == dataHash &amp;&amp; utxo.output.amount[0].quantity == amount;
    });

    return utxo;

  } catch (err) {
    console.log(err);
  }
</code></pre>
<p>This is my function for unlocking the funds from the script address.</p>
<pre><code>async function unlock(ada: string) {

  const assetUtxo = await _getAssetUtxo({
    scriptAddress: scriptAddress,
    datum: myDatum,
    amount: ada + '000000'
  });

  const tx = new Transaction({ initiator: wallet })
    .redeemValue({
      value: assetUtxo,
      script: script,
      datum: myDatum,
      redeemer: myRedeemer
    })
    .setRequiredSigners([myAddress])
    .sendValue(myAddress, assetUtxo)

  try {
    const unsignedTx = await tx.build();
    const signedTx = await wallet.signTx(unsignedTx, true);
    const txHash = await wallet.submitTx(signedTx);
  } catch (err) {
    console.log(err.message);
  }
}
</code></pre>
<p>But when I run the function above, I get the error bellow:</p>
<pre><code>transaction submit error ShelleyTxValidationError ShelleyBasedEraBabbage 
(ApplyTxError [UtxowFailure (FromAlonzoUtxowFail 
(PPViewHashesDontMatch (SJust (SafeHash 
\&quot;6ea33d2943315bf6179393f97af792376fd0c29851831b183c96a395db712337\&quot;)) 
(SJust (SafeHash 
\&quot;ed2dc348e2070315e474c83981b40015d1dec8eaee9704735776e4d6147f7c41\&quot;))))])
</code></pre>
<p>What am I doing wrong?</p>

<smart-contract><mesh><typescript>
"Transaction submit error" while trying to unlock funds from script address using Mesh
# "Transaction submit error" while trying to unlock funds from script address using Mesh

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

This is my setup code.
const wallet = await BrowserWallet.enable('Nami');

// this script always succeeds regardless of the datum or redeemer
const script: PlutusScript = {
  code: '59079559079201...0122212200201',
  version: 'V2',
};

const scriptAddress = resolvePlutusScriptAddress(script, 0);

const myAddress = await wallet.getChangeAddress();

const myDatum: Data = {
  alternative: 0,
  fields: [42]
}

const myRedeemer = {
  data: {
    alternative: 0,
    fields: [21]
  }
}

I lock the funds in the script address using the function below and it works.
async function lock(ada: string) {
  
  const tx = new Transaction({ initiator: wallet })
    .sendLovelace(
      {
        address: scriptAddress,
        datum: {
          value: myDatum,
        }
      },
      ada + '000000'
    )

  try {
    const unsignedTx = await tx.build();
    const signedTx = await wallet.signTx(unsignedTx);
    const txHash = await wallet.submitTx(signedTx);
  } catch (err) {
    console.log(err.message);
  }
}

I have a helper function for getting asset utxos from the blockchain.
sync function _getAssetUtxo({ scriptAddress, datum, amount }) {

  try {

    //const koios = new KoiosProvider('preprod');
    //const utxos = await koios.fetchAddressUTxOs(scriptAddress);

    const blockfrostProvider = new BlockfrostProvider('preprod...Rkbm');
    const utxos = await blockfrostProvider.fetchAddressUTxOs(scriptAddress);

    const dataHash = resolveDataHash(datum);

    let utxo = utxos.find((utxo: UTxO) => {
      return utxo.output.dataHash == dataHash && utxo.output.amount[0].quantity == amount;
    });

    return utxo;

  } catch (err) {
    console.log(err);
  }

This is my function for unlocking the funds from the script address.
async function unlock(ada: string) {

  const assetUtxo = await _getAssetUtxo({
    scriptAddress: scriptAddress,
    datum: myDatum,
    amount: ada + '000000'
  });

  const tx = new Transaction({ initiator: wallet })
    .redeemValue({
      value: assetUtxo,
      script: script,
      datum: myDatum,
      redeemer: myRedeemer
    })
    .setRequiredSigners([myAddress])
    .sendValue(myAddress, assetUtxo)

  try {
    const unsignedTx = await tx.build();
    const signedTx = await wallet.signTx(unsignedTx, true);
    const txHash = await wallet.submitTx(signedTx);
  } catch (err) {
    console.log(err.message);
  }
}

But when I run the function above, I get the error bellow:
transaction submit error ShelleyTxValidationError ShelleyBasedEraBabbage 
(ApplyTxError [UtxowFailure (FromAlonzoUtxowFail 
(PPViewHashesDontMatch (SJust (SafeHash 
\"6ea33d2943315bf6179393f97af792376fd0c29851831b183c96a395db712337\")) 
(SJust (SafeHash 
\"ed2dc348e2070315e474c83981b40015d1dec8eaee9704735776e4d6147f7c41\"))))])

What am I doing wrong?

**Tags:** smart-contract, mesh, typescript

---

## 2 answers

### Answer by username_1 on 2023-02-22. Score: 2 | Accepted answer

Mesh version 1.5.1 just got deployed to npm with the updated cost models for Plutus V2. Have a nice day and happy coding!!


---

### Answer by username_2 on 2023-02-13. Score: 1

The preprod env was upgraded this weekend and there were cost model updates for the upcoming release. Blockfrost wasn't in synch for with the latest cost model so you would get that error. This issue has been fixed and should be working now in preprod.

> **Comments:**
> **username_0**: I waited a few days, updated Mesh to 1.5.0, tested with sending native assets and ADA only, tested with Blockfrost and Koios, tested with Nami and Eternl, and still getting the same error.  
> **username_2**: Well, there is still (most likely) a mismatch between the network protocol parameter file used during transaction construction and what is then submitted to blockfrost.   I am not too familiar with Mesh, but you need to find out what network parameter file is being used when you build the transaction.  Are you using Demeter Run for your dev env.  They should have everything setup and ready to go.  
> **username_3**: Hi @lley154, the problem was due to the changes in the cost model, this changes was not broadcasted to the community. Or is it? If it is, how can I get subscribe to such update?  
> **username_2**: I started noticing a simliar issue on the Helios discord and I suspected it was a protocol parmeter mismtach (eg the cost mode), and then Gavin posted this to IOG techincal discord and one of the SPOs confirmed the change was done on preprod and Gavin confirmed the cost model had changed.  Perhaps IOG can post something in IOG technical discord when a hard fork on preprod occurs, but I suspect there is a SPO discord channel that would broadcast this info as well.  https://discord.com/channels/826816523368005654/826829805387120690/1074254823261745242  

---

