Why choose Tolk
- Clean, expressive syntax inspired by TypeScript and Rust.
- Built-in primitives for TON, including auto‑packed structs (to/from cells), pattern matching, and first-class message handling.
- Strong static type system with null safety, type aliases, union types, and generics for safer, clearer code.
- Gas‑efficient by design — see benchmarks and comparison; features like Lazy loading can reduce costs.
- Low-level control is available when needed, with direct access to the TVM stack and instructions.
Getting started with Tolk
If you’re starting with Tolk, follow these steps:- Explore the TON smart contract documentation to learn the fundamentals.
-
Set up your first Tolk counter project:
- Follow the step-by-step guide to build a counter contract.
- Read the Tolk language guide for a high-level overview of the language.
- Continue exploring the documentation. When you come across FunC or Tact code, compare it to its Tolk equivalent — you’ll often find it’s cleaner and more declarative.
How to migrate from FunC
If you’ve written contracts in FunC, migrating to Tolk is straightforward — and often results in simpler, more maintainable code.- Try building a basic contract in Tolk — for example, a counter using
npm create ton@latest. You’ll quickly notice the shift from stack logic to expressive constructs with structured types, unions, pattern matching,toCell(), and more. - 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.
- Read Tolk vs FunC: in short for a quick comparison of syntax and concepts.
- Use the FunC-to-Tolk converter to migrate existing codebases incrementally.
Example of a basic Tolk smart contract:
Tooling around Tolk
A set of tools is available to support development with Tolk — including IDE support, language services, and migration utilities.- JetBrains IDE plugin. Adds support for Tolk, FunC, Fift, and TL-B. [VS Code extension](https://marketplace.visualstudio.com/items?itemName=ton-core.- vscode-ton). Provides Tolk support and language features.
- Language server. Works with any LSP-compatible editor.
- FunC-to-Tolk converter. Migrates entire projects with a single
npxcommand. tolk-js. WASM wrapper for the Tolk compiler is integrated into Blueprint.
ton repository.