ADR 9: Support reference scripts in constraint library¶
In Babbage era (available after the Vasil HF), the Cardano blockchain will support “reference scripts” by changing the
TxOut data type.
Reference scripts are used to attach arbitrary scripts to transaction outputs and are used to satisfy script requirements during validation, rather than requiring the spending transaction to do so.
Thus, we need to adapt our transaction constraint data type (
TxConstraints) to support this new feature.
We will add
Maybe ScriptHashas a new data constructor parameter for the constraints
TxConstraints. In the off-chain implementation of those constraints, if a reference script hash is provided, we will need to find the actual script in the lookups table so that we can include it in the transaction output. In the PlutusV1 on-chain implementation of the constraint, we will return
Falseif a reference script is provided because the ledger forbids using Babbage era features with PlutusV1. The PlutusV2 on-chain implementation of the constraint is trivial.
We will modify the off-chain implementation of
ScriptInputConstraintin order to add support for witnessing a script by actually providing it, or by pointing to the reference input which contains the script.
The main decision was to find out which data type will represent reference scripts.
Similarly to ADR 8: Support inline datums in constraint library, the decision to use
Maybe ScriptHash was mainly because of the constraint library’s main design that data types need to work with on-chain as well as off-chain implementation.