Last updated 2 months ago
Running Cardano Transaction Library requires delivering large WebAssembly bundles (>2.5 MB) to the end users. Reducing this footprint is needed for better user experience.
This is the total amount allocated to MLabs – Cardano Transaction Library Footprint Reduction. 1 out of 5 milestones are completed.
1/5
cardano-data-lite implementation
Cost: ₳ 60,000
Delivery: Month 1 - Apr 2024
2/5
Use cardano-data-lite in CTL
Cost: ₳ 42,000
Delivery: Month 2 - May 2024
3/5
Move library for application of plutus script parameters out of CTL core
Cost: ₳ 26,000
Delivery: Month 3 - Jun 2024
4/5
Move message signing library dependency out of CTL core
Cost: ₳ 32,000
Delivery: Month 4 - Jul 2024
5/5
Cardano-Transaction-Library without WebAssembly
Cost: ₳ 40,000
Delivery: Month 5 - Aug 2024
NB: Monthly reporting was deprecated from January 2024 and replaced fully by the Milestones Program framework. Learn more here
Vladimir Kalnitsky
Dzmitry Shuiski
We will:
No dependencies.
MIT License
N/A
Problem
Cardano-transaction-library (CTL) is a Swiss knife framework for Cardano offchain development created at MLabs. To appeal to a wider audience, a few shortcomings have to be addressed.
Wide dependency tree, use of WebAssembly
There are a number of WebAssembly dependencies we use that bloat CTL-produced front-end bundles for end users: it’s not possible to tree-shake WebAssembly binaries using JavaScript bundlers.
cardano-serialization-library (CSL) is a dependency of CTL. CSL’s code is partially autogenerated using https://github.com/dcSpark/cddl-codegen, which reads Cardano CDDL and emits rust code. Rust code then gets compiled to WebAssembly, and the build artefacts can be consumed as an NPM package: https://www.npmjs.com/package/@emurgo/cardano-serialization-lib-browser
At the moment of writing, the WASM binary in this package is 2.03 MB
cardano-message-signing (CMS) is a library that implements CIP-0008 message signing spec and is consumable from the browser as an NPM package:
https://www.npmjs.com/package/@emurgo/cardano-message-signing-browser
The WebAssembly blob is of 372KB in size.
cardano-message-signing is used for Cip30Mock implementation, that is only needed for testing.
uplc-apply-args (https://github.com/mlabs-haskell/uplc-apply-args) is a custom solution we use for applying PlutusData arguments to parameterized Plutus Scripts.
The WebAssembly blob is of 177KB in size.
Solution
Wide dependency tree, use of WebAssembly
We will re-implement parts of functionality in TypeScript or JavaScript and move the rest to optional dependencies.
cardano-serialization-library contains some functionality that we don’t actually need.
We use CSL for two purposes:
We want to build a lightweight JS-only re-implementation of the part of CSL responsible for CBOR (de) serialisation of Cardano domain types. This part will have the same interface as CSL so that we can plug it into CTL without much refactoring.
There are ~130 semantically nontrivial CSL domain types we use.
Among them:
We can allow ourselves to differ from CSL by lifting some requirements that are not relevant to us:
We have considered three approaches to implementing Cardano domain-type serialization:
We decided to adapt serialization code from @cardano-sdk/core by stripping the unneeded parts and maintaining it as a separate project (proposed name “cardano-data-lite”, may be changed in the future).
MinOutputAdaCalculator is another CSL API we will have to re-implement. It is just a piece of arithmetics code that is trivial to rewrite:
cardano-message-signing (CMS)
We believe that, since most users would not need the CMS library in the browser context, it is possible to re-organize the CTL structure to make it an optional dependency for clients’ projects.
uplc-apply-args
We have evaluated the feasibility of implementing it in pure JavaScript, and, unfortunately, the scope of the functionality is too wide for us to fit it into a single Catalyst proposal. We will move it to a separate package for now, and free most of the users who do not need this functionality from having to deal with WebAssembly.
Market
Our target audience is Cardano dApp developers who use or may use CTL in the future, including current clients of MLabs.
Features
Related work
Previous Catalyst proposals for Cardano Transaction Library development:
The main value propositions of this work are:
We can measure success using two observable metrics:
We will promote the outputs of our work on the company's social media and/or in technical communities.
Our capabilities to deliver the project have been demonstrated by prior work on Cardano Transaction Library, funded by:
Our ability to manage funds responsibly is evidenced by our successful completion and closure of all our funded projects from Fund7, Fund8, and Fund9. We have consistently upheld the utmost care with our compliance, maintaining complete transparency with the Catalyst team and broader community members. Furthermore, our extensive project management experience across a diverse range of client projects has honed our skills in budgeting, meeting milestones, and adhering to roadmaps.
cardano-data-lite implementation
Outputs:
Acceptance Criteria:
Evidence:
Estimate: 29% of budget
Use cardano-data-lite in CTL
Outputs:
Acceptance Criteria:
Evidence:
Estimate: 28%
Move library for application of Plutus script parameters out of CTL core
Outputs:
Acceptance Criteria:
Evidence:
Estimate: 10%
Move message signing library dependency out of CTL core
Outputs:
Acceptance Criteria:
Evidence:
Estimate: 10%
Cardano-Transaction-Library without WebAssembly
Outputs:
Acceptan Criteria:
Evidence:
Estimate: 23%
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
Vladimir Kalnitsky - Tech Leadership
Vladimir is a software developer with a number of contributions to the PureScript ecosystem and solid experience with Haskell. During his undergraduate years, Vladimir focused on functional programming and type theory. Vladimir is more of a 'hacker' than a scientist, but he still values formal reasoning about code and well-founded software development practices.
Dzmitry Shuiski - Haskell and PureScript Development
Dzmitry is an experienced software engineer, currently developing solutions using functional programming techniques, mostly using PureScript and Haskell. Coming from a background in iOS App Development, he is well-versed in various aspects of developing robust and user-centric systems. Dzmitry has made considerable contributions to CTL in the past and is now primarily focused on Cardano dApp development. He is currently pursuing a degree in Software Engineering and Management at the Graz University of Technology to deepen his knowledge in more fundamental disciplines.
M1: cardano-data-lite implementation - 111 hours total
M2: Use cardano-data-lite in CTL - 104 hours total
M3 move library for application of plutus script parameters out of CTL core - 38 hours total
M4 move message signing library dependency out of CTL core - 38 hours total
M5 CTL without WebAssembly - 87 hours total
Subtotal: 378 hours
Total hours with contingency (15%) and management (12%) overheads: 480 hours
Total USD cost (@100 USD/hour) = 48,000 USD
Total ADA cost (@ 6-month-low rate $0.24 USD / ADA): 200,000 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 salary 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.
Making dApp developers more productive by removing the need to deal with WebAssembly bundling would save costs for the teams and therefore may positively affect the number of successful Cardano projects. Improving UX for the end users is also a major benefit.