The official language of TON Blockchain is Tolk, and all other languages are deemed legacy. That said, you can still use them and contribute to the surrounding tooling or documentation.
Installation
Interpreter and libraries
Fift interpreter binaries for Windows, macOS (Intel or Arm64), and Ubuntu can be downloaded from the latest GitHub release. Make sure to also download the necessary libraries — download and unpack thesmartcont_lib.zip
. The lib/
folder inside contains standard libraries of Fift, which must be exposed to it when running the interpreter.
Consider the following example installation steps:
1
Download the latest Fift binary
- Windows
- Linux
- MacOS
Go to the latest GitHub release, download
fift.exe
and place it somewhere on your PATH
. To see the current state of the PATH
variable, run echo $env:PATH
in the PowerShell.2
Download Fift's standard libraries
- Download
smartcont_lib.zip
from the latest GitHub release. - Unzip it and extract the contents.
- Move the extracted
lib/
folder somewhere convenient. You can also place it under a different name.- For example, for Linux and macOS it can be moved to
~/.local/lib/fiftlib
- For Windows, to
~/.fiftlib
- For example, for Linux and macOS it can be moved to
3
Run Fift
To invoke Fift binary you’ll need to pass it the standard libraries as such:If you see errors or red-colored output lines, double-check the placement of the Fift binary and related libraries from previous steps.Otherwise, write the following and press “Enter”:If you see “4 ok”, then Fift has been successfully installed on your machine!To learn about other launch options, add the
-h
flag by the end of the prior Fift invocation command.For Linux and macOS, it might be convenient to make an alias as such:
Additional tooling
Extensions and plugins
- VS Code extension - powerful and feature-rich extension for Visual Studio Code (VSCode) and VSCode-based editors like VSCodium, Cursor, Windsurf, and others.
- Get it on the Visual Studio Marketplace.
- Get it on the Open VSX Registry.
- Or install from the
.vsix
files in nightly releases.
- JetBrains IDEs plugin - provides syntax highlighting, code navigation, and more.
- Language Server (LSP Server) - supports Sublime Text, (Neo)Vim, Helix, and other editors with LSP support.
Online utilities
- TxTracer: Assembly playground
- TxTracer: Code explorer with assembly output
- TxTracer: TVM instruction table
Getting started
Here is a simpleHello, World!
example written in Fift:
fift
binary, it produces the following output:
ok
means successful end of execution of the given code snippet.
When things go awry, there may still be an
ok
by the end, albeit prefixed with several red lines of cryptic-looking stack traces. Those are how Fift reports errors and this is one of the major reasons why Fift is considered a legacy language.Any errors encountered during execution clear the stack!Hence, to actually know what happened, one needs to preemptively check stack contents. For that, use the “printf debugging” approach with the .s
word — it dumps current stack contents to the console without modifying the stack.Educational materials
Whitepapers
While most of the information described there holds some truth, the
fiftbase.pdf
whitepaper is still considered legacy due to lack of updates and gradual integration of their contents into actual documentation pages.However, it is the most exhaustive reference manual on Fift to this date, so you can still use it to learn a lot about Fift.Fift language specification, web version
Tacit stack-based programming language with deep connection to TVM.
Fift language specification, PDF
Original documentation written by Dr. Nikolai Durov, a comprehensive whitepaper.