Due to limitations in Docusaurus, the original TVM Instruction page had to be split into several pages. The single-page version moved in archive here.
This document provides a list of TVM instructions along with their opcodes and mnemonics.
TVM.pdf document contains a full description of TON Virtual Machine.
Fift is a stack-based programming language designed to manage TON smart contracts. The Fift assembler is a Fift library that converts mnemonics of TVM instructions into their binary representation.
A description of Fift, including an introduction to the Fift assembler, can be found here.
This document specifies the corresponding mnemonic for each instruction.
Note the following:
- Fift is a stack-based language, therefore all the arguments of any instruction are written before it (e.g.
s0 s4 XCHG).
- Stack registers are denoted by
s0, s1, ..., s15. Other stack registers (up to 255) are denoted by
- Control registers are denoted by
c0, c1, ..., c15.
The gas price of each instruction is specified in this document. The basic gas price of an instruction is
10 + b, where
b is the instruction length in bits. Some operations have additional fees:
- Parsing cells: Transforming a cell into a slice costs 100 gas units if the cell is loading for the first time and 25 for subsequent loads during the same transaction. For such instructions, two gas prices are specified (e.g.
- Cell creation: 500 gas units.
- Throwing exceptions: 50 gas units. In this document the exception fee is only specified for an instruction if its primary purpose is to throw (e.g.
FITS). If the instruction only throws in some cases, two gas prices are specified (e.g.
- Tuple creation: 1 gas unit for every tuple element.
- Implicit jumps: 10 gas units for an implicit jump, 5 gas units for an implicit back jump. This fee is not a part of any instruction.
- Moving stack elements between continuations: 1 gas unit per element, however moving the first 32 elements is free.
A full machine-readable list of TVM instructions is available here.
Each section of TVM Instructions includes a built-in search component for finding opcodes specific to that section as well.
On this page, however, the search covers all existing opcodes, providing a comprehensive search option across the entire opcode range.
Feel free to use the search field below to find a specific instruction:
|Please enter a search query|