Skip to main content

Aiken

Aiken is a modern smart contract platform for Cardano, a pure functional programming language that's small, easy to learn, and built for robustness. This means that most of the time, the compiler is smart enough to determine the type of something without requiring user annotation. Writing smart contracts should be easy and safe. With Aiken, you can get started in minutes, not days, and rapidly build confidence that your on-chain code does what's intended.

Aiken Overview1

A Language Built for Smart Contracts

Aiken brings strong static typing with inference, first-class functions, custom types, and modules. The language compiles directly to Untyped Plutus Core (UPLC), Cardano's native smart contract execution format, giving you full access to the blockchain's capabilities. Its syntax resembles other modern languages like Rust, Elm and Gleam, but Aiken is specifically designed for smart contract development and natively supports the mental model required on Cardano.

Purpose-Built for Smart Contracts

Unlike many other languages adapted for blockchain use, Aiken was designed from the ground up for smart contract development. This focused approach means every feature serves the goal of writing secure, auditable on-chain code.

Modern Development Experience

The platform provides a single toolchain with minimal configuration that handles everything from compilation to testing. You get quick, friendly feedback with helpful error diagnostics that actually make sense, plus Language Server Protocol support for autocompletion and real-time error checking in VS Code, Zed, Vim/Neovim, and Emacs.

The built-in testing framework supports both unit tests and property-based testing. Execution cost evaluation and trace reporting help you optimize your contracts before deployment.

Understanding the Architecture

Haskell Not Required

A common misconception is that Cardano smart contracts must be written in Haskell. The reality is that Cardano's virtual machine executes Untyped Plutus Core (UPLC), and Aiken compiles straight to UPLC, just like Plinth or Plutarch which are written in Haskell. Haskell is just one of several ways to "generate" UPLC, not a requirement.

Aiken focuses exclusively on on-chain validator scripts. These define the logic that validates Cardano transactions. For off-chain stuff like building transactions, wallet integration, and UIs, you'll use other tools from the Cardano ecosystem.

Getting Started

Install Aiken using aikup, the official installer and version manager:

Install via npm
npm install -g @aiken-lang/aikup

Aiken Overview2 Aiken Overview3

Next Steps

Visit aiken-lang.org for the complete language guide, tutorials, and extensive documentation. The GitHub repository contains examples and a highly active community.

Continue the journey and join the developer community on TxPipe's Discord for further support and guidance.

Educational Resources

Aiken Smart Contract Development Course

CourseNameVideo
1/15Intro OrientationWatch Video →
2/15Installation and SetupWatch Video →
3/15First ValidatorWatch Video →
4/15Marketplace SetupWatch Video →
5/15Datums and RedeemersWatch Video →
6/15Delist RedeemerWatch Video →
7/15Buy RedeemerWatch Video →
8/15Edit RedeemerWatch Video →
9/15Unit TestsWatch Video →
10/15Testing - BuyWatch Video →
11/15Testing LibraryWatch Video →
12/15Testing - EditWatch Video →
13/15Testing - Testing TracingWatch Video →
14/15Project - Transaction CounterWatch Video →
15/15Project - Fractionalized NFTWatch Video →

Project Based Learning with Andamio

Continue with Aiken Project Based Learning that takes you from beginner to advanced Cardano smart contract development concepts.

CourseNameVideo
101Getting Started with AikenWatch Video →
102Writing Your First Smart ContractWatch Video →
103Running Tests with Mock TransactionWatch Video →
201Writing Smart Contracts with Validation LogicWatch Video →
202Writing Smart Contracts with Validation Logic on InputsWatch Video →
300Blueprint - Compile Scripts for DAppWatch Video →
301Architecture for your Decentralized ApplicationWatch Video →
302Bad Contract ExamplesWatch Video →

I Can Aiken (Book)

I Can Aiken is an open-source developer’s guide to writing secure, modern blockchain scripts on Cardano using the Aiken language.
Written by John Greene, the book is designed to be approachable for new developers while still offering depth for advanced readers.

The book covers essential topics like:

  • Fundamentals of Aiken
  • Writing secure validator scripts
  • Common smart contract patterns
  • Vulnerabilities and design pitfalls to avoid
  • Practical examples you can reuse and adapt

The project is open source and available in the Cardano Academy GitHub repository.
This makes it easy for the community to contribute improvements and for educators to integrate it into courses and workshops.

Danolearn

Visit Danolearn for an interactive learning experience.

Blogs

Examples

  • Visit Awesome Aiken repository to find a curated list of open-source projects using Aiken.
  • For advanced design patterns, check out the Aiken Design Patterns repository.

Development Workflow

Development Steps
  1. Write your validator: Define types and validation logic in .ak files
  2. Build: Run aiken build to generate plutus.json with compiled scripts
  3. Use off-chain: Import the compiled scripts in your off-chain application
  4. Parameterize if needed: Apply parameters to scripts before deployment

Common Utilities/Helpers

Reusable Patterns

These functions create reusable validation logic for common operations. These utility functions eliminate repetitive code and provide safe, tested implementations for common validator operations:

  • To discover a list of utility libraries providing functions to streamline common operations, visit Aiken Package Registry.
  • A great library of reusable functions to simplify your dev workflows which gives you a access to common use cases to be imported into your Aiken project. Definitely check out Vodka.

Testing in Aiken

Testing in Aiken

Aiken provides first-class support for both unit tests and property-based tests. Tests run on the same virtual machine as your on-chain code and report CPU/memory costs, making them effective benchmarks. Tests must return True to pass.

Debugging

  • Gastronomy, is an advanced tool that lets you step through Cardano smart contract code, line-by-line.
  • Aiken Playground is an online environment where developers can test and experiment with Aiken functions and smart contracts without needing to install software on their local device.