The Future Of Smart Contract Programming Languages

Aiken is a novel and accessible programming language, specifically created to both simplify and enhance the development of smart contracts on Cardano. It comes in an easy to learn syntax, designed for effortless integration with other tools and languages, plus includes various state-of-the-art features that meet the current expectations of developers.

In true open source fashion, Aiken arose from the dedicated efforts of various individuals. After the original kickoff with the support of TxPipe, new developers showed an interest in the project, deciding to add their time and attention to assisting it. The Cardano Foundation, too, sees the potential of Aiken, how it can foster growth in the Cardano ecosystem by providing smart contract development with an optimized developer experience. We invite everyone to learn more about Aiken, and extend a warm welcome to anyone interested in participating in this recently released alpha phase.

Perceiving the gaps

It is well-known that the Haskell Plutus platform – up until now the only fully developed smart contract language on Cardano – often becomes difficult or even frustrating to use. In fact, setting up a working Haskell environment can prove challenging, especially when it involves ad-hoc compiler plugins such as PlutusTx – the Glasgow Haskell Compiler (GHC) plugin for compiling Haskell source code for the Cardano chain. Accessories like language servers – tools that enhance the programming experience by integrating with code editors – usually do not work with default installation settings and are cumbersome to configure. Moreover, since the Plutus platform is tied to Haskell’s existing language but then adds different built-in libraries, ecosystems, and program semantics that differs from standard Haskell, it often leads to confusing situations – even for a seasoned Haskeller. Finally, the Plutus platform discourages the use of other languages for off-chain code, thus preventing teams from working with their usual tools and languages for what represents, in the end, a large portion of their decentralized application. While it is possible to adopt a different language for all off-chain infrastructure, the interfacing with the on-chain code can be clunky and hard to troubleshoot. Yet, even with these roadblocks, many projects choose to adopt different languages for their off-chain code.

This, however, does not have to be the only way. Languages like Rust and Elm have pushed the experience of writing code to new heights. For example, Elm makes it impossible to have runtime errors by keeping the boundaries between a program and the outside world behind a clear and safe separation, restricting how the code being written interacts with outside code, systems, or application programming interfaces (APIs). On top of that, it makes programming a joy, and considerably reduces the language entry barrier so that anyone can become productive immediately – even on large codebases.

Rust, on the other hand, reconnects with manual memory management and mutability, but with an innovative approach which prevents simple, yet potentially, catastrophic mistakes. It also keeps on continuously pushing the boundaries of what tooling can do for developers and how developers can embed more intelligence in day-to-day development practices.

These languages and platforms offer a more seamless development experience for developers, making it easier to write high-quality and robust code. Hence, ecosystems that do not meet these standards may struggle to attract and retain pragmatic developers. Aiken arose precisely to address this gap.

Cardano’s architecture and smart contract virtual machine allows for third-party tooling and new languages to be created on top of it. In fact, the Cardano ledger is not executing Haskell on-chain. Every node comes with a Plutus interpreter that is responsible for running script validators on-chain. This interpreter runs a low-level language called Untyped Plutus Core (UPLC). This is the language that the Haskell Plutus platform compiles to. And now, so does Aiken.

Aiken code diagram

Introducing Aiken and how it operates

Aiken introduces a new, easy-to-learn programming language designed to bring the Cardano smart contract development experience up to the level that developers expect in 2023. Since it is purpose-built for Cardano, it includes a variety of domain-specific conveniences to make the development process easier and more efficient. Among others, these include:

  • Helpful and quick compiler feedback
  • Automatic code formatting
  • A language server with editor integrations
  • A testing plus benchmarking framework
  • Documentation generated from code comments
  • An interoperable and portable binary specification format (CIP-0057)

Aiken code sample 1

Aiken aims to reduce the time it takes for developers to get started and finish their projects. The team wanted to turn what is currently a multi-day setup experience into a 10-minute quickstart without compromising any of the security and quality aspects. For this reason, Aiken features a familiar C-family syntax while still being a purely functional language. In many ways, it is syntactically similar to Rust and TypeScript.

Aiken code sample 2

To briefly explain the process, a compiler is a program that converts code written in one programming language into code that can be executed by a computer – like a CPU and low-level machine instructions. In the case of Aiken, the compiler takes code written in Aiken, performs a variety of checks on it, and then outputs Untyped Plutus Core programs that can be used on the Cardano blockchain. Technically speaking, Untyped Plutus Core is a polymorphic lambda calculus with added built-in functions specific to the Cardano chain and used, for example, to verify signatures. These translations of a programming language into another one are not usually written by hand. Instead, machines should write and interpret them. Compilers allow developers to use more expressive languages that are easier to learn and reason about, and still produce machine instructions understood by the underlying execution engine. They can be applied when dealing with a desktop machine or an Internet browser, or, in our case, with the Cardano blockchain.

Aiken hello world

Writing our own compiler means we can look for cases specific to writing smart contracts and provide better feedback from the compiler, as well as extra guidance when it comes to writing contracts. Plus, the language is geared towards readability so that it becomes easy to audit and reduces the chance of getting something wrong.

Besides the programming language, Aiken also provides a toolkit for working with Cardano smart contracts and, in particular, with low-level Untyped Plutus Core. Aiken offers an approachable way to decompile on-chain code into a higher level representation. It can evaluate scripts in the context of a transaction and report execution costs, akin to how the Cardano ledger embedded in each node does it.

Aiken’s history, present, and future

The project started as a conversation between engineers from different horizons, being brought to life with the initial support of TxPipe from shared goals and a common philosophy. It didn’t take long before the Cardano Foundation decided to support the project and accelerate its development. Today, the project has outgrown its two initiators and has started planting roots in the Cardano community at large.

“When the idea of developing a new language and toolchain from scratch was first mentioned, it appeared quite daunting, something that would require a team of 10 engineers and several years of development.

In less than a year, surpassing all expectations, Aiken is now ready for an alpha release. The skill and expertise of the core team are truly remarkable. The outcomes are a testament to the power of open source development and the collaborative spirit within the Cardano community.

With the immense support provided by the Cardano Foundation, I’m confident that Aiken will have a profound impact on our ecosystem, fostering innovation and empowering developers.”

Santiago Carmuega – TxPipe

Aiken is a prime example of open source, with contributors from the Cardano community collaborating on many fronts and sharing their feedback. Moreso, to build a strong ecosystem around the language, the Aiken team made sure to provide a package manager that encourages the development of open source libraries with clean and easy-to-host generated documentation. We look forward to seeing the Aiken libraries the community will develop and share.

To help anyone interested in getting started with Aiken, we created a “hello world” tutorial as a quickstart guide for those who want to hit the ground running. Even prior to any announcement, over 30 pioneers have already completed the tutorial, and we encourage others to join the growing Aiken community by trying the tutorial themselves. Besides the tutorial, the Aiken team worked on numerous documentation regarding the language and how to write smart contracts on Cardano, all hosted on public repositories and easy to contribute to, so that it can improve and grow over time as well.

We at the Cardano Foundation, along with the entire Aiken team, are thrilled to see Aiken enter its official alpha phase. Although this means that all the main features have been implemented, some rough edges and bugs might still require ironing out. Similarly, even if the alpha already comes with the essential functionalities to productively write, test, document, and benchmark on-chain contracts for Cardano, it is important to exercise caution when using Aiken in production. We do not recommend doing so at this stage.

The Aiken team will conduct thorough audits of Aiken this year to ensure it meets the robustness standards expected of an enterprise-grade toolkit. If Aiken is to be responsible for managing significant amounts of assets, it is crucial to provide all necessary guarantees. Robustness stands as an integral part of Aiken’s philosophy, alongside ease of use. Part of this journey towards mainnet requires onboarding developers early-on, as only true user feedback can give us any hope of shaping this tool correctly for the long run. We henceforth call on the first Aiken pioneers to join us in this adventure and help us make Aiken the future of Cardano smart contract development.

After months of intense work, we are delighted to have reached this milestone, and it becomes important to thank the many people who ensured the project got to this stage. Nothing important is ever built alone. Aiken would not have made it past so many hardships without the support of multiple contributors who gave their time and attention to improving Aiken.

Whether by doing the “hello world” tutorial, providing feedback, opening discussions, or writing some Aiken code, the Cardano Foundation invites every and anyone to participate in building Aiken further. We hope it will bring a bright future to smart contracts on Cardano.

Related Posts