Description
Internal/External
External
Area
Plutus
Describe the feature you'd like
At the moment, it does not seem possible to pass additional data in the form of a correspondance between a datum hash and a datum in a transaction body, in addition to the one collected from the script witnesses in inputs, and the outputs of the body.
However, when referencing a utxo which happens to have a hashed datum, this is needed.
Indeed, in function mkShelleyTransactionBody
we can see that the HashableScriptData
are derived from the body itself, from the two locations mentioned above, as follows:
scriptdata :: [HashableScriptData]
scriptdata =
[d | TxOut _ _ (TxOutDatumInTx _ d) _ <- txOuts]
++ [ d
| ( _
, AnyScriptWitness
( PlutusScriptWitness
_
_
_
(ScriptDatumForTxIn (Just d))
_
_
)
) <-
witnesses
]
Then, the verification hash of the body is computed from these data using convPParamsToScriptIntegrityHash
, and is wrapped as well in the Shelley transaction body. As a consequence, there seem to be no builtin way to have additional data in the resulting Shelley
transaction body.
My feature request is to have such a way of including additional data in the transaction body.
This could take several forms, such as:
- an additional field in the
TxBodyContent
structure - an additional parameter in the
mkShelleyTransactionBody
function
Describe alternatives you've considered
For now, I have used the following work-around:
- generating the transaction body using
mkShelleyTransactionBody
- deconstructing the generated transaction body
- manually adding the necessary data in the respective field of the transaction
- manually re-generating the script integrity hash using the new data map with
convPParamsToScriptIntegrityHash
- wrapping back those changed elements into a new Shelley transaction body.
This does allow the ledger to generate the proper script context but it does not feel like the proper way to achieve this result.