funded
MLabs - Efficient Contract Upgrades with Yielding Tx Pattern
Current Project Status
In Progress
Amount
Received
₳39,986
Amount
Requested
₳199,932
Percentage
Received
20.00%
Solution

The Yielding Tx Pattern is a novel design pattern. Its segmented approach to scripting logic and tx flows keeps upgrades simple and script bloat limited all within an intuitive monoidal context.

Problem

Many current Cardano protocols struggle to achieve a flexible & efficient design. This leads to frustrating & convoluted upgrade paths, script bloat, and a tedious DevEx, all wasting team resources.

Impact Alignment
Feasibility
Value for Money
Impact Alignment

MLabs

1 member

MLabs - Efficient Contract Upgrades with Yielding Tx Pattern

Please describe your proposed solution

Problem

Transaction flow design is a challenging problem for Cardano smart contract creators. Typically, transactions must be checked for numerous conditions to be processed by a protocol or dApp. The validation logic is incorporated into ledger scripts which are of limited size.

However, most dApps are complex meaning they rely on various transaction types incorporating complex contexts. Adequately processing these transactions within a protocol's complex rule set is a challenge most teams struggle to overcome. Naive design decisions often incur huge costs later on as application complexity grows.

Need for Enhanced Design Patterns and Open-source Tooling

The expansion of the Cardano ecosystem and the increasing complexity of applications being built on its platform necessitate more adaptable and efficient transaction protocols. Developers need tools to facilitate this process and to ensure protocols can be updated efficiently and relatively painlessly.

Furthermore, inadequate designs are costly, leading to:

  • Script bloat
  • Convoluted designs difficult to reason about
  • Challenges as product applications evolve
  • Cumbersome upgrade paths

Among similar issues.

Solution

The YTxP project aims to address these challenges by developing two key libraries: ytxp-lib and ytxp-sdk. These libraries evolve the Transaction Token Pattern (TxTP) into a more generic and flexible pattern. Overall, the YTxP has several key elements:

  • Transaction Families: YTxP categorizes transactions within the context of a protocol. Transaction types are identified by the component UTxO types they act on, which are in turn (often) verified by the State Thread Token they contain. Transactions of different types can be composable. Organization of this kind greatly reduces the surface area of protocol updates..
  • Yielding Scripts: Scripts that execute and release their associated UTxOs only when preconditions have been met.
  • "Yielded To" Scripts: Staking validators, minting policies, or validator hashes which effectively delineate transaction families

YTxP can be implemented with a variety of on-chain and off-chain frameworks. This proposal includes ytxp-lib as a plutarch reference implementation of the on chain code. ytxp-sdk, on the other hand, focuses on YTxP types supporting both on-chain and off-chain frameworks, serialization, cardano-api compatibility, etc.

By offering an improved transaction protocol architecture alongside an on-chain supporting framework and utilities, these libraries will enable developers to build more robust and efficient smart contracts, enhancing the Cardano ecosystem's capabilities.

Market

The primary beneficiaries will be the YTxP library consumers, AKA Cardano smart contract developers. However, downstream improvements will positively impact DApp users by providing more feature-rich applications and faster product cycles.

Please define the positive impact your project will have on the wider Cardano community

What does this proposal entail?

This proposal seeks to drastically improve the infrastructure available for Cardano smart contract development by introducing and implementing the Yielding Transaction Pattern (YTxP). Our plan is structured around several key deliverables:

  • Development of ytxp-lib and ytxp-sdk Libraries: These libraries are core to our strategy, offering a structured, reusable, and upgradable framework for Cardano smart contracts. ytxp-lib serves as a repository for on-chain coding patterns, while ytxp-sdk focuses on providing off-chain and on-chain interoperability tools.
  • Innovative Script Solutions: We will develop Yielding Scripts that allow for flexible and efficient transaction handling, effectively reducing script bloat and simplifying upgrades.
  • Developer Resources: We will provide design and how-to documentation ensuring developers can effectively utilize our libraries

In what way will the success of your project bring value to the Cardano Community?

The YTxP libraries are designed to transform the development landscape for Cardano smart contracts by making them more adaptable, efficient, and easy to upgrade. By reducing the complexity and rigidity of current scripting practices, the YTxP enables developers to build more dynamic and robust applications. This leads to a direct increase in the quality of DApps available to end-users, enhancing the overall ecosystem's attractiveness and functionality. Furthermore, in future iterations and proposals we will be able to build upon this to provide library consumers more integrated and robust frameworks built upon YTxP.

What is your capability to deliver your project with high levels of trust and accountability? How do you intend to validate if your approach is feasible?

Our team members have considerable experience in protocol design and supporting tools as well as Cardano best practices, category theory expertise, formal methods, and so on. We were the main proponents of the precursor Transaction Token Pattern design which has been incorporated into live protocols operating on Cardano. We have also incorporated design schemes similar to YTxP into other projects.

Finally, to date, MLabs has an outstanding track record of delivering on Catalyst Projects. All of our accomplishments are publicly available for scrutiny, and our mlabs-haskell GitHub repo provides a wealth of information on past Project Catalyst efforts.

What are the key milestones you need to achieve in order to complete your project successfully?

Milestone 1: Spec and design

Outputs:

-Design document outlining the purpose, architecture, and components of the library

-Specification document describing the soundness of the design approach

Acceptance Criteria:

-Design document provides a coherent overview of the of the library and includes visual representations such as transaction diagrams

-Specification document clearly describes the soundness of the design approach

Evidence

-A collection of markdown documents in a publicly-available GitHub repository comprising the design document

-A collection of markdown documents in a publicly-available GitHub repository comprising the specification document

Milestone 2: YTxP Ops and Scaffolding

Outputs:

A fully configured GH repo with

  • Necessary nix flakes integrations
  • Makefile
  • Code formatting
  • Hercules CI
  • Haddock/Hoogle for automated documentation

Acceptance Criteria:

-Repo is properly initialised and structured

-Makefile successfully builds the library

-Code formatting is consistent

-Hercules CI successfully and reliably runs

-Haddock/Hoogle documentation is accessible

Evidence

-Link to repo containing completed setup

-Hercules CI output incorporated into repo

-Link to Haddock/Hoogle documentation or option for locally built documentation

Milestone 3: ytxp-sdk

Outputs:

  • Library containing YTxP types, along with instances for serialization, pretty printing, and testing, that correspond both to cardano-api and plutus-ledger-api types, sufficient to support development of YTxP-style protocols in many on-chain languages (plutus-tx, plutarch) and off-chain frameworks (sc-tools, atlas)
  • Round-trip and serialization golden tests
  • Documentation

Acceptance Criteria:

  • Library components must be fully functional, supporting YTxP type serialization, deserialization, and pretty printing capabilities.
  • Library should pass all round-trip and serialization tests with proper error handling.
  • Documentation should cover all YTxP types provided by the library and also cover setup and configuration.
  • Library must be compatible with both cardano-api and plutus-ledger-api.

Evidence

Code Repositories and Documentation: Links to the publicly available GitHub repository containing the ytxp-sdk library codebase.

Milestone 4: ytxp-lib core library

Outputs:

Development of the primary components of the ytxp-lib core library, including:

  • Yielding scripts: scripts (validators, minting policies, and staking validators) that are compiled against application-specific currency symbols and are capable of yielding to arbitrary scripts contained in a datum
  • Module Integration: Proper integration of all modules (Validators, Minting Policies, Helpers, etc.) to ensure seamless interaction within the library.
  • Command line utility to read in a JSON file containing application-specific scripts to be wrapped and emit the YTxP control scripts

Acceptance Criteria:

-Comprehensive Implementation: Each component and YieldingScripts

-Module Compatibility: All modules should be integrated properly, demonstrating seamless interaction and data flow between the components without any conflicts or errors.

-Code Integrity and Style: The implementation should follow best coding practices.

Evidence:

-Direct links to the publicly-available open-source ytxp-lib library.

Final Milestone: Testing and Documentation

Outputs:

Comprehensive testing and detailed documentation for both the ytxp-lib and ytxp-sdk libraries, ensuring they meet operational standards and are user-friendly for developers.

This will include:

  • Unit and integration tests
  • API documentation
  • Tutorial Guides and How-Tos
  • A video demonstration/closeout report

Acceptance Criteria:

-Test Coverage: On chain tests for the core library and serialization tests for the sdk.

-Documentation Clarity and Completeness: Documentation must be clear, comprehensive, and technically accurate.

-Tutorial Usability: Tutorials must guide new users through setting up and deploying typical use cases effectively.

-Closeout Report: Video demonstration and report as required by the Catalyst rule book.

Evidence:

-Direct links to the documentation and guides

-Direct links to the test suite

-Link to closeout report posted to YouTube or similar service

Who is in the project team and what are their roles?

MLabs

MLabs has quickly become one of the premier development firms in the Cardano Ecosystem. We are an IOG Plutus Partner and work regularly with IOG to develop the Cardano blockchain and ecosystem. Our team is composed of talented developers who have helped build community projects such as:

  • Liqwid
  • SundaeSwap
  • Minswap
  • Indigo
  • Optim
  • Many others

Through our work with early-stage projects, we have one of the largest groups of Haskell/Plutus developers in the community.

Website: <https://mlabs.city/>

Core team

Peter Dragos

Project Manager

During his time at MLabs, Peter has contributed to the design, implementation, and management of numerous Cardano DeFi protocols, including Liqwid, XPlorerDAO, Metera, and others.

The Yielding Transaction Pattern stems from early sketches that Peter and his teams worked on shortly after the release of the Plutus language and its principles have been applied as optimizations to existing protocols, including SundaeSwap, Discovery, Minswap, Butane, Summon staking split, and Lending Pond. His background in mathematics and technical commitment to high-quality, didactic code have helped teams and clients reach new heights, and he is excited for the opportunity to share authoritative documentation and a reference implementation for the YTxP with the community.

<https://github.com/peter-mlabs>

Edi Granado

Software Developer

Edi has contributed to numerous Cardano DeFi protocols, including well-known ones like Liqwid. He observed Peter and his team working on the YTxP early on and incorporated his ideas into other protocol designs. With many years of experience in software development, Edi has worked for companies such as Platonic.Systems and Emurgo Africa, and currently works for MLabs. He is pleased to contribute to implementing the YTxP reference.

<https://github.com/the-headless-ghost>

Alberto Fanton

Software Developer

Alberto is a Haskell developer deeply immersed in functional programming and the Nix ecosystem. With a solid background in distributed systems and Bitcoin applications, he has recently ventured into the Cardano ecosystem. At MLabs, Alberto contributed to various Cardano projects, including off-chain development, on-chain protocols, and the enhancement of development experience and operations. Driven by curiosity and a commitment to innovation, Alberto's overarching goal is to make YTxP effective and accessible to everyone.

<https://github.com/albertodvp>

Giovanni Garufi

Software Developer

Cardano DApp developer and auditor, worked on several Cardano protocols, both from the backend and frontend side. Passionate about mathematics and functional programming, and always thrilled to explore how these blend together. Loves working on tooling and libraries that can be useful for other developers. Giovanni hopes YTxP can be a means to build more complex and interesting DApps for the Cardano ecosystem.

<https://github.com/nazrhom>

Jeff Cheah

Software Developer

Jeff is a software engineer at MLabs, specializing in Haskell and Plutus with a focus on Cardano DeFi protocols. During his time at MLabs, Jeff has contributed to projects like XPlorerDAO and others. He was involved in the early development of the Transaction Token Pattern (TxTP), which introduces a new way to manage smart contract state transitions by using transaction families and deferred validation. Previously, at FP Complete, Jeff contributed to key open-source Haskell projects, including Stack. Jeff's focus on functional programming and high-quality code drives his work to improve the efficiency and accessibility of blockchain solutions for Cardano users.

<https://github.com/jeffhappily>

Nigel Farrelly

Software Developer

Nigel has been a core contributor to a number of projects during his time at MLabs, with a focus on both off-chain and on-chain development. He has worked with a variety of languages and frameworks in this time, with his fondness for Haskell and functional programming originally stemming from experiments with the live coding environment TidalCycles.

<https://github.com/nini-faroux>

Luke Mahoney

Delivery Manager

Luke brings a wealth of experience in software development and project management, particularly within the DeFi and open-source sectors. While at MLabs, he has played pivotal roles in planning and organizing several prominent DeFi initiatives. He has also helped organize and manage MLabs' Project Catalyst efforts that have funded numerous open-source efforts in the Cardano ecosystem like CTL, LambdaBuffers, and others.

<https://github.com/somthn0somthn>

Please provide a cost breakdown of the proposed work and resources

Budget/cost breakdown:

  • Milestone 1 - 20% - 108 hours
  • Milestone 2 - 15% - 80 hours
  • Milestone 3 - 25% - 135 hours
  • Milestone 4 - 20% - 108 hours
  • Final Milestone - 20% - 107 hours

Subtotal: 538 hours @110 USD/hour = 59,180 USD

Total (@ rate $0.296 USD / ADA): 199932 ADA

**In the interest of full transparency, please note we have applied a conservative USD/ADA exchange rate in pricing this proposal. This is to ensure our operations remain stable regardless of market conditions. Although we firmly believe the future of Cardano is bright, we recognize the price of ADA and all cryptocurrencies is inherently volatile. Our financial obligations are denominated in fiat. Most importantly, this includes the salaries of our engineers whose hard work makes projects like this possible.

In the unlikely scenario of severe negative price movement beyond our forecasted rate, it is possible that MLabs may need to temporarily suspend work on this proposal until the market recovers. Rest assured, this decision would be made solely to protect our business's long-term viability and never taken lightly.

We appreciate your understanding and support, and we are excited to see what we can achieve together.

No dependencies

How does the cost of the project represent value for money for the Cardano ecosystem?

By delivering the YTxP libraries, we aim to dramatically improve the efficiency and effectiveness of smart contract development on Cardano. We believe we have budgeted appropriately and provided a de-risked rate that still allows us to deliver an impactful project to the community. Furthermore, our proposal offers broad future improvements to the space, including:

Cost Efficiency: The YTxP approach minimizes the need for frequent and complex upgrades, which are currently a significant cost and time burden for developers.

Enhanced Developer Experience: By improving the underlying architecture of transaction handling and script interaction, YTxP will streamline the development process.

Long-Term Value Creation: The open-source nature of the YTxP libraries ensures that once developed, these resources can be utilized by an unlimited number of projects without additional cost.

Community and Ecosystem Growth: By lowering barriers to entry and providing a more accessible framework for developers, YTxP will attract new talent to the Cardano blockchain.

close

Playlist

  • EP2: epoch_length

    Authored by: Darlington Kofa

    3m 24s
    Darlington Kofa
  • EP1: 'd' parameter

    Authored by: Darlington Kofa

    4m 3s
    Darlington Kofa
  • EP3: key_deposit

    Authored by: Darlington Kofa

    3m 48s
    Darlington Kofa
  • EP4: epoch_no

    Authored by: Darlington Kofa

    2m 16s
    Darlington Kofa
  • EP5: max_block_size

    Authored by: Darlington Kofa

    3m 14s
    Darlington Kofa
  • EP6: pool_deposit

    Authored by: Darlington Kofa

    3m 19s
    Darlington Kofa
  • EP7: max_tx_size

    Authored by: Darlington Kofa

    4m 59s
    Darlington Kofa
0:00
/
~0:00