marlowe-ts-sdk icon indicating copy to clipboard operation
marlowe-ts-sdk copied to clipboard

Large/Deep Contract Support (Merkleized Contracts) Milestone Log

Open nhenin opened this issue 1 year ago • 0 comments

Specification

Why Merkleizing Contracts ? In many real world scenarios, the size of a Marlowe contract can pose challenges. For instance, a contract may be too big to fit on a Cardano transaction. To handle this situation, the Marlowe semantics and plutus validator both support a size optimization called merkleization. Merkleization is a process that transforms a contract from a tree structure into a merkle DAG (directed-acyclic graph) consisting of multiple contract fragments that reference each other by hashes.

Merkle DAGs translate well to storage in UTxO-based blockchains like Cardano, because these blockchains are themselves merkle DAGs. Transactions reference outputs of previous transactions by their hashes.

A merkleized Marlowe contract gives just enough information to validate the next transaction. When applying an input to a merkleized contract, the next contract fragment must be provided alongside the input. As long as the continuation's hash matches the hash contained in the existing fragment, we know the continuation is genuine. The provided continuation can then be used to compute the next contract that will be in effect after the input is applied.

**What is the Development Status of this Feature on the Marlowe Stack ? **

The Building Blocks necessary for this functionality are complete at the Runtime level (Runtime Rest API). We have to propagate the feature in the ts-sdk and build a prototype on top of it (Token Plan 2.0).

Design Session

See Miro board link: https://miro.com/app/board/uXjVNO9wt2A=/ Password: marlowe123

Execution Plan

  1. Implement marlowe-object in the ts-sdk (used by endpoints below)
  2. Implement these endpoints at the ts-sdk level : - https://github.com/input-output-hk/marlowe-ts-sdk/issues/69 - https://github.com/input-output-hk/marlowe-ts-sdk/issues/70 - https://github.com/input-output-hk/marlowe-ts-sdk/issues/71 - https://github.com/input-output-hk/marlowe-ts-sdk/issues/72
  3. Revisit the Vesting "POC" using merkleization
  4. Working on Token 2.0 Milestone

nhenin avatar Nov 09 '23 15:11 nhenin