0

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

1 Answer 1

1

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)
1
  • Thanks, I'll try and investigate that
    – simon
    Jan 30, 2022 at 16:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.