MilnerA language for Tondi contracts

Write asset and application rules in Milner, then compile them into programs for Tondi VM. The language and toolchain are in development.

See what you can write

Contract roles

Check a rule

Check whether a requested action is allowed. For example, accept or reject a transfer.

validator

Prepare a change

Calculate the changes an app wants to make. Tondi checks them before saving.

executor

Run a scheduled task

Prepare changes for a scheduled task using its current timing and budget information.

autonomous

Milner language features

Type inference

The language can work out many types automatically, helping developers catch mismatched data and missing cases before a program runs.

Explicit program roles

A developer states whether a function checks a rule, prepares a change or handles a scheduled task. Each role has its own permitted operations.

Executable programs

The compiler produces a runnable RISC-V program, a Tondi package and a Blueprint describing how other software can call it. RISC-V is an open instruction standard.

Tests in Tondi VM

Tests run compiled programs inside Tondi VM. They distinguish a rule correctly rejecting an action from a program error or an exhausted running budget.

Resource ownership checks

The compiler tracks when a resource is moved or temporarily borrowed, and reports some kinds of accidental reuse before the program runs.

Ledger authority

Language checks do not prove that someone owns an asset. Tondi must still verify permissions. Linking the language’s ownership checks to native Note resources and change results remains in development.

Contract rules
in Milner

An authorization example: allow the action only when the supplied value meets the required condition.

Download .mil source
validator gate(minimum: Int) {
  authorize(value: Int) {
    value >= minimum
  }
}

Milner + Tondi VM
From code to execution

Milner compiles contract rules into programs for Tondi VM. The VM runs them, and the ledger checks permissions and results before committing the related changes. The walkthrough below explains these steps; it does not compile code or send transactions.

gate.milMILNER

Example rule: allow an action only when its input meets the required condition.

Read the Milner code · for developers
validator gate(minimum: Int) {
  authorize(value: Int) {
    value >= minimum
  }
}
Download .mil source
  1. Code checks

    Types and IR
  2. RISC-V program

    ELF executable
  3. Tondi VM

    Metered execution
  4. Ledger checks

    Proposed changes

Write a contract in Milner. The example allows an action only when its input meets a condition.

Milner
development workflow

Check your program

milner check contract.mil

Read the code, check its types and report problems.

Build native artifacts

milner build contract.mil

Turn the code into a runnable program, a Tondi package and an interface description.

Run native tests

milner test contract.mil

Run the compiled tests in Tondi VM and inspect their computation costs.

For developers: these commands need the configured Milner toolchain and its pinned dependencies. Choose the program entry and role when building.

Milner
tooling

Current toolchain status

The development tools can compile programs, calculate proposed changes, check generic resource ownership and help editors and apps use the code. Native asset ownership integration, complete libraries, stable releases and production validation are still in progress.