Skip to main content

Overview

FunC is a high-level language used to program smart contracts on TON.

FunC is a domain-specific, C-like, statically typed language. Here is a simple example of a method for sending money written in FunC:

() send_money(slice address, int amount) impure inline {
var msg = begin_cell()
.store_uint(0x10, 6) ;; nobounce
.store_slice(address)
.store_coins(amount)
.end_cell();

send_raw_message(msg, 64);
}

The compiler converts FunC programs into Fift assembler code, generating the corresponding bytecode for the TON Virtual Machine.

Developers and engineers can use its bytecode, which is structured as a tree of cells like all data in the TON Blockchain, to create smart contracts or run it on a local instance of the TVM.

FunC cookbook

FunC documentation

Compiler

Compile with JS

Using the Blueprint framework is the most convenient and quickest way to begin developing and compiling smart contracts. Read more in the Blueprint section.

npm create ton@latest

Compile with original binaries

If you want to use the native FunC language locally, you need to set up the TON compiler binaries on your machine. FunC compiler binaries for Windows, macOS (Intel/M1), and Ubuntu can be downloaded from:

info

Alternatively, you can create binaries from source code, such as the compiler's source code for FunC. Read how to compile it from sources.

TON Blockchain course

The TON Blockchain course includes Module 4, which covers FunC and smart contract development.

Check TON Blockchain course

CHN

RU

Tutorials

starter tip

The best place to start developing with FunC is the Introduction section.

Below, you can find additional materials shared by community experts:

Contests

Joining contests is a great way to learn FunC. You can also review past competitions to learn more.

Contests legacy

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

Smart contract examples

Follow this link to find various standard smart contracts, such as wallets, electors that manage validation on TON, multi-signature wallets, etc. These can serve as helpful learning references.

Changelog

History of FunC