Skip to main content
T TON Adoption
← Glossary
NODE/03 · Term

Slice

TVM type representing a read-only cursor over a cell, used for parsing. To read a cell's contents you turn it into a slice.

Aliases: ton slice, tvm slice

Slice is one of the core TVM types — a read-only cursor over a cell. If a cell is a container of bits and references, a slice is the position from which contents are read: “read 32 bits”, “read the next reference”, and so on.

Lifecycle

A typical TVM cell-reading pattern:

  1. begin_parse turns a cell into a slice — a cursor at the start.
  2. load_uint(n), load_addr(), load_ref() — operations that read by type. Each one advances the cursor.
  3. end_parse asserts the slice was fully consumed (anything left over is an error).

Tact and Tolk hide this from you: the compiler generates parsing code from message/struct declarations. In FunC the slice is always explicit.

Slice vs Cell

PropertyCellSlice
Purposehold dataread data
Mutabilityimmutablecursor advances
Used instorage, message bodyparsing
Created frombuilder.end()cell.begin_parse()

A cell is the “file”; a slice is the “open reader with a position”.

Things to keep in mind

  • A slice doesn’t copy data. It points at the same cell and tracks its current position and remaining bits.
  • If a slice still has a child reference, you read it with load_ref() and then begin_parse() on the resulting cell — recursively.
  • Gas depends on what you read, not on what the source cell holds. Reading only what you need is a real optimisation.

Slices are the foundation of all parsing: message bodies, contract storage, ABI arguments.

Related terms