PPViewHashesDontMatch Error When Unlocking Funds
Introduction
When attempting to unlock funds on a script using the Mesh SDK, you may encounter the PPViewHashesDontMatch
error. This error occurs when the hashes of the transaction inputs do not match the expected hashes in the transaction view. In this article, we will explore the steps to reproduce this bug, the code that triggers the error, and the expected result.
Summary
The PPViewHashesDontMatch
error occurs when trying to unlock funds on a script using the Mesh SDK. The error happens both in the Preview and Preprod networks. The solution proposed in #398, which involves setting the network using .setNetwork()
, does not work.
Steps to reproduce the bug
To reproduce the bug, follow the tutorial linked above. The tutorial provides a step-by-step guide on how to lock funds on a script and then unlock them. However, when attempting to unlock the funds, you will encounter the PPViewHashesDontMatch
error.
Code that triggers the error
The code that triggers the error is as follows:
const unlockFunds = async () => {
const lockedEUTxO = await provider.fetchUTxOs("eec663e8bc4555bc371be6a2a44bd888f7e4f634b895aceab1db0befe2809893").then(el => el[0]);
// Collaterals will be used to cover fees
const collateral = await wallet.getCollateral().then(res => res[0]);
const unlockFundsTx = await new MeshTxBuilder({
fetcher: provider,
submitter: provider,
verbose: false
})
// Spending purpose
.spendingPlutusScript("V3")
// Added for https://github.com/MeshJS/mesh/issues/398
.setNetwork("preprod")
.txIn(lockedEUTxO.input.txHash, lockedEUTxO.input.outputIndex, lockedEUTxO.output.amount, lockedEUTxO.output.address)
.txInScript(scriptCbor)
.txInRedeemerValue(mConStr0([stringToHex("Hello, World!")]))
.txInDatumValue(mConStr0([publicKeyHash]))
.requiredSignerHash(publicKeyHash)
.changeAddress(walletAddress)
.txInCollateral(collateral.input.txHash, collateral.input.outputIndex, collateral.output.amount, collateral.output.address)
.selectUtxosFrom(utxos)
.complete()
const signedTx = await wallet.signTx(unlockFundsTx);
const txHash = await wallet.submitTx(signedTx);
console.log(`${JSON.stringify(lockedEUTxO.output.amount)} ADA unlocked on the script address ${scriptAddress} by transaction with hash ${txHash}`);
}
Actual Result
The above code throws the PPViewHashesDontMatch
error. This error occurs both in the Preview and Preprod networks, and the solution proposed in #398 does not work.
Expected Result
The funds should be correctly unlocked.
SDK version
The SDK version used is 1.9.0-beta.18.
Environment type
The environment type is Node.js.
Environment details
The environment details are as follows:
- Node v20.17.0
Troubleshooting
To troubleshoot the issue, you can try the following:
- Check the network settings: Ensure that the network settings are correct and that the
setNetwork()
method is used correctly. - Verify the transaction inputs: Check that the transaction inputs are correct and that the hashes match the expected hashes.
- Check the script: Verify that the script is correct and that it is not causing the issue.
- Check the wallet: Ensure that the wallet is correctly configured and that it is not causing the issue.
Introduction
In our previous article, we explored the PPViewHashesDontMatch
error that occurs when attempting to unlock funds on a script using the Mesh SDK. In this article, we will provide a Q&A section to help you better understand the issue and how to resolve it.
Q: What is the PPViewHashesDontMatch
error?
A: The PPViewHashesDontMatch
error occurs when the hashes of the transaction inputs do not match the expected hashes in the transaction view.
Q: Why does the PPViewHashesDontMatch
error occur?
A: The PPViewHashesDontMatch
error can occur due to a variety of reasons, including:
- Incorrect network settings
- Incorrect transaction inputs
- Incorrect script
- Incorrect wallet configuration
Q: How can I troubleshoot the PPViewHashesDontMatch
error?
A: To troubleshoot the PPViewHashesDontMatch
error, you can try the following:
- Check the network settings: Ensure that the network settings are correct and that the
setNetwork()
method is used correctly. - Verify the transaction inputs: Check that the transaction inputs are correct and that the hashes match the expected hashes.
- Check the script: Verify that the script is correct and that it is not causing the issue.
- Check the wallet: Ensure that the wallet is correctly configured and that it is not causing the issue.
Q: What is the solution to the PPViewHashesDontMatch
error?
A: The solution to the PPViewHashesDontMatch
error depends on the root cause of the issue. However, some common solutions include:
- Correcting the network settings
- Correcting the transaction inputs
- Correcting the script
- Correcting the wallet configuration
Q: How can I prevent the PPViewHashesDontMatch
error from occurring?
A: To prevent the PPViewHashesDontMatch
error from occurring, you can follow these best practices:
- Always verify the network settings before attempting to unlock funds.
- Always verify the transaction inputs before attempting to unlock funds.
- Always verify the script before attempting to unlock funds.
- Always verify the wallet configuration before attempting to unlock funds.
Q: What are some common mistakes that can cause the PPViewHashesDontMatch
error?
A: Some common mistakes that can cause the PPViewHashesDontMatch
error include:
- Incorrectly setting the network
- Incorrectly specifying the transaction inputs
- Incorrectly specifying the script
- Incorrectly configuring the wallet
Q: How can I get help if I am experiencing the PPViewHashesDontMatch
error?
A: If you are experiencing the PPViewHashesDontMatch
error, you can try the following:
- Check the official Mesh documentation for troubleshooting guides.
- Check the official Mesh community forums for support.
- Reach out to the Mesh support team for assistance.
By following these Q&A guidelines, you should be able to better understand the PPViewHashesDontMatch
error and how to resolve it.