Skip to main content

Tolk language: overview

Tolk is a next-generation language for writing smart contracts on TON. It replaces FunC with modern syntax, a robust type system, and built-in serialization — while producing even more efficient assembler code.

Tolk features

  • Clean, expressive syntax inspired by TypeScript and Rust.
  • Language-level primitives tailored to TON: auto-serialized structures, pattern matching, and first-class message handling.
  • Rich static type system with null safety, type aliases, union types, and generics — enabling safe and expressive code.
  • Gas-efficient by design: Tolk contracts can be up to 50% cheaper than FunC equivalents, thanks to compiler optimizations and lazy functionality.
  • Low-level access when needed: direct control over the stack and TVM instructions.
import "utils"

struct Storage {
counter: int32
}

fun Storage.load() {
return Storage.fromCell(contract.getData());
}

fun onInternalMessage(in: InMessage) {
// ...
}

get fun currentCounter(): int {
val storage = lazy Storage.load();
return storage.counter;
}
View the same logic in FunC
#include "utils.fc";

global int ctx_counter;

int load_data() impure {
slice cs = get_data().begin_parse();
ctx_counter = cs~load_uint(32);
}

() recv_internal(int msg_value, cell msg_full, slice msg_body) impure {
slice cs = msg_full.begin_parse();
int flags = cs.load_uint(4);
if (flags & 1) {
return ();
}
...
}

int currentCounter() method_id {
load_data(); ;; fills global variables
return ctx_counter;
}

Try a FunC → Tolk converter

Tolk vs FunC differences

Migrating from FunC to Tolk

If you’re familiar with FunC and want to explore Tolk, here’s your path:

  1. Create a fresh Tolk counter project using npm create ton@latest. You’ll immediately notice how different the code feels — with structured types, unions, pattern matching, toCell(), and more.
  2. Explore the Tolk vs FunC benchmarks. These are real-world contracts (Jetton, NFT, Wallet, etc.) migrated from FunC — same logic, but expressed in a cleaner, more expressive style.
  3. Read the guide Tolk vs FunC: in short. It highlights syntax differences — but remember, Tolk is more than just syntax; it encourages a shift toward data-driven, declarative logic.
  4. Try the FunC-to-Tolk converter. It’s a great starting point for incremental migration.

How to try Tolk if you're new to FunC

Since Tolk is newly released, it lacks full-fledged documentation. If you are new to TON, follow these steps to get started:

  1. Explore the TON smart contract documentation to learn the basics. Get familiar with cells and TON’s asynchronous model.
  2. Create a Tolk counter project using the blueprint tool: npm create ton@latest. Learn more.
  3. Follow the step-by-step guide to build a counter contract.
  4. Read the Tolk language guide for a high-level overview of the language.
  5. Continue exploring the documentation and gain hands-on experience. When you encounter FunC or Tact snippets, remember their Tolk equivalents look cleaner and more expressive.

The TON documentation adapts over the coming months to onboard newcomers using Tolk instead of FunC.

Tooling around Tolk

Tolk has strong ecosystem support:

  1. The JetBrains IDE plugin supports Tolk, FunC, Fift, and TL-B.
  2. The VS Code extension includes Tolk support.
  3. The Language server works with any LSP-compatible editor.
  4. The FunC-to-Tolk converter migrates entire projects with a single npx command.
  5. The tolk-js WASM wrapper for the Tolk compiler is integrated into blueprint.

The Tolk compiler itself lives in the ton-blockchain repository.

Is Tolk production-ready?

All contracts in the Tolk vs FunC benchmarks pass the same test suites as their FunC counterparts — with identical logic and behavior.

The compiler is new, and some edge cases might still appear. However, Tolk already serves as a production-ready replacement for FunC, suitable for real-world use.

Regardless of the language, well-tested code is the key to building reliable smart contracts.

Issues and contacts

If you encounter an issue, please connect with the developer society on TON Dev chats or create a GitHub issue.

See also

Was this article useful?