Cardano (ADA) and Plutus overview

Published: 2023-01-20 10 minutes
Category:
web3
▪ Tags:
blockchain
cardano

Cardano is built on Haskell and based on the dedicated Ouroboros consensus algorithm. Plutus is Cardano's smart contracts platform. ADA is a cryptocurrency. How does it work?

Cardano was founded in 2015 by Charles Hoskinson, formerly working with Vitalik Buterin, the main creator of Ethereum.

The Cardano Foundation is responsible for the development of Cardano. The development of the blockchain is actually exclusively handled by Input Output . This is a blockchain technology development and research company founded by Hoskinson and Jeremy Wood.

Cardano advertises itself as a 3rd generation blockchain. What does this mean? This gradation is a more or less formal way of describing the sophistication and development of blockchain platforms.

The first generation of blockchain was Bitcoin, where the blockchain had a single function. In the case of Bitcoin, blockchain functionalities focused on providing the functionality of digital money, which is Bitcoin.

The second generation blockchain started with Ethereum, being a system where we can run smart contracts. The second generation blockchain, is a ‘global computer’ that can offer multiple functionalities, thanks to its programmability.

The third-generation blockchain focuses on the development of the second-generation blockchain, trying to find the optimal solution to blockchain problems such as broad scalability, security, ability to implement updates, dispute resolution, etc.

Cardano’s blockchain cryptocurrency is ADA. The total supply is expected to be 45 billion, with over 35 billion currently on the market. 57.6% of the total supply was sold during the ICO. The POS process of creating a new cryptocurrency delegates a portion of the newly created tokens to the Cardano project development fund.

Cardano is an interesting blockchain primarily because of its scientific approach to the development of blockchain technology. One can find a lot of scientific studies justifying Cardano’s design decisions. IOHK employs specialists with a strong academic background and competent engineers. Cardano aims to compete with Ethereum, the largest programmable blockchain.

How is Cardano built and how does it work? Cardano key features

Cardano is built on Haskell – a functional and, let’s not hide it, difficult programming language. The functional paradigm aims at making the software easy to maintain and ultimately reliable.

Ouroboros is the POS-type consensus algorithm used in Cardano. This means that there are no cryptocurrency miners in Cardano. It is a specialised algorithm based on scientific research and differs from Ethereum, for example, in that there are no ‘penalties’ for rogue validators (block creators) in Cardano, yet the algorithm ensures that the network works correctly as long as 51% of the ADA cryptocurrency used for POS is used by honest nodes. Consensus is a key feature of any blockchain, I will devote a separate post to it.

Cardano is similarly, like Bitcoin, based on UTXO. It is a feature of the architecture of the “ledger” itself – blockchain, i.e. the way data is stored and cryptographically secured in the blockchain. The use of UTXO is a very distinctive feature of Cardano. It has a very big impact on how smart contracts are handled, how data is read, but also how the blockchain scales. This is also a topic for separate posts.

Cardano has a technological mechanism that allows for easy hard-forks, the so-called hardfork combinator. This makes it possible to make new changes to the blockchain in a way that ensures the correct operation of the network.

Hydra is a 2-layer solution based on so-called state channels. The idea is similar to the operation of the Lightning Network. Mithril is a so-called multi-signature scheme.

Cardano has so-called ‘native tokens’, i.e. the ability to create ERC-20 and ERC-721 (NFT) tokens built into the blockchain. In Ethereum, tokens are created by uploading the corresponding smart contract to the network.

Cardano supports the construction of sidechains. IOHK is working on building an EVM sidechain to support the launch of Ethereum contracts.

A block in Cardano is 88KB and is created every 20 seconds. We can measure Cardano’s performance in hundreds of tx per second, but it is not a blockchain that promotes thousands or even tens of thousands of tx per second (such as Solana).

The average cost of a transaction on Cardano is around ADA 0.17 (currently 25 cents).

Smart contracts in Cardano

Cardano is a 3rd generation blockchain, a programmable blockchain platform. Cardano is a system analogous to Ethereum – a programmable computer. However, the data architecture that makes up the blockchain in Cardano, is analogous to… Bitcoin. What does this mean?

Cardano’s data architecture is based on EUTXO. This means extended (extended) UTXO. To understand UTXO, we need to know the classical blockchain data model.

The data in each blockchain is stored in cryptographically secured blocks. The blocks have transactions, i.e. descriptions of the changes to be made to the blockchain. A transaction is, for example, the transfer of a cryptocurrency from one address to another, but also the execution of an exchange on the decentralised Uniswap exchange, which triggers a ‘smart contract’ by storing data on the blockchain about the purchase/sale performed. The data in the blocks create a history of changes on the blockchain, with the consensus algorithm and cryptography guaranteeing its security and immutability.

Ethereum, as a programmable blockchain has, in addition to the blocks, another special space described as the ‘system state’ (world state). This always reflects the current, latest state of the data. For example, by sending 3 times 1 Ether from account A, to B – in the world state, B will finally have 3 Ether’s, although we will find 3 separate state change transactions in the blocks. In the same way, the data updated by the smart contract changes. This data structure makes it easy to read, data access is fast (indexed). Each node in the network has its own independent ‘world state’, which should be the same after processing all transactions at all nodes.

Wanting to check the state of your Bitcoin holdings by address X, you need to… scan every block and every transaction in the Bitcoin blockchain. Why? Because Bitcoin does not have a world state. Just like Cardano. The smallest data structure carrying information in Bitcoin and Cardano is UTXO. In Bitcoin, the data that the UTXO holds is information about the “amount of Bitcoin” available to spend. If a UTXO with the notation “1 BTC” is assigned to an address, the address controls 1 BTC. Cardano’s EUTXO, in addition to information about the amount of cryptocurrency, also holds data and even the smart contract logic itself.

EUTXO makes the data operation (and the programme in Cardano) a literal iteration, going through a chain of related UTXOs. A UTXO can be issued and, when issued, is marked as ‘out of date’, but a new UTXO is created, having an updated data state. The operation of smart contracts in Cardano, is precisely the process of creating new EUTXOs and marking old ones as obsolete.

In order to let you understand the construction of smart contracts (contracts) in Cardano, I will explain the construction and operation of a classic contract, i.e. as we can implement in Ethereum, the first and still market-leading programmable blockchain. A contract in Ethereum is a “small” computer program, i.e. a set of data and instructions to process this data, to perform certain operations on it. Such a contract, as a ‘package’, we have the possibility to upload to the blockchain network. Such a program becomes an immutable part of the blockchain and, from the moment it is loaded, the blockchain guarantees its immutability (the instructions of the contract cannot be changed). It also becomes globally accessible and visible to the entire blockchain network. The contract is given a unique address on the blockchain network. Knowing this address, we are able to interact with this contract, i.e. run its functions, which can, for example, write new data to the blockchain or read existing data (previously written by the contract). Depending on the security features of the contract (we program them), other users of the blockchain and even other contracts can interact with our contract. To summarise: the idea is simple – contracts in Ethereum are programs that exist on the blockchain.

Contracts in Cardano are not individual programs loaded into the blockchain, accessible at a specific address. In Cardano, we write small blocks (in the form of EUTXO) to the blockchain that represent either data or logic/rules of use/property rights to that data. Invoking a smart contract, involves writing a transaction to the blockchain in which we indicate existing data blocks (EUTXOs), blocks with rules for processing them (script EUTXOs) and data ‘unlocking’ existing data blocks. The ‘unlock’ data provided in a transaction, unlocks the data blocks (and allows new ones to be written to the blockchain) only if they match (unlock) the rule blocks. This separation of data from rules, the recording of small, independent blocks in the blockchain (EUTXO) and the idea of ‘unlocking’ is what Cardano is all about.

Plutus, or smart contracts in Cardano. Here are the basics of creating web3 solutions on Cardano 💬👇

Plutus is the smart contracts platform in Cardano. A rather broad term, as the name ‘Plutus’ is by Cardano part of several important Cardano products/technologies including Plutus Core and Plutus Framework.

Web3 solutions for Cardano are developed in Haskell. The program code is compiled (difficult word) into Plutus Core, which is the ‘language’ understood by the Cardano blockchain. From the perspective of the user, the programmer – about Plutus Core only worth knowing, we use Haskell 😉

Web3 applications for Cardano have a different architecture than applications for Ethereum. In web3 Ethereum there is a smart contract loaded into the network and a client (e.g. the user’s browser) that interacts with this contract. In Cardano, there is a client, a backend application and code with data (smart contarct) stored in the blockchain.

The backend application in Cardano, can be created using the Plutus Framework, the official Cardano framework. It will allow us to easily program a backend application framework that will allow interaction with the client and give it the ability to construct data and contracts written to the blockchain.

In Cardano, the smart contract as part of the so-called on-chain code processed by the blockchain nodes is very small. This distinguishes Cardano from other blockchains. The on-chain code is a simple condition that, when provided in a transaction: the input data (EUTXO representing the data on the blockchain) and the unblocking data of the input EUTXO, is supposed to decide whether the input data can actually be unblocked. In Cardano, the on-chain code is called ‘validator script’, the EUTXO input data is called ‘datum’ and the unlock data is ‘reedemer’. If the validator script checks that the reedemer matches the datum, then the processing of the ‘smart contract’ is correct and the new data can be written to the blockchain (as a result of the processing of the smart contract).

In Cardano, an important part of the web3 application is the backend/server part, run by the web3 solution provider. Although it does not have the possibility to interfere with the correctness of the processing, it is needed and must work for the whole to function. Unlike in Ethereum… There, all that is needed is the user and the blockchain. In a working web3 Cardano solution – the backend part is also needed.

web3
blockchain
cardano