Mastering TON Development: A Comprehensive Guide to Setting Up Your Environment

Complex shape forming a knot out of abstract pipes on a white surface

Mastering TON Development: A Comprehensive Guide to Setting Up Your Environment

Telegram Open Network (TON) offers a robust platform for developing cutting-edge decentralized applications (DApps) and smart contracts.

In this detailed guide, we'll walk you through setting up a complete development environment within the TON ecosystem. By following these steps, you'll be well-equipped to explore the vast possibilities of blockchain development on TON.

1. Setting Up TON Binaries

To interact effectively with TON blockchain, you need essential binaries for compilers, clients, nodes, etc. Here's how to obtain them:

  • Compile from Source Code:
    • Install prerequisites: make, cmake >= 3.0.2, g++ or clang, OpenSSL (with C Headers) >= 1.1.1.
    • Clone SpyCheese's TON repository: git clone <>.
    • Switch to the toncli-local branch: git checkout toncli-local.
    • Create a build directory: <ton-build>.
    • Build required targets:
      • cmake --build . --target lite-client
      • cmake --build . --target func
      • cmake --build . --target fift

2. Installing toncli

Note: Ensure you've completed the TON Binaries setup before proceeding.

  • Clone the toncli fork: git clone <>.
  • Navigate to the toncli directory: cd toncli.
  • Switch to the development branch: git checkout dev.
  • Install toncli: python develop.

3. Exploring ton-contract-executor

  • Install Node.js and yarn: npm install --global yarn.
  • Create a project directory and initialize it: yarn init.
  • Install ton-contract-executor and ton: yarn add ton-contract-executor and yarn add ton.
  • Create a contract execution script (contract.js) and execute it locally.

4. Utilizing tonstarter-contracts

Prerequisites: Node.js installed, TON Binaries configured and added to PATH.

  • Clone tonstarter-contracts: git clone <>.
  • Install dependencies: npm install.
  • Write contracts in the appropriate folders.
  • Build contracts: npm run build.
  • Test contracts (macOS only): npm run test.
  • Deploy contracts to mainnet or testnet: npm run deploy (mainnet) or npm run deploy:testnet (testnet).

5. Setting Up MyLocalTON

Prerequisite: Install OpenJDK 17.

  • Download MyLocalTON from the latest successful build in Auto Builds.
  • Extract the downloaded file and run MyLocalTON: java -jar MyLocalTon.jar.

6. Additional Resources and Documentation

Explore the vast functionality of toncli, ton-contract-executor, and tonstarter-contracts by referring to their respective documentation and examples. Engage with the TON developer community for support, collaboration, and inspiration.

By following these steps, you've successfully set up a robust development environment within the TON ecosystem. Get ready to dive into the world of decentralized applications, explore smart contract development, and contribute to the thriving TON developer community. Happy coding! 🚀

3 min
October 29, 2023
Sebastian Hendel