Last updated a year ago
Plutarch v1 greatly reduces the requirements of implementing stateful dApps (DeFi). Yet, expanded functionality is needed for Cardano devs/auditors to fully leverage the dramatic gains of this eDSL.
We will greatly expand the Plutarch feature set to improve efficiency and capability. There will be more powerful abstractions than before and a multi-backend solution for off-chain and on-chain use.
This is the total amount allocated to MLabs - Plutarch v2.
Proposal Background
This is the second funding round for the Plutarch project, which received initial funding from Catalyst in Fund8. Currently, several features promised in the Fund8 proposal are implemented while others are still underway. After early marked success, the current proposal details the scope and impact of Plutarch 2.0.
Market
Developers and auditors building out the Cardano ecosystem and verifying the security of dApps
Problem Space
Cardano features powerful smart contracts, however, the limits of smart contracts are very tight. Transactions must at most be 16 KiB, which limits the size of scripts heavily, in addition to having very tight memory and CPU budgets, such that the computational work possible is also tightly limited. These constraints are here for a very good reason, and raising them isn’t a viable long-term solution.
Unfortunately, however, Plutus Tx (the tool to compile Haskell to Plutus) is not up to the task.
The Plutus Compilation Pipeline and Plutus Tx Pain Points
As is widely appreciated, smart contracts on Cardano are written in Haskell, a functionally pure programming language. Historically, the Plutus Tx library is a key component of the compilation pipeline. This process has several steps:
Although it plays a crucial role here, the Plutus Tx compilation library has several shortcomings. Notably, it:
Most importantly, inefficiencies inherent in Plutus Tx ultimately constrain the features of dApps and raise unnecessary hurdles for developers. Some of these issues are solvable, but many of them are inherent to the approach, as it is not an eDSL.
Optimizations using Plutarch
Plutarch is a typed eDSL in Haskell for writing efficient Plutus Core validators. The v1.0 introduced several optimizations into the development process by offering developers fine-grained control of the Plutus Core they generate. In fact, a ~75% decrease in CPU, memory, and script size is commonly achievable without giving up valuable type information.
The Plutarch GitHub repo provides a thorough overview and how-to for the eDSL. Essentially, Plutarch allows Plutus developers to leverage the beneficial features of Haskell without losing the ability to compile. Plutarch achieves this sleight-of-hand by wrapping data structures in a computational context that mimics mutable state. This allows for type-level operations to occur without manipulating UPLC, the target language of the compilation pipeline mentioned above. Plutarch’s simple type system can then be easily bridged to UPLC during compilation.
Plutarch v1 has been used by several prominent projects and organizations:
What were the results of the Fund8 grant?
As mentioned, the first-round grant for Plutarch, posted by our co-contributor and close partner Liqwid, was successfully funded in Fund8. Largely, the grant covered the basic functionality of the eDSL:
Since the proposal was initially listed in March 2022, we have continued developing Plutarch and are pleased to report significant progress with:
Work remains surrounding:
While these achievements represent substantial gains for the Cardano ecosystem, expanding the scope of the Plutarch project will provide even greater benefits to dApps and organizations building in the space.
Our Proposal
The Cardano ecosystem is young and underdeveloped. This is readily apparent considering the degree of tooling available to developers. The outsized improvements possible with Plutarch v1.0 represent the degree to which these types of optimizations are possible.
This proposal is intended to support further development of the Plutarch project to make it more useful to auditors and other participants. Planned feature updates for Plutarch 2.0 include:
Other improvements include:
Plutarch is extensively developed and widely used in production – as such, we do not expect undue difficulty in implementing the features highlighted above. While highly useful, however, Plutarch involves specific training and a non-trivial amount of on-ramping for developers to become fluent in its use. This friction is exacerbated by the limited backend support. Smoothing out this learning/adoption curve is likely the most significant challenge of this proposal. We are well aware of this and are focused on usability and practical improvements to streamline the process for developers.
1 Month:
Expand backend support to include Plutus IR and the other languages mentioned, start the process of feature optimizations and usability improvements. Reconfiguring data types and effect system.
4 Months:
Backend support for mentioned languages largely, if not completely, accomplished. Moderate optimizations completed with more ongoing. Begin work on state machine support and optimization.
8 Months:
Proposal deliverables largely accomplished with minor optimizations ongoing. Pretty printing intact and incorporation of the Spec Language project largely underway.
Engineering hours: 913
Total: $73,040
Breakdown:
Feature Total Time
Plutus IR Backend 120
Haskell Backend 120
PureScript Backend 120
Data Type and Effect System Improvements 100
Efficient State Machine 90
Incorporating the Plutus Specification Project 60
Pretty Printing 80
Ergonomic Improvements 110
Subtotal 800
Change Budget 113
Total Time 913 hours
Total Cost $73,040
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:
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
Compilers and Formal Methods
Las Safin
Las is a software engineer and formal methods specialist who is experienced with dependently typed languages such as Idris and Agda and who is interested in Cedille. At MLabs, he helps manage Nix environments for use in development and writes application specifications as well as compilers.
Las has also made significant contributions to Cardano tooling. Most notably, he is the creator of Plutarch. Plutarch is a typed eDSL in Haskell for writing efficient Plutus Core validators. Plutarch significantly lowers the resource demands of validators written in the eDSL while providing developers more fine-grained control of the Plutus Core generated. See the GitHub link for more information.
Plutarch: https://github.com/Plutonomicon/plutarch
GitHub: https://github.com/L-as
Performance Optimization and Type systems
Chase Maity
Chase is a polyglot software developer with expertise in Haskell and C. He’s interested in type systems, programming language design, and performance-optimizing compilers. At MLabs, he has worked on both on-chain Plutarch code and off-chain smart contracts; as well as providing technical specialist assistance on Plutus Core and its intricacies. Outside of MLabs, Chase spends time contributing to open source, and learning more about Haskell and type systems.
Chase is also a core contributor to Plutarch, having been a close contributor since before the 1.0 release. He was also the writer of the first Plutarch validator to be used in production, through the Minswap project. Currently, Chase aims to help Plutarch achieve even higher limits both in terms of ergonomics and in terms of on-chain efficiency.
GitHub: https://github.com/TotallyNotChase
Senior Haskell Developer
Mario Blažević
Mario is a software developer with experience in programming language design and development, including standalone compilers, VMs, and embedded languages. He also has a long history as a Haskell developer and open-source contributor, as well as more recent experience as a Cardano
developer. See his GitHub link for more information.
GitHub: https://github.com/blamario
This is possible but remains to be determined. This version is the next iteration of Plutarch, a typed eDSL for writing UPLC that offers dApp developers dramatic gains. The features outlined in this proposal comprise a complete release, however, we will continue to upgrade the product in line with community feedback. In so doing, we may support further features and functionality upgrades per this community input by applying again to future Catalyst rounds.
Please describe how you will measure the progress and the development of the project?
Intended Fund – Fund9: Developer Ecosystem
Challenge Statement: “How can we create a positive developer experience that helps the developer focus on building successful apps?”
Project Impact: High
Usability: Plutarch will help builders create more expressive smart contract applications while adhering to the resource limitations of Cardano. Moreover, features included in v2.0 will help auditors ensure dApps are correctly implemented and in general make the eDSL easier to use.
Open Source Tooling: Plutarch v2.0 will be open source and freely available for developers to use
Cost-Effective Development: dApps running on Cardano require substantial upfront costs for development. Streamlining the engineering process will result in substantially reduced costs and faster times to market.
As Plutarch is an open-source effort, the GitHub repo is available to the public. It will also serve as a transparent auditing source. For less technical community members, we will provide regular project updates via Medium articles as well as our social channels.
KPIs (Key Performance Indicators)
-general reduction size in script execution size achievable
-number of projects benefiting from Plutarch optimizations
-number of commits to repo and general repo development
-amount of forks/stars as well as number of project contributors
-number of PRs and resolved issues
A successful Plutarch 2.0 would see more projects incorporating the eDSL to realize its usability and improvement gains. In addition to seeing positive developments in the above KPIs, we would like to see public input on our GitHub repo and an increased number of contributors.
This is a continuation of https://cardano.ideascale.com/c/idea/398609
NB: Monthly reporting was deprecated from January 2024 and replaced fully by the Milestones Program framework. Learn more here
Plutarch developers and other advanced Haskell/Plutus engineers.
Moreover, our engineers are committed to open-source tooling for the Cardano ecosystem. See our work on the Cardano Transaction Library (Fund8 successful proposal) and the Plutonomicon GitHub repo.