Enhancing Marlowe Runtime to execute arbitrary Plutus alongside Marlowe #671
bwbush
started this conversation in
Architecture
Replies: 1 comment 1 reply
-
I'm on board with the basic idea of this. However, I'd reformulate the |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Enhancing Marlowe Runtime to execute arbitrary Plutus alongside Marlowe
The power of Marlowe can be significantly enhanced by executing carefully crafted Plutus scripts along side it in the same transaction. Example use cases include . . .
Typically, the Plutus script would inspect the
Redeemer
and/orDatum
for the Marlowe contract's application of input or payout. The script's logic would validate its spending depending upon whether conditions on theMarloweData
,MarloweTxInput
, and/orScriptContext
were met.Running Plutus alongside Marlowe in no manner invalidates the safety guarantees inherent in Marlowe. The Plutus validators that run alongside Marlowe would generally be quite small, and hence easier to audit.
Requirements for running Plutus with Marlowe
ScriptContext
and hence the Plutus cost of deserializing and accessing that for each validator that executes in the transaction.Datum
andRedeemer
if that is a script input.Datum
.POSIXTime
validity range.Only the first three items are essential for an initial implementation.
Expressiveness of the existing constraint specification
As of
v0.0.3
of Marlowe Runtime, the transaction builder can handle the following constraints (seeLanguage.Marlowe.Runtime.Transaction.Constraints
):Thus, it lacks the capability to express the following Plutus-related constraints:
Datum
andRedeemer
if that is a script input.Datum
.POSIXTime
validity range.Furthermore, the constraint framework is not exposed to clients via the
marlowe-proxy
service, thus making it impossible formarlowe-runtime-cli
ormarlowe-web-server
to include Plutus in a Marlowe transaction.Proposed design for running Plutus with Marlowe
Transaction constraints
There are at least five approaches to including extra transaction constraints in Marlowe Runtime:
TxConstraints
type.TxConstraints
.TxConstraints
to use that directly or build upon it.TxBodyContent
before coin selection and balancing occurs in Marlowe Runtime.We propose the second approach because it might be cleaner conceptually and more convenient to keep the extra constraints somewhat separate from the Marlowe-specific ones. For example, keeping them separate facilities having a client supply them as a
Set ExtraConstraint
without interfering with the existingTxConstraints
being generated as the Marlowe constraints are built.Client API
The
marlowe-web-server
client's REST API would include optional constraints in the JSON payload for creating Marlowe contract, applying inputs to them, or withdrawing from them. Storing this information in the HTTP header is impractical because of size limits on headers.The
marlowe-runtime-cli
client would include an optional flag--extra-constraints-file
for a JSON file containing the serialized constraints, once again for Marlowe creation, input application, and withdrawal.Beta Was this translation helpful? Give feedback.
All reactions