Fundamentals
Getting Started

Getting started

Checklist

Here's a little checklist to get started with Aiken. Use it if you don't know where to start.


Want more?


Creating a new project

Use aiken new foo/bar to create a scaffold a new project and follow instructions from the generated README.md at the root of your project. On success, your project should look roughly as follows:

.
├── README.md
├── aiken.toml
├── lib
│   └── bar
└── validators

Compiling a project

Use aiken build to compile a project, and aiken check to only type-check a project and run tests.

If you're writing a library aiken docs is a powerful utility to generate HTML documentation from types, type annotations and comments. Abuse it!

Finally, once compiled, you may look at the aiken blueprint command group to generate addresses, apply parameters and convert the build output to various formats.

Project structure

Folder organisation

Aiken projects divide their source code in two categories: library code, and application code. Library code must be located in a lib folder, and application code (i.e. on-chain validators) located in a validators folder.

After compilation, the compiler will generate a Plutus blueprint (plutus.json), which is an interoperable document that summarizes your project. The blueprint also contains compiled code for each validator of your project and their corresponding hash digests to be used in addresses.

Configuration

A project has a top-level aiken.toml file at its root containing metadata about the projects, as well as dependencies required by it. Here's a sample of (documented) project configuration:

aiken.toml
# Project's name, as {organisation}/{repository}
name = "foo/bar"
 
# Project's version, we recommend semantic versioning for libraries. However,
# any UTF-8 string is accepted.
version = "1.0.0"
 
# [Optional]
#
# A license name. We recommend Apache-2.0 or MPL-2.0 for open source projects.
licence = "Apache-2.0"
 
# [Optional]
#
# An informative albeit short description of the project.
description = "A next-level DeFi platform"
 
# [Optional]
#
# Structured information on a project to show in generated documentation.
[repository]
platform = "github"   # Platform type, only `github` for now.
user = "aiken-lang"   # Username or organisation on that platform
project = "stdlib"    # Repository or project on that platform
 
# [Optional]
#
# A list of dependencies. Avoid editing by hand, use `aiken packages` to manage
# them.
[[dependencies]]
source = "github"            # Platform type, only `github` for now.
name = "aiken-lang/stdlib"   # The github project, in the form of {organisation}/{repository}.
version = "main"             # Version, as a git tag, branch name or git commit hash

Well-known packages & modules

Aiken's prelude

The prelude contains a minimum set of functions, constructors and modules available by default to all Aiken projects. You can find it on aiken-lang/prelude (opens in a new tab) and at the bottom of this website.

Aiken's standard library

The standard library (or stdlib in short) gathers useful functions and data-structures that might come in handy in your Aiken programming journey. It's also a good reference of well-written and well-tested Aiken code if you need some examples to get started with. You can find it on aiken-lang/stdlib (opens in a new tab) and at the bottom of this website.