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);
}

FunC cookbook

FunC reference documentation

Compiler

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

Developers can use this bytecode, which is structured as a Bag of Cells like all data in the TON Blockchain, to deploy smart contracts or run this bytecode on a local instance of the TVM.

Compile with JS

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

npm create ton@latest

Use precompiled binaries

If you want to use the FunC compiler locally, you need to set up the TON compiler binaries on your machine.

You can build binaries from source code, such as the compiler's source code for FunC. Read how to compile it from source.

TON Blockchain course

The TON Blockchain course covers FunC and smart contract development.

Check TON Blockchain course

Chinese

Russian

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:

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

See also

Was this article useful?