Cardano bases its transactions on a local environment, with the eUTxO (extended Unspent Transaction Output) with the ability to interact with smart contracts running on-chain.
Ethereum, on the other hand, is based on the global state of the block chain, (Ethereum Virtual Machine, EVM), with a different accounting record model for transactions, the Accounts model.
The UTxO model, created by Satoshi Nakamoto for Bitcoin, is the unspent balance from a previous transaction, which can be spent in the future. The eUTxO improves the UTxO model, since it is a programmable model, which admits time conditions and amounts to spend.
UTxO chains do not have accounts, instead coins are stored as a list of UTxOs, and transactions are created by consuming existing UTxOs and producing new ones in their place. The balance is the sum of UTxOs controlled by a wallet. The UTxOs are similar to cash in the sense that they use “change”, and they are indivisible (the UTxOs are used whole), that is, if you have to pay $50 and you have a $100 bill (UTxO), you must deliver it completely and receive the change in a $50 bill (new UTxO).
The Accounts model resembles the operation of a bank. Users have accounts that save their coin balance. It is possible to spend partial balances. The concept of change does not apply.
While Ethereum’s implementation is simpler, the complications inherent in global state management (EVM) result in a higher chance of failed transactions, or wasted resources, among other issues.
Cardano’s model circumvents these issues as it allows for resource determinism and indivisible individual transactions by limiting the scope of smart contract transactions to their immediate local environment. However, these advantages are not without costs, since the construction of transactions is an upfront charge, and must be included individually in each development that runs on Cardano. Unlike Ethereum it is a construction that every developer must face.
The web3.js library on Ethereum is widely praised for providing an easy and intuitive way for developers and users to connect to key infrastructure while interacting with the blockchain.
A key feature of web3.js is its abstraction over light wallets. This high-level approach removes a significant amount of complexity for DApp developers who would otherwise have to design around the complexities of individual light wallets to perform even basic application functions.
A comparable set of tools has not yet been developed on Cardano, to achieve the integrated experiences that users expect and thus reduce the burden on development teams.
On Ethereum, web browser applications form a common interface for users to transact on the blockchain. In-browser wallets typically facilitate this process by embedding a Web3 provider object in the browser. This Web3 object links the user’s wallet with publicly accessible nodes, allowing wallets like Metamask to sign transactions and manage private keys within the browser for seamless interaction with the network.
The tools in Cardano aim to match this user experience, but there is still a long way to go.
The Proposal
The web3.js libraries for Ethereum support creating transactions in the browser, but Cardano-like libraries have yet to arrive.
Cardano-Serialization-Library (CSL) is a popular tool among DApp developers. It is a library, written in Rust, for serializing and deserializing data structures, included in transactions, with the Haskell implementation, so that they can be sent to the blockchain efficiently.
It also provides various wallet utilities to generate keys and addresses, manage the minutiae of transaction creation, handle metadata, etc.
However CSL has limitations. The Cardano-Transaction-Library (CTL) uses the CSL but provides a higher level solution, which automates the creation of transactions by querying the blockchain, via Ogmios, to collect the necessary information.
Ogmios is a lightweight bridge interface for cardano-node that offers a WebSocket API that enables local clients to speak Ouroboros’ mini-protocols via JSON/RPC.
It is also abstracted from the wallet, meaning developers only need to rely on declarative Application Programming Interface (API) function calls without worrying about the details of individual thin clients.
Thus MLabs proposes a PureScript Software Development Kit (SDK), to perform and balance transactions for browser-based wallets (such as Nami) and javascript environments (server, mobile). The CTL will do the heavy lifting of building the transactions to meet the requirements of a smart contract.
Using the MLabs CTL, developers will be able to mix and match tools that, when properly configured, will help streamline the creation and maintenance of transactions in javascript or browser-based (e.g. mobile, server) environments.
Developers will be able to use the library to, build responsive web3 applications, query and process data on-chain through the browser, efficiently build, balance, and sign transactions through browser wallets, speed up their off-chain development, easily convert PAB endpoint code to SDK code, and create a ‘decentralized infrastructure’ in which SPOs (stakepool operators) can run a decentralized network of query and push APIs.
Cardano-Tx-Lib is open source and published on GitHub: https://github.com/Plutonomicon/cardano-browser-tx
The Budget
The development will consume the following hours of work:
- Initial Exploration and Building a Testing Framework: 40
- PureScript bridge and Basic Query Types: 80
- Contract-style Interface and Effective Error Handling: 100
- Incorporating Full EUTXO (Datums, etc) into Transaction Builds: 100
- Integration with Other Browser-based Wallets: 160
- Documentation and Training Materials: 40
- General Testing: 80
- Audit Prep: 80
- Spec: 80
- Change Budget: 128
Total Time: 888 hours.
Funds requested in USD 71,000
The Roadmap
The total time of hours projected in the budget, for this development, will be extended as follows:
3 Months: Establish a baseline of functionality using Nami. This includes parsing Ogmios JSON objects, p2p transactions, and so on.
6 Months: Serializing / deserializing datums, script lookups and incorporating script interactions, submitting transactions against basic smart contracts (eg escrows, vesting contracts, etc.)
12 Months: Integrations with other browser-based wallets (Gero, Yoroi, etc.), documentation and educational tutorials, implementing other nice-to-haves.
KPIs (Key Performance Indicators)
- Peer-to-peer transactions successfully executed
- Tx automatically balanced from wallet UTxOs
- Reduced off-chain development time
- Full eUTxO support
- Number of wallets supported
Auditability
- General GitHub activity
- Pull requests and resolved issues
- Streamlined transaction building for smart contract interactions
- Number of browser wallets supported
- External projects incorporating our library
- JavaScript API and accompanying usage examples
- Perform fee and execution unit estimates
- Plutus contract parameter application on the frontend (this removes a piece of centralization)
The Team
MLabs has quickly become one of the leading companies in development in the Cardano ecosystem.
They have one of the largest groups of PureScript/Haskell/Plutus developers in the community. They are IOG Plutus partners and regularly work with IOG to develop the Cardano blockchain and ecosystem, employing more than 80 developers, the company tells us. You can see the core members of the full team here.
MLabs tells us about the professional skills of the developers who will work on this proposed project.
Haskell and PureScript Developer
Vladimir Kalnitsky is a software developer with a few contributions to the PureScript ecosystem and solid experience with Haskell. During his undergraduate years, Vladimir focused on functional programming and type theory. He is now studying for a Master’s in Big Data and Machine Learning. The team defines Vladimir as more of a “hacker” than a scientist, but he still values formal reasoning about code and well-founded software development practices.
GitHub: https://github.com/klntsky/
Haskell, Plutus, and PureScript Developer
Viet Tran has an undergraduate and master’s degree in Mathematics alongside a Ph.D. in Theoretical Physics. He previously worked as a quant, writing Python/Cython code to model the outcome of sporting events through optimizers, Markov Chains, and various probability distributions. I have acquired an interest in category theory, functional programming, and blockchain technology in recent years. He has 12 months of experience in Haskell, Plutus, and Purescript combined.
GitHub: https://github.com/vvtran
Delivery Manager
Rory Tyler Hayford is a linguist-turned-developer and programming polyglot. His development career began with the web, and he has experience with both backend and frontend development. His initial forays into functional programming several years ago soon turned into a profound and lasting passion. He has a strong background in functional programming and reproducible build systems with a focus on Haskell, Nix, and Purescript. He is also the author of a handful of open-source Haskell libraries.
GitHub: https://github.com/ngua
…
The original proposal on IdeaScale: MLabs – Cardano-Tx-Libfor web3
Website: https://mlabs.city