Cardano (ADA) is one of the top 10 cryptocurrencies by market cap. Cardano is much more than a cryptocurrency. It is a scalable and sustainable blockchain platform for smart contracts launch . Cardano runs on a Proof of Stake Ouroboros consensus protocol. Moreover, it was developed on evidence-based research by the academic community of experts and software scientists. The goal of Cardano is to design a fully decentralized blockchain project, which is managed and funded by an e-voting system. Despite the benefits, the community criticizes Cardano for slow development. In 2021 Cardano launched several updates. As a result, they introduced the Plutus platform for writing smart contracts and announced its potential interoperability with smart contracts based on Ethereum. The article tells about these updates, the challenges we faced operating on Cardano and our solutions.
Every stage of Cardano's development is devoted to the specific problem solution. They are introduced in the blockchain development roadmap and named after the cultural figures of the past:
- The Byron era - Cardano foundation (2017)
- The Shelley era - decentralization (2020)
- The Gauguin era - smart contracts (2021)
- The Basho era - scaling (2022?)
- The Voltaire era - management (in progress)
Cardano developed the Plutus language and the Plutus Platform for writing smart contracts in the Gauguin era. Plutus is an innovative platform for building transactions. Also, it is a compiler of Haskell script code to the internal language of smart contracts. Like Ethereum (and even more efficient), it allows to design secure decentralized applications, new crypto tokens and smart contracts.
Plutus is built on the Haskell, functional programming language. Cardano has other languages, but Plutus is the fastest, cheapest and most secure. The developers, business experts and academic communities supervised the Plutus development. We can write any smart contracts using it. People with no technical background (but some expertise in business and/or finance) can create financial smart contracts on the Plutus platform using the Marlowe language (DeFi platform).
Plutus is part of the Alonzo hard fork, a long-awaited update of the Gauguin era, launched in September 2021. However, the platform still does not operate well, and our team faced several challenges.
Hook up with the PAB
The PAB is a server application that contains a smart contract and allows it to operate efficiently via WebSockets or HTTP requests. The PAB was supposed to deploy on a remote server or a browser, integrating with wallet applications.
So far, the PAB cannot interact with the Nami wallet and Yoroi browser wallet in the cloud or as a browser-based application. In this case, users need to set up a browser wallet such as Nami, Yoroi or CCVault. So, they will be able to receive and send transactions from the PAB hosted on the dApp provider node.
The problem is that the browser wallet is not flexible and can not send a transaction. It must be able to execute a Plutus script to do this. The Cardano team is working on a solution.
The PAB runs locally on the user computers (hosted PAB + WBE), and it is challenging to make a transaction. Every transaction party must have a full Cardano blockchain node, API wallet and the PAB. It is inconvenient, time-consuming and needs a lot of storage space.
For example, the developer wants to deploy Dapp to the cloud. Then, the wallet back end (WBE) processes each user's wallets and stores their private keys on the server. It processes the transaction, signs and sends requests from the PAB. This test model is not supposed to operate in the future as it does not correlate with the decentralized blockchain philosophy. Users should control their wallets, not the dApp entity.
Today Plutus' smart contract infrastructure is inefficient and user-unfriendly. Keeping it simple, we run contracts through the Command Line Interface (CLI) by signing the Cardano wallet. It is easier than using the hosted PAB with lots of problems that need to be solved. When the PABs can deploy on a remote server without a wallet, we will be able to talk about the efficient DeFi market on Cardano.
Stay out of my UTxO
Like Bitcoin, Cardano uses UTxO, but only in the extended EUTxO version (Extended Unspent Transaction Output). The UTxO is a registration and verification model, an alternative to Ethereum accounts and other blockchains. The UTxO is the transaction recording model, where every transaction has its inputs and outputs.
Let us look at the practical example. Tanya wants to send 5 tokens from her wallet to the PapaJohn's pizzeria wallet to pay for the order. Also, she needs to send 10 tokens to the wallet of Margo, her nail artist. Finally, she wants to send 15 tokens to Mark's wallet, her boyfriend. In this case, a transaction is a record of inputs and outputs information about money flow. At the input, Tanya's wallet uses one or more unspent outputs from previous transactions, where the total number of tokens is 30 or more.
This transaction has four outputs:
- 5 tokens (for PapaJohn's wallet);
- 10 tokens (for Margo's wallet);
- 15 tokens (for Mark's wallet);
- The unspent sum from the input (for Tanya's wallet), if the total amount of more than 30 tokens was recorded in the input.
These outputs can also be inputs for the next transaction.
In short, UTxO is a sum left from previous transactions. So, it can be used as input for future transactions. If it is still not clear, here is a video. After watching it, you will have no more questions about UTxO.
In Cardano, UTxO upgraded new features. In addition to sender address and transfer amount, EUTxOs contain Datum not carried by traditional UTxOs. It is additional data or state required for the Program operation. Data can be random and change on different EUTxO. At the same time, the data structure remains the same for a particular script.
We may need Datum for transaction validation because the transaction contains only the blockchain information with the incoming EUTxOs. For example, we want to exchange one token within a transaction. But, we need to get the exchange rate from an external source. This source sends its EUTxO to the transaction, which contains the exchange rate in Datum.
Also, wallets have an additional wallet backend structure. It allows them to process payments and facilitate off-chain code involved in on-chain code execution. Outputs are locked by validator scripts, and inputs are unlocked with redeemer scripts.
Before the Gauguin era, Cardano's UTxO model was criticized for the concurrency issue. Different algorithm units can perform simultaneously with the same smart contract. For example, an account-based blockchain allows multiple users to operate on one smart contract at once. DApp runs quickly and efficiently. So, in the case of shared state, concurrency can lead to deadlock or resource contention issues.
EUTxO can be used once and fully, so it is easier to validate the transaction. Unfortunately, when two or more parties try to use the same EUTxO, the system can not verify the transaction. In the case of smart contracts, many users interact with its protocol, so they will have to send a transaction several times. It will continue until the platform can include it in the block and process it. As a rule, it takes 1 to 20 seconds to start a new block.
The UTxO model is less vulnerable and centralized than the one account based on Ethereum. It is significant for decentralized DeFi platforms. So, developers pay much attention to the concurrency issue and try to solve it. For example, they build and control many UTxOs with different NFTs, which contain the same data. Moreover, developers store all transactions of the same UTxO into one block and process them together.
We can solve the concurrency issue through a centralized coordinator. However, the Plutus platform does not have a global state or "Cardano virtual machine" that will evaluate the system and connect all the Plutus smart contracts. It is not the only possible solution. IOHK offered to reach the maximum level of the concurrency. Developers should write codes to limit any conflicts. For example, it is necessary to avoid shared states and random dependencies.
The system needs to shift from concurrency to parallelism. Cardax also suggested a solution. They released the Streaming Merge algorithm, which delivers user actions into a single time-based stream and processes it through the converter. Cardax released the algorithm in a shared library, and everyone can access it.
Keep calm and scale on
One of the main reasons why blockchain has not won everyone's love and has not been introduced everywhere is the scalability issue. Users faced technology capacity limitations when the decentralized Bitcoin network launched. Since then, blockchain projects have been trying to solve this issue.
The problem origins are in the block propagation delay. Each new block needs time to get to the network nodes. If the information distribution takes too long, network segments will have different states. Finally, it will compromise the network integrity and endanger its security.
The larger the block is, the memory capacity is expanded respectively. The transaction chain will be faster as well. We can regulate the Cardano block size. The developers have increased the block size by 12.5% to 72 KB lately. Then, they increased it by 11% to 80 KB. Every block contains no more than 5 transactions (16 KB each). So, the next expansion will be done in an ad hoc approach. It seems that the developers will restrain it until a critical need.
If the block size increases rapidly, the number of people who can run nodes will decrease. However, large block processing demands powerful hardware, and big transactions require high commissions. As a result, a reduced number of full network nodes can lead to network centralization. Moreover, it will increase the number of orphan blocks and branch the network.
The Cardano chain efficiency is not high. The blockchain can process 257 transactions per second (TPS) max. In comparison, Bitgert processes up to 100,000 transactions per second and launches a new block in 15 seconds. However, Cardano's throughput is quite less. According to Sundaeswap, the average number of transactions for Plutus smart contracts is 0.15 TPS. It is a maximum of 12,960 transactions per day.
According to Tim Harrison, VP of Community and Ecosystems at Input Output Global, they plan network optimization for 2022. This work will help it scale and become more functional. Plutus will be updated in the Basho era, increasing Cardano throughput in June 2022. The main update is the Vasil hard fork, named after the Bulgarian mathematician Vasil Dabov. In April, Charles Hoskinson, Cardano Founder, announced the approaches to scaling Vasil. They are pipelining, new Plutus CIPs, UTXO on-disk storage and Hydra.
In particular, pipelining will speed up the block allocation and reduce block propagation delay. It will improve reference scripts that can reduce the transaction size and the cost of script execution. Moreover, pipelining will increase throughput. Cardano has also adopted RINA. It is a little-known network topology that resembles the torrent protocol. It introduces the Internet as a layer for nodes interaction and exchange of state information. Also, RINA allows us to add new networks, keeping them confidential and transparent.
Interoperability: different blockchain operation is not easy
The interoperability issue is general for all cryptocurrencies. There is no way to make a transaction between different cryptocurrencies or the blockchain ecosystem and the centralized financial system. Every blockchain system has its tokens and smart contracts. For transactions, the blockchain needs to prove to another one that the token possession information and smart contract execution are correct.
Bank laws contradict the blockchain philosophy. For example, the metadata control over a bank transfer (recipient, sender, income code etc.) does not comply with the crypto transaction confidentiality. It is the reason why the parties do not trust each other. Crypto exchanges are the only credibility.
Cardano has been working on the compatibility issue since its beginning. The developers consider the partial metadata disclosure. It will allow us to pay for goods and services using crypto and make quick private transfers. In 2021, the IOHK team announced their work on smart contract communication based on Ethereum through the sidechains. These are parallel chains that make transactions between two parties outside the chain.
It is possible for Cardano due to the KMZ protocol support. It transfers assets securely from CSL to another Cardano layer and the blockchains of the current protocol. So, Cardano becomes a decentralized data platform where blockchains can “flow” into each other without intermediaries.
- Cardano is an open-source decentralized blockchain DApp development platform with layered architecture and verifiable smart contracts. However, after more than six years, it is criticized for its slow development and limited features.
- We launched Plutus, the smart contract writing platform, but the PAB is not user-friendly. Developers run smart contracts via CLI through a local computer, expecting the PAB deployment on a remote server without a wallet. The server should synchronize with the test net, storing the chain index and the PAB databases. After that, the user can operate with contract endpoints by sending server requests.
- One EUTxO allows you to withdraw a transaction only once. Users may face the concurrency issue while accessing the same UTxO. Some developers have already found solutions.
- Cardano solves the scalability issue that is common to all blockchains. Trying to reach a better throughput and transaction speed, the developers increased the block size to 80 KB, launched the Vasil hard fork and adopted the RINA protocol.
- Cardano solves the interoperability issue through sidechains.