Skip to main content
Tolk is a statically typed language for writing smart contracts on TON. It provides declarative data structures, automatic cell serialization, and message handling primitives. The language compiles to TVM and provides direct control over execution.
type AllowedMessage = CounterIncrement | CounterReset

fun onInternalMessage(in: InMessage) {
    val msg = lazy AllowedMessage.fromSlice(in.body);
    match (msg) {
        CounterIncrement => { ... }
        CounterReset => { ... }
    }
}

get fun currentCounter() {
    val storage = lazy Storage.load();
    return storage.counter;
}
Tolk is compatible with existing TON standards.

Key features

Tolk provides high-level readability while preserving low-level control:
  • a type system for describing cell layouts;
  • lazy loading that skips unused fields;
  • unified message composition and deployment;
  • a compiler targeting the Fift assembler;
  • tooling with IDE integration.

From FunC to Tolk

Tolk evolved from FunC and is now the recommended language for TON smart contracts. To migrate from FunC:

Quick start

  1. Run the command:
    npm create ton@latest
    
  2. Enter a project name and choose “A simple counter contract (Tolk)”.
  3. Follow Your first smart contract page to write the contract in Tolk.

IDE support

  1. JetBrains IDEs plugin provides syntax highlighting and code navigation. Download from marketplace and install it.
  2. VSCode extension adds syntax highlighting, code navigation, and other language features for VS Code and VS Code-based editors such as VSCodium, Cursor, and Windsurf.
  3. Language server supports (Neo)Vim, Helix, and other editors with LSP support. Download an archive and install it.

Start with