0

I noticed that TxInfo datatype has a txInfoData field which carries a list of mappings from datum hashes to datum values. This seems very useful for validating transactions with multiple input UTxO's.

Where and how is this list provided while creating a transaction?

2 Answers 2

1

There are at least two reasons for that field to be a list:

  • A transaction may spend UTxO's from multiple script addresses,
  • The datum value for a transaction output can optionally be provided.

Using cardano-cli transaction build, we can provide a datum value for each input UTxO with --tx-in-datum-file (or --tx-in-datum-value). And also, for each output UTxO we can provide a datum value with --tx-out-datum-embed-file (or --tx-out-datum-embed-value).

1
  • With the upcoming Babbage era the flag --tx-out-inline-datum-file and --tx-out-inline-datum-value will also be available.
    – Fermat
    Jul 4, 2022 at 11:50
0

TxInfoData can be obtained via the ScriptContext that is included as part of every transaction. The list of datum and datum hashes is created when the transaction is submitted and made available to the plutus script. Here are the relevant plutus docs https://playground.plutus.iohkdev.io/doc/haddock/plutus-ledger-api/html/Plutus-V1-Ledger-Contexts.html Hope this helps.

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.