3

I'm following Plutus Pioneers Program, 4th Cohort.

In the 2nd week we learned the smart contract Gift.hs

-- This validator always succeeds
mkGiftValidator :: BuiltinData -> BuiltinData -> BuiltinData -> ()
mkGiftValidator _ _ _ = ()

and used make-gift.sh and collect-gift.sh scripts for sending/receiving ada to/from Gift.addr script address addr_test1wqag3rt979nep9g2wtdwu8mr4gz6m4kjdpp5zp705km8wys6t2kla

This address has some UTXOs like this one

                           TxHash                                 TxIx        Amount
--------------------------------------------------------------------------------------

0f7262dba9374e8819a2170516a86b70e3857001f9c0dbe82ebaafcac1c3a676     0        1000000000 lovelace + TxOutDatumInline ReferenceTxInsScriptsInlineDatumsInBabbageEra (ScriptDataConstructor 0 [])

which looks correct from the smartcontract's point of view (has TxOutDatumInline, etc), but when I try to send the tx and collect this utxo I get the error

Command failed: transaction submit  Error: Error while submitting tx: ShelleyTxValidationError ShelleyBasedEraBabbage (ApplyTxError [UtxowFailure (FromAlonzoUtxowFail (WrappedShelleyEraFailure (ExtraneousScriptWitnessesUTXOW (fromList [ScriptHash "3a888d65f16790950a72daee1f63aa05add6d268434107cfa5b67712"]))))])

Could someone explain me please why this is happening? Shouldn't the smart contract validator always succeeds?

1
  • I'm using only --tx-in-script-file and having the same error. I noticed that if you include the script of the same smart contract, I'm obliged to reference the script rather than using --tx-in-script-file. I want to be able to use --tx-in-script-file even if the UTXO includes a reference to the same script. Any solution for that?
    – user9410
    Apr 23 at 22:03

1 Answer 1

2

ExtraneousScriptWitnessesUTXOW means the script witness is being included in the txbody when it doesn't need to be because the witness requirement is already satisfied by a reference script.

Either include the script in the txbody OR reference the UTxO where the script has been stored when building a transaction. You are only allowed to do one or the other.

5
  • Thanks for your answer James, but I still don't fully understand... Does this mean that an error was made while creating the transaction 0f7262...c3a676 ? And now there is no way to collect this UTXO from the gift address? Mar 19 at 11:32
  • No. It means the transaction you are currently building is including both. e.g.. with the cli you are using both --tx-in-script-file and --spending-tx-in-reference
    – james
    Mar 20 at 9:13
  • 1
    That output you are spending has both the reference script and the inline datum. So because you need to reference the input for its datum you must also use the reference script and not provide the script file.
    – james
    Mar 20 at 9:25
  • Thanks for your patience James, the solution finally dawned on me :) My mistake was that when I tried to create the UTXO like 0f7262...c3a676, I specified a vesting.plutus as tx-out-reference-script-file, just for testing. But it 'works' (the error ExtraneousScriptWitnessesUTXOW occurs) only with --tx-out-reference-script-file "$assets/gift.plutus". Probably, in the case when the scripts do not match each other, the offchain validation does not start at all Mar 23 at 10:52
  • Unfortunately I can't mark your answer as correct, because It requires 15 reputation at least, but you've helped me a lot. Thank you very much! Mar 23 at 10:56

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.