In a previous blog, we discussed the specialized role of the on-chain Cardano blockchain developer responsible for writing on-chain code for a Cardano dApp that gets deployed to the blockchain and executed by the nodes in the network. To write this on-chain code, Cardano developers can use different programming languages.
The Cardano network was made to be versatile and inclusive. It chose Haskell as its core language, but at the same time, it created the tools to open the network for any alternative. The push is to enable various possible solutions while ensuring the same level of security.
This has created a very special ecosystem for Cardano, one where there are multiple alternatives to writing on-chain code without compromising the security of the blockchain. This is virtually unheard of on other protocols.
Each of these languages is an alternative to the on-chain code that does not compromise the security of smart contracts. As such, it’s a matter of preference which one to use and not so much about properties that make them better than each other.
Let’s look at the different programming languages for Cardano on-chain code below.
The first language on the list is PlutusTx.
It’s the supported method to write on-chain code by the team at IOG. It’s a domain-specific language that was created based on Haskell and as such mirrors the syntax of its parent language almost 1-to-1.
PlutusTx is the main method that is backed by the Cardano core entities. For this reason, it has the most support in terms of code base, resources, documentation, and educational material in the Cardano ecosystem. It has already received a major overhaul after the Vasil hard fork and the introduction of PlutusV2.
In the future, this pattern is expected to continue. The core developers will improve the features of Plutus and other teams will have to catch up with their changes. This is why it’s recommended to learn Plutus for everyone looking to enter Cardano development.
Aiken is one of the alternatives to PlutusTx for on-chain code.
Aiken borrows some of the syntax of Rust and incorporates it into a friendly tool for Cardano developers. The team behind Aiken, Txpipe, has focused on creating an easy-to-use compiler that uses Rust’s package manager to provide readable error messages that can help zero in on the issue quicker and easier.
This has made Aiken a very popular alternative to the original PlutusTx. There is a sizable pool of developers who understand functional programming but use Rust more than Haskell. Aiken has allowed them to enter the Cardano ecosystem using a language of their choice.
Additionally, Aiken provides some gains on the size of the transaction. It’s the size that determines the fee amount, so any gains on that area make transactions and therefore by extension dApps cheaper to use.
The Helios toolkit also has the distinction of working for both on-chain and off-chain code! The creators of Helios have developed a version for each of the sides of a Cardano dApp. So, developers no longer need to use one type of language for on-chain and then switch to a different one for off-chain.
The Helios language can also be used to calculate and manage Cardano assets during a transaction. This makes it one of the most versatile alternatives in the Cardano ecosystem for programmers of all backgrounds.
Opshin is a language that uses 100% valid Python code for on-chain logic on Cardano.
It’s the main alternative for those looking to build on the network that have a background in Python. There is a large community of data analysts that come from Python that can benefit from this alternative.
The language is easy to install and start to use for those familiar with Python. It supports both imperative and functional paradigms without compromising the core design of Cardano smart contracts.
Plu-ts developed by Harmonic Labs is another Typescript alternative for on-chain code.
The implementation of the language also provides tools to write off-chain code, so it allows developers the ability to use the same syntax for both portions of the Cardano dApp.
Additionally, Plu-ts aims to give developers more control over the compiled code. This means the size of a smart contract can be optimized to make it cheaper for the user. This means dApp developers can further push Plu-ts to make their platforms cheaper to use.
Plutarch is another domain-specific language albeit only for on-chain code based on Haskell. It is considered as a low-level language. If we compare PlutusTx + Haskell to be similar to a general programming language like C/C++, then Plutarch can be seen as akin to assembly language within the Cardano ecosystem.
The main objective of it is to optimize the size of a validator to make transactions as cheap as possible. At the moment, Plutarch is the language that proves the smallest validators for Cardano dApps.
This has made Plutarch the first choice for dApps that want to optimize their fees as much as possible. It’s an advanced option for developers proficient with Haskell, as it relies more on the core features of its parent language than other alternatives. For this reason, it’s not very beginner-friendly, but certainly a viable choice for Haskell veterans.
There we have an almost comprehensive list of all the different ways to write on-chain code on Cardano. Except for PlutusTx, all the other projects were created by the community and are supported by independent teams.
All of them share the same core security properties and don’t compromise Cardano in any way. This means that the choice of which one to use comes from the experience of a developer team. All of the choices are 100% viable and each is being improved constantly by the Cardano community.
EMURGO is a global blockchain technology company that supports builders, organizations, and others to adopt Cardano for Web3 products and services.
To receive updates on Cardano and EMURGO, follow EMURGO on X (formerly Twitter) for details about the latest announcements, Cardano education courses, project funding, Cardano-related events, and more.
- Official Homepage: emurgo.io
- X (Global): @EMURGO_io
- YouTube: EMURGO channel
- Facebook: @EMURGO.io
- Instagram: @EMURGO_io
- LinkedIn: @EMURGO_io
You should not construe any such information or other material as legal, tax, investment, financial, or other advice. Nothing contained herein shall constitute a solicitation, recommendation, endorsement, or offer by EMURGO to invest.