Smart contracts
In TON, every account can be more than just a balance holder — it can also contain code and data. When both are present, the account becomes a smart contract.
- Code — the program logic that defines how the contract reacts to incoming messages.
- Data — the storage that keeps the contract’s state between transactions.
Smart contracts are actors: they don’t call each other directly, but exchange messages (transactions). This follows the actor model:
- Isolation: contracts cannot directly read each other’s storage.
- Asynchronous communication: messages are delivered and processed independently.
TON Virtual Machine
The TON Virtual Machine (TVM) is the environment where smart contracts are executed. It works like a tiny computer inside the blockchain, designed for efficiency and security.
- TVM reads the contract’s code (stored as cells).
- It processes messages sent to the contract.
- It updates the contract’s data according to the code logic.
- It may generate outgoing messages to other contracts.
Learn more in the TVM overview section.
Key features
- Deterministic execution: given the same inputs, TVM always produces the same outputs.
- Stack-based design: computations are performed on a stack of values.
- Gas system: each operation costs gas, preventing infinite loops.
- Continuation cells: special cells used by TVM to store executable code.
Why it matters
Smart contracts and TVM together make TON a programmable blockchain — not just a ledger, but a platform where apps and services can run.
Learn more about smart contracts in the Smart contract documentation.
See also
Was this article useful?