Check a rule
Check whether a requested action is allowed. For example, accept or reject a transfer.
validator 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 writeCheck whether a requested action is allowed. For example, accept or reject a transfer.
validator Calculate the changes an app wants to make. Tondi checks them before saving.
executor Prepare changes for a scheduled task using its current timing and budget information.
autonomous The language can work out many types automatically, helping developers catch mismatched data and missing cases before a program runs.
A developer states whether a function checks a rule, prepares a change or handles a scheduled task. Each role has its own permitted operations.
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 run compiled programs inside Tondi VM. They distinguish a rule correctly rejecting an action from a program error or an exhausted running budget.
The compiler tracks when a resource is moved or temporarily borrowed, and reports some kinds of accidental reuse before the program runs.
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.
An authorization example: allow the action only when the supplied value meets the required condition.
Download .mil sourcevalidator gate(minimum: Int) {
authorize(value: Int) {
value >= minimum
}
} A shared-app example: update a counter and return the proposed changes for Tondi to check.
Download .mil sourceuse tondi/builtin
use tondi/command
use tondi/effects
use tondi/list
use tondi/note
use tondi/shared
use tondi/u64
fn advance(delta: Int, ctx: CommandContext) -> Effects {
expect delta >= 0
let updated = list.map(
shared.writes(ctx),
fn(current) {
let key = u64.from_int(256)
let before = builtin.un_i_data(
builtin.deserialise_data(note.datum(current, key)),
)
let after = builtin.serialise_data(builtin.i_data(before + delta))
shared.successor(note.with_datum(current, key, after))
},
)
effects.new(list.concat(command.owned(ctx), updated))
}
executor counter {
run(delta: Int, ctx: CommandContext) -> Effects {
advance(delta, ctx)
}
}
autonomous timer {
on_wake(delta: Int, ctx: CommandContext) -> Effects {
advance(delta, ctx)
}
}
test codec_roundtrip() {
let data = builtin.i_data(42)
builtin.deserialise_data(builtin.serialise_data(data)) == data
} A scheduled-task example: use the task’s timing and budget information to prepare its next changes.
Download .mil sourceuse tondi/builtin
use tondi/command
use tondi/effects
use tondi/list
use tondi/note
use tondi/shared
use tondi/u64
fn advance(delta: Int, ctx: CommandContext) -> Effects {
expect delta >= 0
let updated = list.map(
shared.writes(ctx),
fn(current) {
let key = u64.from_int(256)
let before = builtin.un_i_data(
builtin.deserialise_data(note.datum(current, key)),
)
let after = builtin.serialise_data(builtin.i_data(before + delta))
shared.successor(note.with_datum(current, key, after))
},
)
effects.new(list.concat(command.owned(ctx), updated))
}
autonomous timer {
on_wake(delta: Int, ctx: CommandContext) -> Effects {
advance(delta, ctx)
}
}
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.
Example rule: allow an action only when its input meets the required condition.
validator gate(minimum: Int) {
authorize(value: Int) {
value >= minimum
}
} Write a contract in Milner. The example allows an action only when its input meets a condition.
milner check contract.mil Read the code, check its types and report problems.
milner build contract.mil Turn the code into a runnable program, a Tondi package and an interface description.
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.
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.