Overview
FunC is minimalist, domain-specific, functional-style language designed for writing low-level TON smart contracts, tightly bound to the TVM model.
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
Blueprint
Using the Blueprint framework is the most convenient and quickest way to begin developing and compiling smart contracts. Read more in the Blueprint section.
GitHub
FunC binaries can be downloaded from the GitHub repository or compiled manually from sources.
Tutorials
The best place to start developing on TON is the Quick start section.
The TON Blockchain course includes Module 4, which covers FunC and smart contract development.
Below, you can find additional materials shared by community experts:
-
TON Hello World: step-by-step guide for writing your first smart contract
-
Challenge 5: Create UI to interact with the contract in 5 minutes
-
FunC lessons (RU version) by @romanovichim
-
FunC quiz (RU version) by Vadim. It is good for self-checking and will take 10–15 minutes. The questions are mainly about FunС, with a few general questions about TON.
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.