Skip to main content
Experienced developers coming from FunC tend to ask questions like:
  • “What’s the analogue of XXX in TL-B?”
  • “How to generate a TL-B schema for a Tolk structure?”
  • etc.
Such questions lead in the wrong direction — because the Tolk type system is designed as a replacement for TL-B.

Stop thinking in TL-B terms

Tolk type system replaces TL-BThere is no need to “provide a TL-B schema for a contract”.
Every Tolk struct is already a schema.
Why is TL-B so widely used in TON today? Because contracts written in FunC are not declarative. They are low-level imperative programs that manually parse cells and slices. TL-B exists to compensate for this — to provide a declarative description:
  • which inputs are valid,
  • which shape is expected,
  • how storage is structured, etc.
In Tolk, messages and storage are described directly in structs. This description is exactly what TL-B used to provide — but serialized automatically.
In the near future, ABI and TypeScript wrappers will be generated automatically as well. These features rely entirely on the type system. Surprisingly, source maps and debugger integration will also rely on the same core. TL-B is not involved in any of these processes.
Moreover, TL-B and the Tolk type system are not equivalent, even if they look similar at first glance. Similarities include:
  • intN, uintN, bitsN
  • Maybe (nullable), Either (a two-component union)
  • multiple constructors (declared structs + prefixes + unions)
  • cells and typed cells
But the differences are essential. TL-B supports the following (not expressible in Tolk):
  • ~tilde
  • {conditions}
  • dynamic ## n
Tolk supports the following (not expressible in TL-B):
  • type aliases
  • enums
  • inline unions (auto-generated prefix trees)
  • tensors
  • custom packToBuilder and unpackFromSlice
  • address? as “internal or none” (not “maybe T”)
  • further language improvements, such as namespaces or modules
The conclusion is simple: all the tooling around Tolk will not involve TL-B. TL-B is excellent for describing blockchain internals like block.tlb — but not for contracts APIs or interaction models.
The page Overall serialization describes how each Tolk type relates to TL-B. Notice the presence of imperative serialization rules there — fundamentally different from declarative TL-B schemas.