The ADA ecosystem continues to expand and the number of Cardano projects has exceeded 1000. What kind of development is the platform used for? What problems do they help solve? How are really working applications created on Cardano? Metalamp shares its experience in developing blockchain-based products.
Partnership with Cardano
Our company was founded in 2014 from a student project.
Our partnership with Cardano is something we owe to the Haskell language. Our knowledge of Haskell led us to the blockchain market, where most development requests came from, due to the popularity of cryptocurrencies, the growing number of government initiatives, as well as the proliferation of dApps for payments, smart contracts, supply tracking etc. As a result, in the third year of working with Haskell, we received a request from IOG themselves: they invited us to participate in testing Cardano smart contracts. This is how our collaboration began. We are very proud to be one of the top five companies to be the first in the world to develop use cases for Plutus.
To participate in the collaboration with Cardano, we had to learn Plutus Core, Cardano's smart contract language that draws on the Haskell source. The entry threshold for Plutus is extremely high, but because of the company's strong culture of self-education, prior Haskell knowledge, and our experience with functional programming, we have had a lack of integration issues.
The size of the global blockchain market is growing. DeFi and smart contracts are becoming more and more popular, and the platforms that provide these solutions are actively developing. We are close to the blockchain philosophy based on the principles of trust, openness, and decentralization, and we want to develop cooperation with the Cardano ecosystem in the long term. That's why we taught Plutus Core to all of our Haskell developers. The guys watched a course of lectures developed by IOG for the Plutus Pioneer program and interacted with the founders and language experts. Additionally, we created practical tasks for which our backenders searched for and wrote original solutions, such as the development of a Faucet application and the establishment of an NFT marketplace. All of our Haskell developers, even the newbies, are now able to work on Cardano projects.
This is the backstory of our relationship with Cardano. We are now going to discuss a few of our blockchain-based projects.
Our Cardano projects
Plutus Smart Contract Testing
In 2021, we investigated the behavior of Plutus smart contracts in actual projects. Our developers collaborated closely with the internal IOG team to identify bugs and take part in improvement discussions.
Before it was introduced on the mainnet, we tested the Alonzo Purple hard fork in particular. We were able to see how eUTXOs are stored, used in a transaction, and validated through testing.
IOG did not have a testnet that supports smart contracts at the time of our participation, nor did it have the necessary documentation. We've been running simulations. When the testnet appeared, it turned out that it did not support many features, such as PAB with wallets, state machines, etc. Additionally, the code that we successfully ran in the simulation did not always work in the real network. We were continually chatting with the Plutus developers and other participants in the contract test program in a dedicated Discord community about how to correct the mistakes that happened. The core IOG team has been very supportive; in particular, Director of Education Lars Brunies has been really receptive and helpful (hi, Lars!).
Sometimes no one had ready suggestions or advice, and we had to look into the Plutus source code and figure it out ourselves. Fundamental preparation helped us out here. It is an effective strategy for any industry, but it is especially beneficial for the blockchain because it is nearly impossible to create smart contracts without understanding what they are. And in some instances, the analysis of Ethereum's pre-existing solutions was helpful.
Creating an NFT marketplace
The first NFT marketplace featuring an auction on the Cardano blockchain was created as a result of participation in the Plutus platform testing program and IPFS protocol validation.
An NFT is produced in two steps: the first requires uploading the associated metadata (which might be any file, including an image), and the second involves minting the token and sending it to the creator's blockchain wallet. The IPFS protocol, which gives each file a distinct identification (it is a cryptographic hash), provides content addressability, which is needed for the first stage. The main purpose of the marketplace smart contract is to provide a direct link between the token in the user's wallet and this content ID. We were successful in achieving this, and in our marketplace you can now:
- Create your own non-fungible tokens;
- Form collections (packs) out of cards (tokens);
- Run an auction;
- Set the auction's starting price and duration;
- Upload audio, video, and image files.
The platform becomes profitable through commissions from NFT sales and auctions.
When the marketplace was launched on the test network in 2021, it was discovered that wallets do not integrate with PAB and it is impossible to sign transactions. The project was never launched on the testnet as a result.
Developing decentralized cloud storage
Iagon to develop a secure way for people to own and store their health data. The best environment for the idea's execution is blockchain technology, which offers transparency, openness, and immutability. We are assisting Iagon in developing a decentralized cloud system on the Cardano blockchain to exploit the underused computing and storage capacity of data centers, PCs, and smart devices. According to the idea of the creators, everyone will be able to offer free capacities on the market and earn passive income. The centralized large cloud providers (such as Google Cloud or Microsoft) will face competition from this decentralized cloud infrastructure.
Cardano was selected as the platform for deploying the protocol as the most successful combination of scalability, interoperability, environmental friendliness, low transaction costs, and science-based security. In Cardano's first decentralized cloud storage, a smart contract's primary function is to enable direct contact — i.e., communication between buyers of free storage capabilities and storage or compute providers.
As of this writing, we are having trouble integrating the contract with IOG frameworks like PAF (Plutus Application Framework). We are currently developing a solution. Simple contracts can be deployed without PAF, but complex and scalable solutions are left without a clear alternative to release the contract into the public domain. This is the other side of the Cardano development coin, which mainly focuses on node support and key elements.
Building an ADADAO stablecoin
Adadao is a decentralized landing page on the Cardano blockchain for lending AUSD stablecoins secured by ADA. AUSD can be used as a regular cryptocurrency for transmitting to other users or paying for goods and services.
Loans may be obtained with the provision of over-collateralisation (for example, 1 AUSD for 1.5 ADA collateral). An over-collateral is needed so that in the event of a fall in the value of ADA, AUSD remains secured. If a loan is found to be undercollateralized, the system cancels the borrower's debt and converts their collateral into AUSD through the stability pool, auction sale, or debt reallocation. When the loan is paid back, the user takes the collateral, and the received AUSD is burned.
At the time of this writing (August 2022), the majority of the protocol has already been developed. This includes smart contracts for lenders and donors to the Stability pool, contracts for liquidations, auctions, and a protocol management and monitoring module for ADA to AUSD to track and trigger liquidations. A contract for the distribution of liquidated debt, a contract for the control of the AUSD exchange rate, and a contract for ADAO token holders and voting are all in the research and development stage.
We ran into an issue with chain-index, the PAB component, while deploying the protocol on the testnet. Additionally, the majority of the simulation-specific code is incompatible with the testnet. Since there are no oracles on the mainnet, it is impossible to obtain the data required for the protocol to function. So, for the time being, we use a mock oracle (a fake oracle that we wrote ourselves; we change its data manually when we test something). It would be beneficial to have additional stablecoins on the mainnet, either for use in auctions or as a substitute currency for collateral.
Cardano project development benefits and drawbacks
We are typically asked to develop a smart contract application — the server part of the application that interacts with the blockchain. This involves writing code that constructs transactions and writing code that validates transactions. Sometimes the request includes writing an application interface (frontend) for manual testing or for production. In some circumstances, exploration is carried out prior to development in order to translate the basic design concept into a precise application architectural concept and implementation specification.
Due to its high throughput, low transaction costs, and energy savings, Cardano is a promising platform for developing secure smart contracts. What we also enjoy about Cardano is that:
- Haskell programming makes it possible to use the functional type system and secure abstractions of the Plutus framework;
- The Cardano community is responsive and follows the principles of free development (open source).
The following are the disadvantages of using Cardano for development:
- The Plutus framework is underdeveloped. Users test the API, developers give feedback, fix bugs and make the framework more convenient;
- PAB is still not working in browser wallet mode. Any DeFi application must be able to work with browser wallets. More research must be done to find solutions that can run the application for a variety of users;
- Due to the transaction size limit (16 KB), the application has to be specially redesigned. There are also limits on the number of calculation steps (CPU) and random access memory (RAM) consumed by the script, which makes it necessary to optimize the code.
Our IT engineers began developing blockchain software after joining the Cardano affiliate program, and they were the first to create smart contracts on Plutus. As a result, this experience has helped us learn new things and have new clients and projects on Ethereum as well as Cardano. The latter is because our front-end devs are already familiar with Solidity, the Ethereum language, which is similar to JS. In addition, we received more invitations to speak as authorities in the media and at different specialized events.