Please describe your proposed solution.
Problem
There are no language-agnostic mechanisms for specifying the types of information and values used in Cardano DApps, a detrimental fact to productivity and cross-language environment interoperability. A <u>significant percentage</u> of DApp development effort is spent on dealing with serialization/deserialization issues between on-chain code types, off-chain/frontend, and analytics/databases. This major source of delay in project timelines could be eliminated if types would be language agnostically defined once per DApp; with serialization/deserialization code for multiple targets generated automatically from the agnostic definition.
Currently, type definitions for a typical Cardano DApp must be specified in the Haskell programming language. Together with the <u>PlutusTx</u> or<u> Plutarch</u> libraries, Haskell is the de-facto main tool for writing Plutus programs. However, we want to facilitate expansion to other languages getting traction in this space, specifically <u>Aiken</u> for on-chain Plutus scripts.
The lack of language-agnostic tools for specifying Cardano DApps data types (e.g. datums, redeemers, etc.) hurts productivity. Furthermore, it constitutes a fundamental hurdle to cross-language environment interoperability and the proliferation of generic tooling to enable rich interaction with DApps (e.g. database explorers).
The mentioned issue of language-tied typing has become more severe with the proliferation of different PAB platforms, each written in different languages. PAB platforms enable developers to build software that gives users the ability to interact with Cardano DApps from a variety of platforms (e.g., server, desktop, browser, mobile etc.). Examples of such platforms include <u>Atlas</u> (Haskell), <u>Cardano Transaction Lib</u> (Purescript), <u>Lucid</u> (Javascript) and <u>Cardano Serialization Lib</u> (Rust).
To make Cardano DApps available across all the aforementioned platforms, structured information needs to be effectively shared in a language-agnostic manner and made available to different language environments. Furthermore, blockchain analytics applications, DApp aggregators, and DApp interoperability will require light DApp-type schemas that are decoupled from the DApp’s implementation code - it is not very practical to have to import a DApp’s codebase in order to interpret its datums, redeemers, and other on-chain data.
We want to consolidate the solution to this issue into a single project that takes type definitions out of a language-specific environment and into a configuration language that can be then fed to a reliable code generation tool that targets a number of different language environments.
The intent behind this project is to align the Cardano tech environment with modern best practices that facilitate building robust, technology stack-agnostic Cardano DApps.
Solution
Under <u>Catalyst Fund9</u> we’re nearing completion of the <u>LambdaBuffers</u> project (was Cardano dApp schemas) and are looking to extend our support from Haskell and Purescript to Rust, Javascript and Aiken language environments.
The project implements a configuration language for specifying DApp types/schemas. The language makes use of code-generation tooling, which using the schemas produces ‘type libraries’ (aka. typelibs) for different language environments. Each typelib is generated alongside supporting libraries for handling encoding, serialization and other essential operations. All the mentioned processes are automated, maintaining correctness and compatibility between different language environments.
LambdaBuffers serve as a language-neutral, extensible mechanism for specifying type definitions and code-generating different language environments library implementations.
Market
Developers building Cardano DApps and extended tooling and infrastructure.
Features
- Configuration language for specifying data types aligned with the Plutus data model.
- Support for sum, record/product and polymorphic types.
- Automated production of type libraries from configuration-based specifications.
- Integration with build systems associated with the target language environments (e.g., Cabal, Spago, Node, Cargo, Nix etc.).
- Standardized data type associated operations, including equality, JSON encodings and Plutus data encodings.
Related work
For the reader’s reference, the following standards and technologies have solved a similar problem in traditional software sectors:
- <u>ASN.1</u> - adopted by widely used cryptographic standards (see X.509),
- <u>Google Protobuf</u> - used by major tech companies as the foundation for RPC and microservice-based architectures,
- <u>Apache Thrift</u> - used by major tech companies as the foundation for RPC and microservice-based architectures,
- <u>Apache Avro</u> - configuration-based schema definition mechanism used across different Apache projects,
- <u>CDDL</u> - used by Cardano itself at the network/transport level, fairly complicated standard with little supporting tooling available,
- <u>XDR</u> - used for RPC in Linux-based enterprise networks,
- <u>Microsoft IDL</u> - used by Microsoft DCE/MS-RPC protocols and a foundational technology for MS Windows-based enterprise networks,
- ADL<u> https://github.com/timbod7/adl</u> - data specification technology inspired by and built for functional programming language environments.
- CIP-0057 <u>https://developers.cardano.org/docs/governance/cardano-improvement-proposals/cip-0057/</u> - JSON-based approach to specifying Plutus encodings via JSON schema.
How does your proposed solution address the challenge and what benefits will this bring to the Cardano ecosystem?
Intended Challenge – Fund10: Developer Ecosystem - The Evolution
Challenge Statement – “How do we equip and support developers with tools and working infrastructure? How do we make Cardano their first choice when it comes to building dApps, innovating and collaborating?”
What does this proposal entail?
The current iteration of this project entails building support for 3 new languages, namely Rust, Javascript and Aiken.
How does increased throughput on Cardano help developers?
Typical Cardano DApp projects involve a very diverse team. For instance, Plutus scripts are written in Plutarch, PlutusTx and Aiken.
The frontend and backend teams use various PABs to build transactions, which include Atlas (Haskell), Cardano Transaction Lib (Purescript), Cardano Serialization Lib (Rust) and Lucid (Javascript).
We hope this proposal will make such diverse teams work together more effectively by consolidating all data type definitions in a single place and reusing them reliably across their respective technological environments.
<u>The successful adoption of this project would radically increase developer productivity</u> while decreasing the amount of unnecessary, tedious, error-prone and boilerplate code that needs to be manually written and curated. Type definitions would serve as documentation for the project, as well, and could very well be foundational to the proliferation of generic tools and infrastructure that can interact with schema-enabled Cardano DApp projects.
How do you intend to measure the success of your project?
We will measure:
- the number of features implemented,
- the number of issues discovered and resolved,
- the usability of Cardano DApp schemas to projects that have incorporated it,
- the number of contributors adding to the GitHub repo,
- the number of Cardano projects relying on LambdaBuffers toolkit,
- the general perception of the project in the Cardano developer community.
We expect growth/positive results in these areas and are committed to meeting the milestones we have established throughout this proposal.
Please describe your plans to share the outputs and results of your project?
In the spirit of complete transparency with the Cardano community, the outputs of our proposal will be widely available. Foremost, as an open-source project, the GitHub repo at <u>https://github.com/mlabs-haskell/lambda-buffers</u> will be the obvious resource for updates, documentation, and educational resources. This repo will be updated as the project progresses - a primary deliverable of this proposal.
MLabs has a noteworthy social media presence. We'll make active use of these channels to share regular updates with less technical community members. Finally, we'll actively share progress reports through the typical, publically-available Catalyst channels. MLabs has a strong compliance record, and this will not change throughout the progress of this proposal.