I create a transaction with this command:
cardano-cli latest transaction build \
--testnet-magic 2 \
--out-file "$tx_unsigned_name" \
--tx-in "$nft_utxo" \
--tx-in-datum-file data.json \
--tx-in-redeemer-file redeemer.json \
--tx-in-script-file contract_code.txt \
--tx-in $utxo \
--tx-in-collateral $collateral_utxo \
--change-address "$wallet_address" \
--tx-out "$(cat contract_address.txt)+${nft}" \
--tx-out-datum-hash-file data_new.json \
--invalid-hereafter $deadline
and expect that the ctx.transaction.datums
has an entry (h, d)
where h
is hash of data_new.json
and d
is the data from that file. But I printed the dict and it contains only the data from data.json
file.
Here is the line from plutus-pioneer-program code that searches the datums
entry for the output data so I thought that should work.
The question is, how can I access the output data from the contract script?
Update:
Plutonomicon says:
The datums for the inputs are always contained in txInfoData. Anything else may not be present. If you in your script depend on the datum for an output being available, you must make sure when submitting the transaction that you include the datum in txInfoData.
So, how can I include the datum to txIinfoData
? One possibility is to use some additional input, but is there more straightforward solution?
--tx-out-datum-embed-file
instead of--tx-out-datum-hash-file
. I can not check this right now