Aiken Documentation

repository·main·Indexed 20 days ago

https://github.com/aiken-lang/aiken

A modern smart contract platform and toolchain specifically designed for the Cardano blockchain. It includes a specialized language for writing secure, efficient smart contracts, a CLI for building and testing, and a Language Server (LSP) supporting VS Code and NeoVim. The platform provides a comprehensive prelude of primitive and algebraic data types, as well as tools for working with Untyped Plutus Core via the uplc crate.

Tokens
38.1K
Snippets
147
Records
212
Agent score
67%

What's inside Aiken

  1. Run Aiken tests

    main

    You can write tests within any module using the test keyword.

    To run all tests in the project, use aiken check. To run a subset of tests that match a specific string pattern, use the -m flag.

    test foo() {
      1 + 1 == 2
    }
    # Run all tests
    aiken check
    
    # Run tests matching the string 'foo'
    aiken check -m foo
  2. Configure the Aiken Language Server (LSP) manually

    main

    If your IDE or editor does not have a dedicated Aiken plugin, you can configure it manually using the following settings:

    • Command: aiken lsp (Note: This command is hidden from the standard aiken --help output)
    • Root Pattern: aiken.toml (The LSP uses this file to identify the project root)
    • Filetype: aiken or .ak extension
    aiken lsp
  3. Create a new Svelte project with sv

    main

    Use the sv CLI (via npx) to scaffold a new Svelte project. You can either initialize the project in the current directory or specify a new directory name.

    # create a new project in the current directory
    npx sv create
    
    # create a new project in my-app
    npx sv create my-app
  4. Develop a Svelte project locally

    main

    After creating your project and installing dependencies (using npm install, pnpm install, or yarn), start the development server using npm run dev. To automatically open the application in your default web browser, use the --open flag.

    npm run dev
    
    # or start the server and open the app in a new browser tab
    npm run dev -- --open
  5. Get started with Aiken

    main

    Aiken is a modern smart contract platform designed for Cardano. To begin using Aiken, you can follow the official installation instructions, use the online playground for quick experimentation, or follow the beginner checklist to ensure your environment is set up correctly.

  6. Run V3 Script Context Acceptance Tests

    main

    The V3 Script Context Tests project uses handcrafted Plutus V3 validators and transactions to verify how Aiken interprets the ScriptContext.

    To run the tests for a specific validator group, use the test.sh script. The test requires a specific directory structure for each VALIDATOR_GROUP:

    1. A validator file located at validators/{VALIDATOR_GROUP}.ak.
    2. A transaction template at ctx/{VALIDATOR_GROUP}/tx.template.
    3. A resolved inputs template at ctx/{VALIDATOR_GROUP}/resolved_inputs.template.

    Templates support mustache-style variables:

    • {VALIDATOR_GROUP}.{VALIDATOR_TITLE}.hash
    • {VALIDATOR_GROUP}.{VALIDATOR_TITLE}.cbor

    Note: {VALIDATOR_TITLE} corresponds to the validator's name in Aiken.

    ./test.sh VALIDATOR_GROUP