Skip to main content

Getting started

Welcome to the TON Quick Start guide! This guide will give you a starting point for further research into TON concepts and basic practical experience in developing applications with the TON ecosystem.

Prerequisites

  • Basic programming knowledge.
  • Around 30 minutes of your time.
note

We will provide a short explanation of core concepts during the guide, but if you prefer a more theoretical approach, you can check out the core concepts of TON Blockchain first.

What you'll learn

  • Understand the key principles of TON Blockchain, including messages, smart contracts, and addresses.
  • Interact with the TON ecosystem, including wallets and blockchain explorers.
  • Interact with TON Blockchain by reading from and writing data to it.
  • Set up a development environment using the Blueprint for the smart contract development.
  • Start writing smart contracts using the FunC, Tolk, and Tact programming languages in TON.

Concept of smart contracts

A smart contract in TON is an account whose code and data are already deployed to the blockchain, along with its general state. TON utilizes the actor model of computation, where each smart contract is an isolated entity that communicates with others by exchanging messages.

Each successfully processed message results in a transaction, which may include the following effects:

  • sending further messages
  • changing internal data or even the code of the smart contract itself
  • changing its balance
info

In contrast to other blockchains, where you can call other contract code synchronously, a smart contract in TON is a standalone entity that communicates equally with other smart contracts. Smart contracts interact by sending messages to each other, and the processing of these messages happens asynchronously due to the asynchronous nature of transactions in TON.

The available interfaces of a smart contract are:

  • Receiving internal messages from another smart contract.
  • Receiving external messages from outside the blockchain.
  • Processing get-method requests from outside the blockchain.

Unlike internal or external messages, get methods do not result in transactions. They are special functions of the smart contract that cannot change the contract's internal state or perform any other action except querying specific data from the contract's state.

info

Contrary to what might seem intuitive, invoking get methods from other contracts is not possible.

Interacting with the TON ecosystem

Before we begin our journey to becoming TON developers, we should first become advanced users of TON. Let’s create our wallet, send a few transactions, and see how our actions are reflected on the blockchain using explorers.

Step 1: Create a New Wallet Using an App

The simplest way to create a wallet is to visit https://ton.org/wallets and choose one of the wallet apps from the list. They are all pretty similar, so let's choose Tonkeeper. Go ahead, install it, and run it.

Step 2: Mainnet and Testnet

In TON, there are two different networks called Mainnet and Testnet, each with distinct roles:

  • Mainnet is the primary network where actual transactions take place, carrying real economic value as they involve real cryptocurrency.
  • Testnet is an independent version of TON Blockchain designed for development and testing. It replicates the Mainnet’s functionality but uses test coins with no real value, allowing developers to experiment without financial risk.

Getting funds

Transactions in TON always require some funds, as executing smart contract code requires a fee. TON basic transactions are very cheap—about 1 cent per transaction. Getting the equivalent of $5 worth of Toncoin will be enough for hundreds of them. Here’s how you can get them:

  • For Mainnet, you can get Toncoin by simply pressing the buy button in the user interface or asking someone to send them to your address. You can copy the address from the wallet app, which is usually located near your balance.
info

Don't worry, sharing your address is totally safe, unless you don't want it to be associated with you.

  • For the Testnet version, you can request funds from the Testgiver Ton Bot completely for free! After a short wait, you will receive 2 Toncoin that will appear in your wallet app.

Step 3: Creating a Testnet Wallet

If you decide to use the Testnet version, you can do so by following the guide below.

Generating a mnemonic

To create your first Testnet wallet in Tonkeeper, you should obtain a mnemonic using the button below. Do not forget to save this phrase!

Your mnemonic:
s

Creating a wallet

To create a Testnet wallet, click WalletAdd WalletTestnetAccount. Then, import the seed phrase generated in the previous step.



Step 4: Exploring TON Blockchain

Congratulations! We’ve created our first wallet and received some funds in it. Now, let's take a look at how our actions are reflected in the blockchain. We can do this by using various explorers.

An explorer is a tool that allows you to query data from the chain, investigate TON smart contracts, and view transactions. For our examples, we are going to use Tonviewer.

tip

Note that when using the Testnet, you should manually change the explorer mode to the Testnet version. Don't forget that these are different networks that do not share any transactions or smart contracts. Therefore, your Testnet wallet will not be visible in Mainnet mode and vice versa.

Let's take a look at our newly created wallet using the explorer: copy your wallet address from the app and insert it into the search bar of the explorer like this:

Screenshot of explorer search interface

Address states

First, let's examine the common address state of our smart contract:

  • Nonexist: suppose you haven't received funds to your address yet. In that case, it will be in the nonexistent state — the initial state for all potential addresses. In this state, the address has no associated code, data, or balance.
Screenshot of nonexistent wallet state
  • Uninit: stands for an address that holds a balance and metadata but contains no code or persistent data. An address enters this state when it receives funds.
Screenshot of uninitialized wallet state
info

This might seem unintuitive: why is your wallet in the uninit state when you’ve already created it? There is a small difference between the wallet app and the wallet smart contract:

  • The wallet app is your off-chain client for the wallet smart contract.
  • The wallet smart contract is the contract itself. Since its deployment requires some fees, most wallet apps don’t actually deploy the wallet smart contract until you receive funds on your address and try to make your first transaction.
  • Active: the state of a deployed smart contract that contains code, data, and balance.

To deploy our wallet, let's send the first transaction to someone special—ourselves—and see how it looks on the blockchain. Enter the send menu in your wallet app and transfer some funds to your own address that you’ve copied before. In the explorer, our contract should start looking something like this:

Screenshot of active wallet state
info

There is also a fourth state called frozen, which stands for a smart contract with a storage charge that exceeds its balance. In this state, the smart contract cannot perform any operations.

And here we are — our wallet contract is deployed and ready to use. Let's examine the provided user interface:

Metadata section

  • Address: Your account's unique ID (e.g., QQB...1g6VdFEg).
  • Balance: Current TON amount.
  • Type: Contract version (e.g., wallet_v5r1 – detected automatically by code).
  • State: Address state. It may be nonexisting, uninit, active, or frozen.
  • History/Transactions: Displays recent activity (e.g., received funds, contract deployments).
  • Code: Shows raw smart contract code compiled from FunC/Tact/Tolk.
  • Methods: Allows execution of get methods to retrieve persistent contract data.

Next steps

  • Now that you’ve tried the wallet app, take a moment to explore further: create another wallet account, try sending some TON between them, and observe how the transactions appear in the explorer.
  • When you're ready, move on to the next step:

Reading from network

Was this article useful?