Skip to main content

Using toncli

toncli—The Open Network cross-platform smart contract command line interface.

Easy to deploy and interact with TON smart contracts.

Good solution for Python stack developers.

Quick Start 📌

Here are tutorials made using a toncli library:

Installation 💾

Docker: linux / macOS (m1 supported)

  • Docker-hub pre-build images can be founded here
  • Docker files with instructions can be founded here

Linux / macOS (intel)

1) Download the necessary special pre-builds (use the latest build)

Download special pre-builds tip

To download the necessary files, you must log-in to your account

2) Install Python3.9 or higher

3) Run in terminal pip install toncli or pip3 install toncli

Possible error

If you see WARNING: The script toncli is installed in '/Python/3.9/bin' which is not on PATH, then add the full path to bin to the PATH env

4) Run toncli and pass absolute path to func/fift/lite-client from first step

Windows

1) Download the necessary special pre-builds from here (use the latest build)

Download special pre-builds tip

To download the necessary files, you must log-in to your account

2) Install Python3.9 or higher

Very important!

During installation, on the first screen, you need to click the Add Python to PATH checkbox

3) Open the terminal as an administrator and pip install toncli by installing toncli

4) Unzip the downloaded archive and add libcrypto-1_1-x64.dll to unziped files

5) Open the folder in the console for windows users:

Windows 11:

  • Right mouse button, open in the terminal

Windows 10:

  • Copy the path in Explorer and run in Terminal cd FULL PATH

Create a project ✏️

These are simple steps to deploy an example smart contract in TON. You can read the official documentation here

Step-by-step guide

1) Open the terminal as an administrator and go to your project folder

2) To create a project, run toncli start YOUR-PROJECT-NAME

3) Go to the project folder cd YOUR-PROJECT-NAME

Result

Toncli has created a simple wallet project, you can see 4 folders in it:

  • build
  • func
  • fift
  • test

4) You can deploy it to testnet or mainnet: toncli deploy -n testnet

Examples

Contributors have prepared sample projects very well covered by the new tests. For example, now two commands can be used to deploy an NFT collection or a Jetton.

toncli start nft_colletion/jetton_minter/nft_item/jetton_wallet

All of these projects have a lot of interesting examples of toncli and blockchain interaction, as well as extremely tests that will help in developing custom smart contracts.

To test smart contracts using toncli, go to testing

Useful articles

Other useful articles about using toncli in development:

  1. All cli commands
  2. Run get-methods
  3. Multiple contracts
  4. Send boc with fift
  5. Project structure
  6. Interesting features
  7. Send internal fift messages
  8. How does the FunC test work?
  9. How to debug transactions with toncli?
  10. Dockerfile for FunC testing GitHub repository