Learn all about programming in ⚡ Tact
🚀 Let’s start!
ㅤ
-
Ensure that the supported version of Node.js is installed and available
To check it, run
node --version
— it should show you the version 22.0.0 or later. -
Run the following command
It will create a new project with a simple counter contract:
Terminal window # recommendedyarn create ton simple-counter --type tact-counter --contractName SimpleCounterTerminal window npm create ton@latest -- simple-counter --type tact-counter --contractName SimpleCounterTerminal window pnpm create ton@latest simple-counter --type tact-counter --contractName SimpleCounterTerminal window bun create ton@latest simple-counter --type tact-counter --contractName SimpleCounter -
That’s it!
Your first contract project has already been written and compiled!
Check it out by moving into the relevant directory —
cd simple-counter/contracts
. Here’s what it would look like:message Add {queryId: Int as uint64;amount: Int as uint32;}contract SimpleCounter {id: Int as uint32;counter: Int as uint32;init(id: Int) {self.id = id;self.counter = 0;}// Empty receiver for the deploymentreceive() {// Forward the remaining value in the// incoming message back to the sendercashback(sender());}receive(msg: Add) {self.counter += msg.amount;// Forward the remaining value in the// incoming message back to the sendercashback(sender());}get fun counter(): Int {return self.counter;}get fun id(): Int {return self.id;}}To re-compile or deploy, refer to the commands in the scripts section of
package.json
in the root of this newly created project and to the documentation of Blueprint — this is the tool we’ve used to create and compile your first simple counter contract in Tact. Blueprint can do much more than that: including tests, customizations, and more.
🤔 Where to go next?
ㅤ
-
Have some blockchain knowledge already?
See the Tact Cookbook, which is a handy collection of everyday tasks (and solutions) every Tact developer faces during smart contract development. Use it to avoid reinventing the wheel.
-
Want to know more?
For further guidance on compilation, testing, and deployment see the respective pages:
- Testing and debugging page tells you everything about debugging Tact contracts
- Deployment page shows what deployment looks like and helps you harness the powers of Blueprint for it.
For custom plugins for your favorite editor and other tooling see the Ecosystem section.
Alternatively, take a look at the following broader sections:
-
Feeling a bit uncomfortable?
If you ever get stuck, try searching — the search box is at the top of the documentation. There is also a handy Ctrl + K shortcut to focus and start the search as you type.
If you can’t find the answer in the docs, or you’ve tried to do some local testing and it still didn’t help — don’t hesitate to reach out to Tact’s flourishing community:
Good luck on your coding adventure with ⚡ Tact!