user2868: I am trying to run a few examples of deploying a smart contract to testnet using the cardano-cli. I am running version 1.33.0 for both the cardano-cli and cardano-node. The example I am using is from https://github.com/input-output-hk/cardano-node/tree/master/plutus-example (plutus-example).
I can successfully transfer tADA to the script addresses. However, I cannot unlock the funds that are locked at the script addresses. The error message is below - from the little that I find on internet, it looks like an issue with the redeemer, but I can't figure out how to correct. Can anybody help? My understanding is that both datum and redeemer must both equal a specific value for validation to work (I changed 42 to 1970).
Error message (for cardano-node/plutus-example) ->
Command failed: transaction build  Error: The following scripts have execution failures: the script for transaction input 0 (in the order of the TxIds) failed with:  The Plutus script evaluation failed: An error has occurred:  User error: The provided Plutus code called 'error'. Caused by: [ (builtin unConstrData) (con data #1907b2) ] Script debugging logs:
Code for plutus-example.hs and CustomDatumRedeemerGuess.hs are only slightly modified compared to the repo (no change in logic, only in some file naming).
The cardano-cli commands I use are as follows ->
cardano-cli address build 
--payment-script-file custom.plutus 
--$testnet 
--out-file custom-script.addr
cardano-cli transaction hash-script-data --script-data-value 1970
export scriptdatumhash=7619130e301e1b52e1c333c96d8489fba07ea98eeec3327f719a03d2c713302f
cardano-cli query protocol-parameters --$testnet --out-file protocol.json
cardano-cli transaction build 
--alonzo-era 
--$testnet 
--change-address $address1 
--tx-in 4c7c3e12d3ed18241520a8c95a7f68855a1e17af933e207918f65a66bd02c49e#0 
--tx-out $(cat custom-script.addr)+10000000 
--tx-out-datum-hash $scriptdatumhash 
--protocol-params-file protocol.json 
--out-file tx-script.build
cardano-cli transaction sign 
--tx-body-file tx-script.build 
--signing-key-file ../nft/payment.skey 
--$testnet 
--out-file tx-script.signed
cardano-cli transaction submit --$testnet --tx-file tx-script.signed
Up until here, everything works great and I can transfer funds to the script address.
However, running the following transaction build command fails with the error message above ->
cardano-cli transaction build 
--alonzo-era 
--$testnet 
--tx-in 29f0adfb6ff1ba9b4cb9117b3678cf84532314a1b82a29a6991dfcc38e37d4c6#1 
--tx-in-script-file custom.plutus 
--tx-in-datum-value 1970 
--tx-in-redeemer-value 1970 
--tx-in-collateral 29f0adfb6ff1ba9b4cb9117b3678cf84532314a1b82a29a6991dfcc38e37d4c6#0 
--change-address $address3 
--protocol-params-file protocol.json 
--out-file test-alonzo.tx
Can anyone help me? Thanks in advance, Simon

user5556: The error output points to error in the actual script. It seems the BuiltIn data is unreadable:
The Plutus script evaluation failed: An error has occurred:  User error: 
The provided Plutus code called 'error'. Caused by: [ (builtin 
unConstrData) (con data #1907b2)


2868: <p>I am trying to run a few examples of deploying a smart contract to testnet using the cardano-cli. I am running version 1.33.0 for both the cardano-cli and cardano-node. The example I am using is from <a href="https://github.com/input-output-hk/cardano-node/tree/master/plutus-example" rel="nofollow noreferrer">https://github.com/input-output-hk/cardano-node/tree/master/plutus-example</a> (plutus-example).</p>
<p>I can successfully transfer tADA to the script addresses. However, I cannot unlock the funds that are locked at the script addresses. The error message is below - from the little that I find on internet, it looks like an issue with the redeemer, but I can't figure out how to correct. Can anybody help? My understanding is that both datum and redeemer must both equal a specific value for validation to work (I changed 42 to 1970).</p>
<p>Error message (for <code>cardano-node/plutus-example</code>) -&gt;
<code>Command failed: transaction build  Error: The following scripts have execution failures: the script for transaction input 0 (in the order of the TxIds) failed with:  The Plutus script evaluation failed: An error has occurred:  User error: The provided Plutus code called 'error'. Caused by: [ (builtin unConstrData) (con data #1907b2) ] Script debugging logs:</code></p>
<p>Code for <code>plutus-example.hs</code> and <code>CustomDatumRedeemerGuess.hs</code> are only slightly modified compared to the repo (no change in logic, only in some file naming).</p>
<p>The <code>cardano-cli</code> commands I use are as follows -&gt;</p>
<p>cardano-cli address build <br />
--payment-script-file custom.plutus <br />
--$testnet <br />
--out-file custom-script.addr</p>
<p>cardano-cli transaction hash-script-data --script-data-value 1970
export scriptdatumhash=7619130e301e1b52e1c333c96d8489fba07ea98eeec3327f719a03d2c713302f</p>
<p>cardano-cli query protocol-parameters --$testnet --out-file protocol.json</p>
<p>cardano-cli transaction build <br />
--alonzo-era <br />
--$testnet <br />
--change-address $address1 <br />
--tx-in 4c7c3e12d3ed18241520a8c95a7f68855a1e17af933e207918f65a66bd02c49e#0 <br />
--tx-out $(cat custom-script.addr)+10000000 <br />
--tx-out-datum-hash $scriptdatumhash <br />
--protocol-params-file protocol.json <br />
--out-file tx-script.build</p>
<p>cardano-cli transaction sign <br />
--tx-body-file tx-script.build <br />
--signing-key-file ../nft/payment.skey <br />
--$testnet <br />
--out-file tx-script.signed</p>
<p>cardano-cli transaction submit --$testnet --tx-file tx-script.signed</p>
<p>Up until here, everything works great and I can transfer funds to the script address.</p>
<p>However, running the following transaction build command fails with the error message above -&gt;</p>
<p>cardano-cli transaction build <br />
--alonzo-era <br />
--$testnet <br />
--tx-in 29f0adfb6ff1ba9b4cb9117b3678cf84532314a1b82a29a6991dfcc38e37d4c6#1 <br />
--tx-in-script-file custom.plutus <br />
--tx-in-datum-value 1970 <br />
--tx-in-redeemer-value 1970 <br />
--tx-in-collateral 29f0adfb6ff1ba9b4cb9117b3678cf84532314a1b82a29a6991dfcc38e37d4c6#0 <br />
--change-address $address3 <br />
--protocol-params-file protocol.json <br />
--out-file test-alonzo.tx</p>
<p>Can anyone help me? Thanks in advance, Simon</p>
 5556: <p>The error output points to error in the actual script. It seems the BuiltIn data is unreadable:</p>
<pre><code>The Plutus script evaluation failed: An error has occurred:  User error: 
The provided Plutus code called 'error'. Caused by: [ (builtin 
unConstrData) (con data #1907b2)
</code></pre>
