Credit: © Hurcastock! - https://www.hurcastock.com

A modern smart contract platform for Cardano

A pure functional programming language

  • Small and easy to learn
  • Strong static typing with inference
  • First-class functions, everything is an expression
  • Custom types, recursion, modules, generics...
  • Modules, imports and package manager
validator {
  fn hello_world(datum, redeemer, context) -> Bool {
    let must_say_hello =
      redeemer == "Hello, World!"

    let must_be_signed =
      list.has(
        context.transaction.extra_signatories,
        datum.owner,
      )

    must_say_hello? && must_be_signed?
  }
}

A modern development environment

  • Zero configuration, one single capable tool
  • Quick and friendly feedback with helpful error diagnotics
  • Language-Server Protocol (LSP) with auto-formatting
  • Easy-to-produce and beautiful libraries documentation
  • Editors integration (VSCode + NeoVim)
Error: err::aiken::check::unknown_record_field

× While trying to make sense of your code...
╰─▶ I looked for the field 'extra_signatures' in a record
    of type 'Transaction' but didn't find it.

   ╭─[examples/hello_world/validators/hello_world.ak:18:1]
18 │   let must_be_signed =
19 │     list.has(
20 │       context.transaction.extra_signatures,
   ·       ────────────────────────────────────
21 │       datum.owner
22 │     )
   ╰─────────────────────────────────────────────────────

help: Did you mean 'extra_signatories'?

A toolkit for working with Plutus

  • Baked-in unit test framework
  • Optimized for on-chain execution
  • Full-blown Plutus interpreter & disassembler
  • Execution cost evaluation with trace reporting
  • Low-level scripts arguments injection
Compiling aiken-lang/stdlib 0.0.0
  Testing ...

    ┍━ aiken/option ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
    │ PASS [mem:   5099, cpu:   1884852] or_else_1PASS [mem:   5963, cpu:   3091855] map_1PASS [mem:  11985, cpu:   5076974] map_2PASS [mem:   6863, cpu:   3298855] and_then_1PASS [mem:  14187, cpu:   5872937] and_then_2PASS [mem:  11657, cpu:   4918544] and_then_3
    ┕━━━━━━━━━━━━━━ 13 tests | 13 passed | 0 failed

  Summary 0 error, 0 warning(s)

A truly open source ecosystem

  • Written in Rust, licensed under Apache-2.0
  • Open contribution process with clear guidelines
  • 40+ contributors from the Cardano community
  • Fully documented with end-to-end examples
  • Initiated by TxPipe, Nurtured by the Cardano Foundation

Roadmap

Q3 2022

  • Binary flat encoding/encoding
  • Untyped Plutus Core (UPLC) parsing
  • UPLC pretty-printing
  • Native Plutus core interpreter
  • Cost and evaluation of Plutus programs
  • Aiken's language Proof-of-concept

Q4 2022

  • Aiken's Lexer/Parser with highlight
  • Type checking with beautiful errors
  • LSP, code formatting, editors integrations
  • Standard library, user manual & basic tooling
  • Modules & package management
  • Unit test framework

Q1 2023

  • Tutorials & user-guides
  • Interoperable smart-contract blueprints (CIP-0057 (opens in a new tab))
  • LSP on-the-fly compilation & feedback
  • Alpha release with first pioneers

Q2 2023

  • Online playground
  • Onboarding projects, old and new
  • Improving stability and developer experience
  • Compiler fine-tuning & optimizations

Q3 2023

  • End-to-end examples
  • Standard library refinements
  • More tooling & developer experience improvements
  • More LSP improvements (auto-import, go-to def, ...)

Q4 2023

  • Plutus V3 integration (BLS12-381, case/constr, ...)
  • Fixes, testing and various quality of life improvements

Q1 2024

  • Property-based testing framework
  • Plutus V3 bitwise primitves
  • Improved safety and devX on boundaries

Q2 2024

  • Export arbitrary functions to UPLC
  • Separate pairs from 2-tuples
  • Pass all marlowe acceptance tests
  • Beta release & mainnet readiness

FAQ

What is Aiken?

Aiken is a new programming language and toolkit for developing smart contracts on the Cardano blockchain. It is geared towards robustness and developer experience.


Aiken takes inspiration from many modern languages such as Gleam, Rust, and Elm, which are known for friendly error messages and an overall excellent developer experience. We believe Cardano deserves a dedicated language with these kinds of features, developed in the open with the community.

Why build another smart contract platform?

We love functional programming. Yet, we couldn't help to think that the current Haskell framework wasn't quite right in terms of developer experience and felt we could do something about it. So we came up with a set of shared goals we kept in mind while building Aiken:

  • Writing smart contracts should be easy and safe. You should be able to get started in minutes, not days, and rapidly build confidence that your on-chain code is doing what is intended.
  • We want a complete and delightful experience. A modern blockchain deserves a modern smart contract toolkit. You should be and feel productive when writing contracts. This includes editor integrations such as LSP and tree-sitter, beautiful error messages, rapid and intuitive test feedback loop and easy-to-produce documentation.
  • We want there to be as little configuration as possible. It should work out of the box and establish reasonable opinionated conventions with the community.
  • We want to have a modular design such that components can be picked and chosen as needed. Like the Unix philosophy. Aiken is only one part of a much bigger picture;. While we firmly believe it is a great tool, we want to encourage other approaches and favour interoperability as much as possible.

I thought Cardano smart contracts had to be written in Haskell?

This is a common misconception. The current Cardano node implementation does indeed happen to be written in Haskell. The virtual machine for executing smart contracts that comes baked into the node is also implemented in Haskell. But that does not mean that it is Haskell which is executed by the smart contract virtual machine.


The virtual machine is a language interpreter which executes a smart contract language called 'Untyped Plutus Core' (abbrev. UPLC) often referred to simply as 'Plutus'.


Yet UPLC isn't something developers are expected to write by hand. Instead, it is a compilation target (like WebAssembly for the world wide web). Oddly enough, until recently, the only established framework that produced UPLC from a high-level syntax was called 'Plutus-Tx' and happened to be a Haskell framework.


Aiken changes the game by introducing a new framework that compiles straight to UPLC.

Can I write off-chain/backend code with Aiken

Our main goal is to improve the smart contract development experience for the Cardano blockchain. By developing Aiken as a bespoke language, we can better align its features with what is truly needed for on-chain development.


We want to keep the language simple and manageable. In a decentralized architecture, smart contracts present a significant challenge where a single flaw can escalate into a multi-million financial exploit. More so, on-chain code typically represents a small fraction of an entire DApp source code. While writing contracts should be as straightforward as possible, smart contracts ought to be optimized for review, audit, and static analysis.


Hence, Aiken is not intended as a general-purpose language. Rather, it focuses on Cardano and aims for a high-quality toolkit for developing reliable smart contracts with confidence.

Are there any projects using Aiken? Where can I can find them?

We keep an Awesome List of projects and resources built with and on Aiken. The list contains resources that we are aware of.


If you have a cool project not listed but want to see it up there, do not hesitate to make a pull request and introduce yourself!