Skip to main content
TON Blockchain uses Tolk as the official language. Other languages are still available, and legacy codebases exist, but Tolk is the only actively supported language. The FunC compiler, for instance, is no longer maintained.
FunC is a domain-specific, statically typed language with C-like syntax designed to write smart contracts on TON. It can be characterized as an intermediate-level language sitting on top of the Fift assembly language. Example of a FunC function for sending funds:
() send_money(slice address, int amount) impure inline {
    var msg = begin_cell()
        ;; Set the message to be non-bounceable
        .store_uint(0x10, 6)
        .store_slice(address)
        .store_coins(amount)
        .end_cell();

    send_raw_message(msg, 64);
}
where
  • () is the return type, that stands for “do not return value”, similar to void in C;
  • send_money is the name of the function;
  • slice address is the first parameter, address to send money to; it’s type is slice;
  • int amount is the second parameter, amount to be sent; it’s type is int;
  • impure inline are specifiers, which are flags that tell the compiler to process the method in a specific way;
  • var msg = ... defines a variable without specifying its type; it will hold a cell with a message;
  • begin_cell() creates a cell builder;
  • store_uint, store_slice, store_coins methods store data into the builder:
    • flags;
    • receiving address;
    • amount on Toncoin to attach to the message.
  • .end_cell() method finalizes the builder and turns it into a cell;
  • send_raw_message function sends the message, where the parameter 64 describes a sending mode.

Compiler

The compiler converts FunC programs into Fift assembly code. The Fift assembly code is then compiled down to the TON Virtual Machine bitcode by the Fift compiler. Developers can use the compiled bitcode, structured as a bag of cells like all data in the TON blockchain, to test smart contracts, send messages, or execute it in a local TVM instance.

End-to-end tooling

The easiest way to install the FunC compiler is the @ton-community/func-js NPM package. It requires Node.js v22 or later. The package has both the FunC and Fift compilers, and produces bitcode directly from the FunC source code, without manually invoking Fift. To install it, run the following command in the project root folder:
npm i @ton-community/func-js
Then, to compile a specific FunC file, run the following command:
npx func-js ./contract.fc --boc ./output.boc
where contract.fc is the FunC source file in the project root, and output.boc is the compiled bitcode output. FunC standard library is supplied separately from the language. Download smartcont_lib.zip from the latest release, extract it, and copy stdlib.fc to the project root. Alternatively, use the Blueprint to start a project pre-configured for development in FunC.

Compile manually using the binaries

Prebuilt FunC compiler binaries for Windows, macOS (Intel or ARM64), and Ubuntu are available on the GitHub.
  1. Download the corresponding binary for operating system:
    • Linux: func-linux-x86_64 (Intel/AMD) and func-linux-arm64 (ARM64)
    • Mac: func-mac-x86-64 (Intel/AMD) and func-mac-arm64 (ARM64)
    • Windows: func.exe
    Rename the executable, for example, to func, for easier use on the command line, and add it to system’s PATH.
  2. Download the FunC standard library. Get the smartcont_lib.zip from the same GitHub, extract it, and copy stdlib.fc to project root.
  3. Compile a FunC file to Fift assembly code. Run the following command in the project root:
func contract.fc -o output.fif
where contract.fc is the FunC file to compile, and output.fif is the generated Fift output. To compile the generated Fift file output.fif further down to TVM bitcode, use the Fift compiler. See the Fift for download and usage instructions.
The last FunC compiler version is v2025.07. The FunC compiler is no longer developed. New releases are focused on the Tolk compiler.

Tutorials

The tutorials in this section are provided by external contributors and may not reflect FunC’s current development status. They are offered as additional resources for exploring FunC’s applications.

Contests

ContestTasksSolutions
TSC #5 (Dec 2023)Tasks
TSC #4 (Sep 2023)Tasks1 2 3 4
TSC #3 (Dec 2022)TasksSolutions
TSC #2 (Jul 2022)TasksSolutions
TSC #1 (Mar 2022)TasksSolutions

Changelog

History of FunC