Free TON Development Environment
Get quick help in our telegram channel:
Download and install all the core TON.DEV components in one click and access them from a single interface.
- TONDEV - Free TON Development Environment
TONDEV is a Node.js package with CLI interface that allows to easily download and install all the core TON.DEV components in background and use them from a single interface. Also, this project serves as a backend for TONDEV VS Code extension.
These components are supported or will be supported soon.
Each component is downloaded and installed automatically for the target platform upon the first request.
- Debot - soon as part of tondev
- Solidity Compiler
- C/C++ Compiler
- TON OS Startup Edition – Local blockchain for development and testing
- TestSuite4 – Python lightweight framework for contract testing
- tonos-cli – Command line tool for TON OS. TONDEV helps with installation and version management.
- TON-SDK - Core SDK Library features: deploy and execute contracts, run get methods and so on.
TONDEV can be extended with other tools following the instructions of integration.
Node.js
>= 10.x installed- (optional)
Docker
>= 19.x installed - Solidity compiler requires VC++ Runtime on Windows. You can install it from the latest supported Visual C++ downloads.
npm i -g tondev
If you see an EACCES error when you try to install a package globally on Mac or Linux, please see this instruction
npm r -g tondev
npm i -g tondev
You can easily use tondev as a regular npm package in your JS applications.
Just add dependency into you package.json
:
npm i -s tondev
And then run any command from tondev:
const { consoleTerminal, runCommand } = require("tondev");
const path = require("path");
async function main() {
await runCommand(consoleTerminal, "sol compile", {
file: path.resolve(__dirname, "Hello.sol")
});
}
main();
tondev <tool> <command> ...args
Some tools (network, signer, contract, js) and commands have short aliases. For example instead of using tondev network list
you can use tondev n l
and even shorter tondev nl
.
This command creates a hello-world Solidity contract with comments that you can observe and compile.
tondev sol create Contract
This command compiles and links a selected Solidity contract. After successful compilation you get .abi.json and .tvc files that you can later use in your DApps to deploy and run contract methods.
tondev sol compile Contract.sol
This command shows the currently installed Solidity compiler version.
tondev sol version
This command updates the compiler and linker to the latest version.
tondev sol update
Attention! At the moment linker does not support versioning, so dispite the fact that its functionality changes over time, version stays the same (0.1.0).Use --force option to force update of it as well.
This command sets the compiler and linker versions and downloads them if needed.
tondev sol set --compiler 0.38.0 --linker 0.23.54
Attention! At the moment linker does not support versioning, so dispite the fact that its functionality changes over time, version stays the same (0.1.0).Use --force option to force update of it as well.
This command creates a basic C++ contract with comments that you can observe and compile.
tondev clang create Contract
This command compiles and links a selected C++ contract. After successful compilation you get .abi.json and .tvc files that you can later use in your DApps to deploy and run contract methods.
tondev clang compile Contract.cpp
This command shows the currently installed C++ compiler version.
tondev clang version
This command updates the compiler to the latest version.
tondev clang update
Use --force
or -f
option to force reinstall, if the compiler is already up to date.
This command sets the compiler version and downloads it if needed.
tondev clang set --compiler 7.0.0
Use --force
or -f
option to force reinstall, if the current version is the same as the requested version.
This command starts the TON OS SE container (Docker must be launched). When executed for the first time downloads the latest SE image from dockerhub.
tondev se start
This command shows the default TON OS SE version and list of other available versions.
tondev se version
default: 0.24.12
Available Versions: 0, 0.24, 0.24.5, 0.24.6, 0.24.8, 0.24.9, 0.24.10, 0.24.11, 0.24.12, latest
This command switches TON OS SE to the specified version and port and downloads it, if it is missing.
Attention! This command does not start TON OS SE, you need to run start
command separately.
tondev se set --version 0.24.11 --port 2020
This command resets the TON OS SE container (Docker must be launched) - restarts it from scratch with a clean database.
tondev se reset
This command downloads the latest TON OS SE image (Docker must be launched) and starts it.
tondev se update
This command stops TON OS SE container.
tondev se stop
This command shows info about the downloaded versions.
tondev se info
Instance State Version GraphQL Port ArangoDB Port Docker Container Docker Image
-------- ------- ------- ------------ ------------- -------------------------- --------------------------
default running 0.24.12 2020 tonlabs-tonos-se-ekaterina tonlabs/local-node:0.24.12
This command shows the list of available demo projects
tondev js demo
Result:
$ tondev js demo
Demo Description
----- -------------------------
hello Simple NodeJs Application
This command installs the specified demo project to the current directory. Proceed the instructions in the terminal to run it.
tondev js demo hello
This command creates a Node.js project with SDK latest dependencies and index.js file with main Client object creation.
tondev js create test_project
This command takes abi and, optionally, tvc file and generates a JS wrapper with abi and tvc converted into base64 that can be used further in SDK. tvc file must have the same name as abi.
tondev js wrap contractName.abi.json
The result name of the wrapper will be "ContractName||"Contract".js".
See other available generation options with help command:
tondev js wrap -h
TONDev Version: 0.4.0
Use: tondev js wrap file [options]
Args:
file ABI file
Options:
--help, -h Show command usage
--print, -p Print code to console
--output, -o Set output file name (default is built from source ABI file name)
--export, -e Export type and options
commonjs Use CommonJS modules (NodeJs)
commonjs-default Use CommonJS modules (NodeJS) with default export
es6 Use ES6 modules
es6-default Use ES6 modules with default export
TONDEV installs tonos-cli globally, so after the installation is complete, you can access the functionality via command:
tonos-cli <command> <args>
See the tonos-cli usage documentation.
See tonos-cli guides.
This command installs the latest tonos-cli
tondev tonos-cli install
The installer requires NPM to be installed, so it can install packages globally without using sudo.
In case of error, manually set environment variable PATH=$PATH:$HOME./tondev/solidity
This command shows the used tonos-cli version and list of available for download versions
tondev tonos-cli version
Version Available
--------- ------------------------------------------------------
0.8.1 0.6.0, 0.6.1, 0.6.2, 0.7.1, 0.6.3, 0.7.0, 0.8.0, 0.8.1
This command specifies tonos-cli version to use and downloads it if needed.
tondev tonos-cli set --version 0.8.0
This command updates tonos-cli version to the latest
tondev tonos-cli update
TestSuite4 is a framework designed to simplify development and testing of TON Contracts. It contains lightweight blockchain emulator making it easy to develop contracts in a TDD-friendly style.
For more information, visit TestSuite4's documentation.
ℹ️ Python 3.6 - 3.9
and pip
required.
This command shows the currently installed and available TestSuite4 framework versions.
tondev ts4 version
This command installs (using pip
) TestSuite4's latest or selected version and downloads them if needed.
tondev ts4 install # install latest version
tondev ts4 install 0.2.0 # install version 0.2.0
This command updates TestSuite4 to the latest version.
tondev ts4 update
This command creates a TestSuite4's template of the test (TestName.py
).
tondev ts4 create TestName
tondev ts4 create TestName --folder tests # creates tests/TestName.py (folder must exist)
This command runs selected test (TestName.py
).
tondev ts4 run TestName
Signer registry is a centralized place where you can store your development keys.
Each signer in registry has an unique user defined name. All tondev commands that require signing or encryption refer to the signer by name.
You can mark one of the signers as a default. It can be used in signing commands without providing signer option.
Signer repository management in tondev is accessible through the signer
tool.
Note: If you need to generate an unsigned message, you may use the option --signer none
in any relevant commands in other controllers. Omitting the signer option altogether always means using the default signer.
Note: Keys in the repository are stored unencrypted.
This command adds a signer with randomly generated keys.
tondev signer generate signer_name
See other available generation options with help command:
tondev signer generate -h
TONDev Version: 0.5.0
Use: tondev signer generate name [options]
Args:
name Signer name
Options:
--help, -h Show command usage
--mnemonic, -m Use mnemonic phrase
--dictionary, -d Mnemonic dictionary
0 TON
1 English
2 Chinese Simplified
3 Chinese Traditional
4 French
5 Italian
6 Japanese
7 Korean
8 Spanish
--words, -w Number of mnemonic words
--force, -f Overwrite signer if already exists
This command adds a signer with previously generated (e.g. with tonos-cli) keys.
tondev signer add signer_name signer_secret_key_or_seed_phrase_in_quotes
See other available signer addition options with help command:
tondev signer add -h
TONDev Version: 0.5.0
Use: tondev signer add name secret [options]
Args:
name Signer name
secret Secret key or seed phrase
Options:
--help, -h Show command usage
--dictionary, -d Mnemonic dictionary
0 TON
1 English
2 Chinese Simplified
3 Chinese Traditional
4 French
5 Italian
6 Japanese
7 Korean
8 Spanish
--force, -f Overwrite signer if already exists
Note: By default the dictionary is set to english, which allows using seed phrases generated by other TONOS tools, such as tonos-cli.
This command lists all registered signers with their public keys.
tondev signer list
Result:
$ tondev signer list
Signer Public Key
--------------- ----------------------------------------------------------------
sign1 (Default) cffd3a2f1d241807b2205220a7d6df980e67a3cc7c47eba2766cdc1bbddfc0e3
sign2 0fc4e781720d80f76257db333c6b6934090562418652cf30352878c87707aa94
This command lists all information (including secret data) for a specified signer.
tondev signer info signer_name
Result:
$ tondev signer info sign2
{
"name": "sign2",
"description": "",
"keys": {
"public": "760d69964d038997d891fca0a0407c2ffefb701e7cb2f9ff0a87fbbf1e8098f2",
"secret": "72571b5a9392e6bb215b460ca3c0545c34d790e185f66f5b2e7564329ffea86c"
}
}
This command sets a previously added signer as default (initially the first added signer is used by default).
tondev signer default signer_name
This command deletes a previously added signer from signer registry.
tondev signer delete signer_name
Network tool is a convenient way to organize all of your network configurations in one place.
You can register several blockchains (networks) under short names and then use these names as a target blockchain when working with contracts.
You can mark one of the networks as a default. It can be used in network commands without providing net name.
This command adds a network to the tondev registry.
tondev network add network_name network_endpoints
See other available network addition options with help command:
$ tondev network add -h
TONDev Version: 0.5.0
Use: tondev network add name endpoints [options]
Args:
name
endpoints Comma separated endpoints
Options:
--help, -h Show command usage
--force, -f Overwrite key if already exists
Example with all main.ton.dev endpoints:
tondev network add main main.ton.dev,main2.ton.dev,main3.ton.dev,main4.ton.dev
This command sets a giver account for a network. Giver will be used to top up your account balances on the network, including during deployment.
tondev network giver network_name giver_address
See other available network addition options with help command:
$ tondev network giver -h
TONDev Version: 0.5.0
Use: tondev network giver name address [options]
Args:
name Network name
address Giver address
Options:
--help, -h Show command usage
--signer, -s Signer to be used with giver
--value, -v Deploying account initial balance in nanotokens
Note: The default signer and the initial balance value of 10 tokens will be used, unless otherwise specified through options. Also note, that some contracts may require a higher initial balance for successful deployment. DePool contract, for instance, requires a minimun of 21 tokens.
This command lists all registered networks, their public endpoints, and their giver addresses, if any.
tondev network list
Result:
$ tondev network list
Network Endpoints Giver
------------- ----------------------------------------------- ------------------------------------------------------------------
se http://localhost 0:b5e9240fc2d2f1ff8cbb1d1dee7fb7cae155e5f6320e585fcc685698994a19a5
dev (Default) net.ton.dev, net1.ton.dev, net5.ton.dev 0:255a3ad9dfa8aa4f3481856aafc7d79f47d50205190bd56147138740e9b177f3
main main.ton.dev, main2.ton.dev, main3.ton.dev, ...
This command sets a previously added network as default (initially the mainnet is used by default).
tondev network default network_name
This command deletes a network from tondev registry.
tondev network delete network_name
Contract management in tondev gives you the ability to easily deploy and run your smart contracts on blockchain network(s).
This command displays a detailed summary for a contract. Contract ABI and TVC files are required to run it. Account address on the network is calculated from TVC and signer.
tondev contract info abi_filename
Result example:
$ tondev contract info SetcodeMultisigWallet.abi.json
Configuration
Network: dev (net.ton.dev, net1.ton.dev, net5.ton.dev)
Signer: test (public ad4bf7bd8da244932c52127a943bfa9217b6e215c1b3307272283c4d64f34486)
Address: 0:04dee1edc3f3d6b23529dcf5a6133627d06a39826bb14cc6334ffea272b15d50 (calculated from TVC and signer public)
Code Hash: e2b60b6b602c10ced7ea8ede4bdf96342c97570a3798066f3fb50a4b2b27a208 (from TVC file)
Account: Active
Balance: 1919381000 (≈ 2 tokens)
Details: {
"json_version": 5,
"id": "0:04dee1edc3f3d6b23529dcf5a6133627d06a39826bb14cc6334ffea272b15d50",
"workchain_id": 0,
"boc": "te6ccgECZwEAGvQAAm/AAE3uHtw/PW ... 4MEDIoIQ/////byxkOAB8AH4R26Q3o (6912 bytes)",
"last_paid": 1619084675,
"bits": "0xcbc7",
"cells": "0x67",
"public_cells": "0x0",
"last_trans_lt": "0x3baac81fb43",
"balance": "0x72676e08",
"code": "te6ccgECXwEAGcoAAib/APSkICLAAZ ... wQMighD////9vLGQ4AHwAfhHbpDeg= (6614 bytes)",
"code_hash": "e2b60b6b602c10ced7ea8ede4bdf96342c97570a3798066f3fb50a4b2b27a208",
"data": "te6ccgEBBwEA7gAC361L972NokSTLF ... S/Xy90TNN3lUFM1WGpdlIcBQDAAAFA (249 bytes)",
"data_hash": "ec28abd34e75f40a66561bdc06b436cbe24d10d5da7519a7d5db41026c67155d",
"acc_type": 1,
"acc_type_name": "Active"
}
Network, signer, data and account address parameters can be overridden with the following options:
$ tondev contract info -h
TONDev Version: 0.5.0
Use: tondev contract info file [options]
Args:
file ABI file
Options:
--help, -h Show command usage
--network, -n Network name
--signer, -s Signer key name
--data, -d Deploying initial data as name:value,...
This data is required to calculate the account address and to
deploy contract.
Array values must be specified as [item,...]. Spaces are not
allowed. If value contains spaces or special symbols "[],:"
it must be enclosed in "" or ''
--address, -a Account address
This command deploys a contract to the blockchain. Contract ABI and TVC files are required to run it.
tondev contract deploy abi_filename
Command displays deployment summary and requests constructor function parameters. Result example:
$ tondev contract deploy Contract.abi.json
Configuration
Network: dev
Signer: sign1
Address: 0:0435cb4e70585759ac514bb9fd1770caeb8c3941d882b5a16d589b368cb49261
Enter constructor parameters
param1 (uint256[]): value
Enter constructor parameters
param2 (uint8): value
Deploying...
Deploy parameters can be specified in the deploy command with the following options:
$ tondev contract deploy -h
TONDev Version: 0.5.0
Use: tondev contract deploy file function [options]
Args:
file ABI file
function Function name
Options:
--help, -h Show command usage
--network, -n Network name
--signer, -s Signer key name
--input, -i Function parameters as name:value,...
Array values must be specified as [item,...]. Spaces are not
allowed. If value contains spaces or special symbols "[],:"
it must be enclosed in "" or ''
--data, -d Deploying initial data as name:value,...
This data is required to calculate the account address and to
deploy contract.
Array values must be specified as [item,...]. Spaces are not
allowed. If value contains spaces or special symbols "[],:"
it must be enclosed in "" or ''
--value, -v Deploying balance value in nano tokens
--prevent-ui, -p Prevent user interaction
Useful in shell scripting e.g. on server or in some
automating to disable waiting for the user input.
Instead tondev will abort with error.
For example when some parameters are missing in command line
then ton dev will prompt user to input values for missing
parameters (or fails if prevent-ui option is specified).
Example of a 2/3 multisig wallet deployment command:
tondev contract deploy SetcodeMultisigWallet.abi.json constructor -n dev -s sign1 -i owners:[0xad4bf7bd8da244932c52127a943bfa9217b6e215c1b3307272283c4d64f34486,0x5c2e348c5caeb420a863dc5e972f897ebe5ee899a6ef2a8299aac352eca4380a,0x8534c46f7a135058773fa1298cb3a299a5ddd40dafe41cb06c64f274da360bfb],reqConfirms:2
This command runs any function of a contract deployed on the blockchain. Contract ABI and TVC files are required to run it.
tondev contract run abi_filename
Command displays available functions and asks to select one. Result example:
$ tondev contract run Contract.abi.json
Configuration
Network: dev
Signer: sign1
Address: 0:a4629d617df931d8ad86ed24f4cac3d321788ba082574144f5820f2894493fbc
Available functions:
1) func1
2) func2
Select function (number): 2
Running...
Network, signer and account address parameters can be overridden and function parameters specified in the command with the following options:
$ tondev contract run -h
TONDev Version: 0.5.0
Use: tondev contract run file function [options]
Args:
file ABI file
function Function name
Options:
--help, -h Show command usage
--network, -n Network name
--signer, -s Signer key name
--data, -d Deploying initial data as name:value,...
This data is required to calculate the account address and to
deploy contract.
Array values must be specified as [item,...]. Spaces are not
allowed. If value contains spaces or special symbols "[],:"
it must be enclosed in "" or ''
--address, -a Account address
--input, -i Function parameters as name:value,...
Array values must be specified as [item,...]. Spaces are not
allowed. If value contains spaces or special symbols "[],:"
it must be enclosed in "" or ''
--prevent-ui, -p Prevent user interaction
Useful in shell scripting e.g. on server or in some
automating to disable waiting for the user input.
Instead tondev will abort with error.
For example when some parameters are missing in command line
then ton dev will prompt user to input values for missing
parameters (or fails if prevent-ui option is specified).
Example of creating a transaction and cnfirming it in a multisig wallet:
tondev contract run SetcodeMultisigWallet.abi.json submitTransaction -n dev -s sign1 -i dest:255a3ad9dfa8aa4f3481856aafc7d79f47d50205190bd56147138740e9b177f3,value:500000000,bounce:true,allBalance:false,payload:""
tondev contract run SetcodeMultisigWallet.abi.json confirmTransaction -n dev -a 0:04dee1edc3f3d6b23529dcf5a6133627d06a39826bb14cc6334ffea272b15d50 -s sign2 -i transactionId:6954030467099431873
This command downloads a contract and runs it locally on TVM. Contract ABI and TVC files are required to run it.
tondev contract run-local abi_filename
Command displays available functions and asks to select one. Result example:
$ tondev contract run-local Contract.abi.json
Configuration
Network: dev
Signer: sign1
Address: 0:a4629d617df931d8ad86ed24f4cac3d321788ba082574144f5820f2894493fbc
Available functions:
1) func1
2) func1
Select function (number):
Network, signer and account address parameters can be overridden and function parameters specified in the command with the following options:
$ tondev contract run-local -h
TONDev Version: 0.5.0
Use: tondev contract run-local file function [options]
Args:
file ABI file
function Function name
Options:
--help, -h Show command usage
--network, -n Network name
--signer, -s Signer key name
--data, -d Deploying initial data as name:value,...
This data is required to calculate the account address and to
deploy contract.
Array values must be specified as [item,...]. Spaces are not
allowed. If value contains spaces or special symbols "[],:"
it must be enclosed in "" or ''
--address, -a Account address
--input, -i Function parameters as name:value,...
Array values must be specified as [item,...]. Spaces are not
allowed. If value contains spaces or special symbols "[],:"
it must be enclosed in "" or ''
--prevent-ui, -p Prevent user interaction
Useful in shell scripting e.g. on server or in some
automating to disable waiting for the user input.
Instead tondev will abort with error.
For example when some parameters are missing in command line
then ton dev will prompt user to input values for missing
parameters (or fails if prevent-ui option is specified).
This command downloads a contract and emulates transaction execution locally on TVM. Contract ABI and TVC files are required to run it.
tondev contract run-executor abi_filename
Command displays available functions and asks to select one. Result:
$ tondev contract run-executor Contract.abi.json
Configuration
Network: dev
Signer: sign1
Address: 0:a4629d617df931d8ad86ed24f4cac3d321788ba082574144f5820f2894493fbc
Available functions:
1) func1
2) func2
Select function (number):
Network, signer and account address parameters can be overridden and function parameters specified in the command with the following options:
$ tondev contract run-executor -h
TONDev Version: 0.5.0
Use: tondev contract run-executor file function [options]
Args:
file ABI file
function Function name
Options:
--help, -h Show command usage
--network, -n Network name
--signer, -s Signer key name
--data, -d Deploying initial data as name:value,...
This data is required to calculate the account address and to
deploy contract.
Array values must be specified as [item,...]. Spaces are not
allowed. If value contains spaces or special symbols "[],:"
it must be enclosed in "" or ''
--address, -a Account address
--input, -i Function parameters as name:value,...
Array values must be specified as [item,...]. Spaces are not
allowed. If value contains spaces or special symbols "[],:"
it must be enclosed in "" or ''
--prevent-ui, -p Prevent user interaction
Useful in shell scripting e.g. on server or in some
automating to disable waiting for the user input.
Instead tondev will abort with error.
For example when some parameters are missing in command line
then ton dev will prompt user to input values for missing
parameters (or fails if prevent-ui option is specified).
If you have set a giver for a network, you can top up contract balances on it with the following command.
tondev contract topup abi_filename
Defalt signer and giver parameters will be used, unless otherwise specified through the following options:
$ tondev contract topup -h
TONDev Version: 0.5.0
Use: tondev contract topup file [options]
Args:
file ABI file
Options:
--help, -h Show command usage
--address, -a Account address
--network, -n Network name
--signer, -s Signer key name
--data, -d Deploying initial data as name:value,...
This data is required to calculate the account address and to
deploy contract.
Array values must be specified as [item,...]. Spaces are not
allowed. If value contains spaces or special symbols "[],:"
it must be enclosed in "" or ''
--value, -v Deploying balance value in nano tokens
This command displays a summary of all controller configurations.
tondev info
Output example:
$ tondev info
C++ compiler
Component Version Available
--------- ------- ---------
clang 7.0.0 7.0.0
Solidity Compiler
Component Available
--------- ----------------------------------------------
compiler 0.42.0, 0.41.0, 0.40.0, 0.39.0, 0.38.2, 0.38.1
linker 0.3.0, 0.1.0
stdlib 0.42.0, 0.41.0, 0.40.0, 0.39.0, 0.38.2, 0.38.1
TON OS SE
Instance State Version GraphQL Port Docker Container Docker Image
-------- ------------- ------- ------------ -------------------- -----------------------
default not installed 0.27 80 tonlabs-tonos-se-test tonlabs/local-node:0.27
Network Registry
Network Endpoints Giver
------------- ----------------------------------------------- ------------------------------------------------------------------
se http://localhost 0:b5e9240fc2d2f1ff8cbb1d1dee7fb7cae155e5f6320e585fcc685698994a19a5
dev (Default) net.ton.dev, net1.ton.dev, net5.ton.dev 0:255a3ad9dfa8aa4f3481856aafc7d79f47d50205190bd56147138740e9b177f3
main main.ton.dev, main2.ton.dev, main3.ton.dev, ...
Signer Registry
Signer Public Key
-------------- ----------------------------------------------------------------
surf 8534c46f7a135058773fa1298cb3a299a5ddd40dafe41cb06c64f274da360bfb
test (Default) ad4bf7bd8da244932c52127a943bfa9217b6e215c1b3307272283c4d64f34486
test2 5c2e348c5caeb420a863dc5e972f897ebe5ee899a6ef2a8299aac352eca4380a
TON OS CLI
Component Version Available
--------- ------- --------------------------------------------------------------------------------
tonoscli 0.11.3 0.11.4, 0.11.3, 0.11.2, 0.11.1, 0.11.0, 0.10.1, 0.10.0, 0.9.2, 0.9.1, 0.9.0, ...
TON Dev Environment is an integration point for development tools related to Free TON Blockchain.
There are two kind of software connected to TONDev:
- Development tools such as a compilers, networks, debuggers and so on.
- User Interaction services such as an IDE plugins, CLI, GUI applications etc.
Learn more about creating your own controller: Creating Controller
- Debot deployment
- Support other compilation and linking options