2

I call the martify smart contract by cardano-cli but I've seen the error Command failed: transaction build Error: The following scripts have execution failures: the script for transaction input 1 (in the order of the TxIds) failed with: The redeemer pointer: RdmrPtr Spend 1 points to a Plutus script that does not exist. The pointers that can be resolved are:

fromList [(RdmrPtr Spend 1,(Spending (TxIn (TxId {_unTxId = SafeHash "c502c6f0929e9eb7562097592a71d9e4aaae01033c7c5cb685c2103c9fee070c"}) (TxIx 1)),Nothing,ScriptHash "74d2a2a31173aad514c66551190f4ca4d6eedcdd71776a04ba263de5"))]

The command of building the transaction:

cardano-cli transaction build \
    --testnet-magic 1 \
    --tx-in c1ca2d6e65360e2acc78485ea93803e6119af1864872ff8cbdd6fcdf2044d7e5#0 \
    --tx-in-collateral c1ca2d6e65360e2acc78485ea93803e6119af1864872ff8cbdd6fcdf2044d7e5#0 \
    --tx-in c502c6f0929e9eb7562097592a71d9e4aaae01033c7c5cb685c2103c9fee070c#1 \
    --tx-in-script-file marketplace.plutus \
    --tx-in-datum-file datum.json \
    --tx-in-redeemer-file buy.json \
    --required-signer ./../../common/payment3.skey \
    --tx-out "$(cat ./../../common/payment3.addr) + 9982422778 + 1 d8375cb8ece93f752c57981c7978a6b3f9e06cee44c464dd3b7b7d2b.53706f7265734e46545f33" \
    --tx-out "$(cat script.addr) + 2000000" \
    --tx-out "$(cat ./../../common/payment4.addr) + 6000000" \
    --change-address $(cat ./../../common/payment3.addr) \
    --protocol-params-file testnet-protocol-parameters.json \
    --out-file buy.draft

Which: the payment3.addr is the buyer, the payment4.addr is the seller, and script.addr is the marketplace.

1
  • Two questions: 1) What's the datum-hash of datum.json ? (output of cardano-cli transaction hash-script-data --script-data-file datum.json ) 2) I assume this is the address on which your contract is: addr_test1wp6d9g4rz9e644g5cej4zxg0fjjddmkum4chw6syhgnrmegk8l8yj (correct me if wrong)
    – wmoco_6725
    Commented Nov 24, 2022 at 10:16

1 Answer 1

1

The PT5 error exhibit the validator func return the error code in Onchain.hs file. So I put wrong pkh code in datum. By set correct value on datum, and its work.

Here is the code I used for making transaction via cardano-cli:

# Hash the datum

cardano-cli transaction hash-script-data --script-data-file datum.json >> dhash

# PUT ON SALE

cardano-cli transaction build \
    --alonzo-era \
    --testnet-magic 1 \
    --tx-in 8b076a7b96a24af1aec65213a45636b1e45c6acfe62e368f29e6e5119e368091#1 \
    --tx-out "$(cat script.addr) + 1800000 lovelace + 1 33700cf3c3d4aa6c84d9fd8a506c6c5482e4249abe78e37829913caa.53706f7265734e46545f33" \
    --tx-out-datum-hash $(cat dhash) \
    --change-address addr_test1vqquurd5cglaqfnnusnsfy3w0u6r20hpa4hf9x75evnmhxgwcrdas \
    --protocol-params-file testnet-protocol-parameters.json \
    --out-file tx.02 

cardano-cli transaction sign \
    --tx-body-file tx.02 \
    --signing-key-file ./../../common/payment4.skey \
    --testnet-magic 1 \
    --out-file tx-2.02

cardano-cli transaction submit --tx-file tx-2.02 --testnet-magic 1

# BUY NFT

cardano-cli transaction build \
    --babbage-era \
    --testnet-magic 1 \
    --tx-in c1ca2d6e65360e2acc78485ea93803e6119af1864872ff8cbdd6fcdf2044d7e5#0 \
    --tx-in-collateral c1ca2d6e65360e2acc78485ea93803e6119af1864872ff8cbdd6fcdf2044d7e5#0 \
    --tx-in f2134f93278707a37a1ef03abac76e7fc38dd9796c1143f25953448efbd3fdca#1 \
    --tx-in-script-file marketplace.plutus \
    --tx-in-datum-file datum.json \
    --tx-in-redeemer-file buy.json \
    --tx-out "$(cat ./../../common/payment3.addr) + 9982422778 + 1 33700cf3c3d4aa6c84d9fd8a506c6c5482e4249abe78e37829913caa.53706f7265734e46545f33" \
    --tx-out "$(cat ./../../common/payment4.addr) + 6000000" \
    --required-signer ./../../common/payment3.skey \
    --change-address $(cat ./../../common/payment3.addr) \
    --protocol-params-file testnet-protocol-parameters.json \
    --out-file tx.04

cardano-cli transaction sign \
    --tx-body-file tx.04 \
    --signing-key-file ./../../common/payment3.skey \
    --testnet-magic 1 \
    --out-file tx-2.04

cardano-cli transaction submit --tx-file tx-2.04 --testnet-magic 1

Link to check on preprod cardanoscan: https://preprod.cardanoscan.io/address/6001ce0db4c23fd02673e42704922e7f34353ee1ed6e929bd4cb27bb99

Your Answer

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

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