1

I'm trying to consume a UTxO from a script address. When querying the script address with cardano-cli query utxo, I have the following UTxO:

                           TxHash                                 TxIx        Amount
--------------------------------------------------------------------------------------
10668bed901733bb0977ec72d1abad481865b34ea1c18302caaaa1eafe5784d2     1        1344798 lovelace + TxOutDatumNone

However, when constructing a transaction, I do not know how to represent TxOutDatumNone:

cardano-cli transaction build \
--alonzo-era \
...
--tx-in 10668bed901733bb0977ec72d1abad481865b34ea1c18302caaaa1eafe5784d2#1 \
--tx-in-datum-value WHAT_TO_PUT_HERE \
...

What I've tried:

  • Not passing the --tx-in-datum-value altogether results in:

Missing: (--tx-in-datum-file FILE | --tx-in-datum-value JSON VALUE)

  • Passing --tx-in-datum-value 0 results in:

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 witness for the txin does not have a script datum (according to the UTxO). The txin in question is 10668bed901733bb0977ec72d1abad481865b34ea1c18302caaaa1eafe5784d2#1

  • Passing --tx-in-datum-value null results in:

option --tx-in-datum-value: JSON schema error within the script data: null JSON null values are not supported.

3 Answers 3

3

I'm afraid that presenting a "none" datum is not possible. This also means that this UtxO is lost (anybody, correct me if I'm wrong)

I don't know the very reason why it is possible to send a UtxO at a script address without datum hash, while at the same time it will not be possible to get it back. Anyway, pay attention to always send a datum hash when sending some value at a script address.

3
  • I'm leaning to think that's the case as well. But haven't been able to find a definite reference yet. Jan 10, 2022 at 15:15
  • 1
    Found a confirmation to the statement here: github.com/input-output-hk/Alonzo-testnet/blob/… Jan 12, 2022 at 16:54
  • The reason for this is that in addition to Plutus scripts, there are also native scripts (which predate Plutus), and those don't require a datum. It's impossible to know, given just an address, whether a script address corresponds to a Plutus script or to a native script. Therefore the node can't enforce that UTxO's at Plutus script addresses always have a datum attached. Mar 7 at 17:57
0

Usually when you want to pass empty datum to the script you'd pass an empty list like so

--tx-in-datum-value []
1
  • This gives me a similar error as passing 0: 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 witness for the txin does not have a script datum (according to the UTxO). The txin in question is 10668bed901733bb0977ec72d1abad481865b34ea1c18302caaaa1eafe5784d2#1 Jan 10, 2022 at 15:10
0

You can ignore it. You do not need to account for TxOutDatumNone in your tx-out or anywhere else. See for yourself by manually sending a TX using cli before you script it.

3
  • Do you mean not to pass the --tx-in-datum-value option to the cardano-cli transaction build command? Or did you have something else in mind? Jan 10, 2022 at 15:14
  • Correct. It's not a required parameter, so if you aren't using it (which it doesn't sound like you are), then ignore it..? EDIT: I see now that you say you've tried this and are getting an error which baffles me - I send hundreds of CLI transactions a day and have never seen that error come up. Are you able to provide your draft cli command TX?
    – Tygar Pool
    Jan 10, 2022 at 15:34
  • Correct that I'm not using the datum. It seems to me that either of the datum options still has to be specified because the transaction is consuming a UTxO from a Plutus script address. The full command and accompanying script can be found at: gist.github.com/discosultan/c03a1ea29d8b3bec8b2825c8fd879afa Jan 10, 2022 at 15:53

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.