Skip to main content

Cells

In TON, a cell is like a small box that can hold information. Each box (cell) has two parts inside:

  • it can keep up to 1023 bits of data (like a small note inside the box)
  • it can point to up to 4 other boxes (arrows to other cells)

There are some rules:

  • data and arrows are kept separately
  • arrows cannot go in circles — a box cannot point back to itself, directly or indirectly

Because of this, all cells together form a directed acyclic graph (DAG). You can imagine it as a family tree: every child points to parents, but you can never circle back to your great-grandparent.


Directed acyclic graph (DAG) of TON cellsDirected acyclic graph (DAG) of TON cells

Types of cells

There are five types of cells in TON. One is the normal cell, and four are special (called exotic).

TypeThink of it as...Purpose
Ordinary cellA regular boxDefault, stores most data
Pruned branchA “summary” of many boxesUsed for short proofs
Library referenceA shared folder everyone can useHelps avoid duplicates
Merkle proofA certificate attached to a boxUsed for verification
Merkle updateA “change log” for a set of boxesUsed for updating state

Serialization of data into cells

In TON, everything is stored in cells: messages, blocks, even the whole blockchain state.

All these objects are broken down into trees of cells. This tree is called a Bag of Cells (BoC). You can imagine it as a set of nested boxes inside boxes.

To describe how exactly data is put into boxes, TON uses a special language called TL-B. It plays the same role as Protocol Buffers or JSON schemas, but for TON cells.

See also

Was this article useful?