Environment setup
To start working with Tolk, you need a development environment.
We recommend using Blueprint, a tool for writing, testing, and deploying smart contracts on TON.
Create a new TON project
Prerequisite: Node.js v16 or higher
- Create a new TON project:
npm create ton@latest
- Enter any project name and select "A simple counter contract (Tolk)" when prompted by Blueprint.
Project structure
Here's a quick look at the typical project layout:
my-first-contract/
├── build/ # Compiled smart contract bytecode
├── contracts/ # Smart contract sources (e.g., counter.tolk)
├── scripts/ # TypeScript deployment scripts
├── tests/ # TypeScript tests
├── wrappers/ # TypeScript wrappers for contracts
Build the project
npx blueprint build
# or
yarn blueprint build
Blueprint compiles the contract and displays the resulting bytecode, along with its hash. The output is saved in the build/
directory.
Run tests
npx blueprint test
# or
yarn blueprint test
This runs unit tests from the tests/
directory.