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

    send_raw_message(msg, 64);
}
The method receives two parameters: the address to send the money to, and the amount to send. It does not return a value, indicated by () to the left of the method name send_money. The method uses the impure and inline specifiers, which are flags that tell the compiler to process the method in specific ways. The method first creates the message to send msg by using a cell builder, since the message is encoded as a cell. The procedure is:
  1. Create a new cell builder with begin_cell.
  2. Set message flags at the line with the single-line comment ;; It sets the message to be non-bounceable..
  3. Store the receiving address with store_slice.
  4. Store the amount to send using store_coins.
  5. Finalize the cell with a call to the end_cell function.
Finally, function send_raw_message sends the message, where the parameter 64 describes a sending mode.

Compiler

The compiler converts FunC programs into Fift assembler code. The Fift assembler code is then compiled down to bitcode for the TON Virtual Machine using 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.

Compile using tooling

To compile FunC files to bitcode, install the func-js npm package in your project folder. It runs in any environment with Node.js v22 or later installed. The func-js package integrates the FunC and Fift compilers to produce bitcode directly from FunC source code, without manual Fift invocation. To install func-js, run the following command in your project root:
npm i @ton-community/func-js
Next, run the following command to compile a specific FunC file:
npx func-js ./contract.fc --boc ./output.boc
where contract.fc is the FunC source file in your project root, and output.boc is the compiled bitcode output.
It’s recommended to place the FunC standard library file in your project root. Download smartcont_lib.zip from the GitHub repository, extract it, and copy stdlib.fc to your project root.
You can also use Blueprint to start a project. See the Blueprint section for setup instructions.

Compile manually using the binaries

Prebuilt FunC compiler binaries for Windows, macOS (Intel or Arm64), and Ubuntu are available on GitHub. 1. Download the corresponding binary for your 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 in the command line, and add it to your 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 your project root. 3. Compile a FunC file to Fift assembler code. Run the following command in your 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. If you need 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

You can review past competitions to learn more:
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