⚠️ ton-dev-cli is deprecated. Please use tondev package instead.
TON Labs Dev Command Line Tool
See https://docs.ton.dev for documentation.
Also check our Youtube channel for tutorials.
-
Node.js
>= 10.x installed -
Docker
>= 19.x installed
npm install -g ton-dev-cli
See installation guide in case of problems
While installed globally, ton-dev-cli
package places its executable tondev
into system path, so you could
use it everywhere in your file system as a main command to invoke the tool.
Type:
tondev
info
(or just tondev
) - to see current status
tondev
-V
- to see ton-dev-cli
version
tondev
-a
- to see versions of the compilers and node containers available in DockerHub registry
tondev
-h
or tondev
--help
for the help about usage, options and subcommands
You can use
-h
or--help
option with any subcommand to get extended help about its usage. Also full help content is included in this document below.
In order to get started, run: tondev setup
The command triggers Docker image pull from DockerHub registry and launches the corresponding containers:
- tonlabs-compilers-<local user name> that is used for building solidity contracts
- tonlabs-local-node-<local user name> is a local TON node container runs compiled contracts.
You can specify additional options to customize the installation:
-n
,--networks
-m
,--compilers
To start and stop both containers, use the tondev start
and tondev stop
commands.
Use these commands to save machine resources.
-
restart
restarts the installed containers. -
recreate
removes containers and re-creates them again. Start tondev utility again after. -
-n
,--networks [names]
applies the command to specified network(s) (use comma to separate) -
-m
,--compilers applies
the command to the compiler kit container
To test your contract at multiple nodes, create a network. A network consists of multiple inter-connected local nodes.
A single run of tondev setup
creates a single local node listening to port 80.
In order to add another node:
tondev add anotherNode
​tondev set --port 81 anotherNode
tondev add
adds another node to network config. By default it uses port 80.
Given that multiple nodes cannot use the same port, reset the port with tondev set -p
.
Note: You can add multiple nodes simultaneously by separating names with a space.
It is useful to expose ArangoDB built in each local node. To do it, run:
tondev set --db-port 8881 anotherNode
Instead of the port number you can specify "bind" to use the default Arango DB port or "unbind" to stop exposing the port.
In order to rename a node, run:
tondev set --new-name newName oldName
To remove a node run tondev remove anotherNode
or tondev rm anotherNode
.
Solidity contracts are compiled with the following command:
tondev sol [options] [files...]
The following options are available:
-l
,--client-languages <languages>
to generate client code for languages: "js" (use comma to separate several languages)-L
,--client-level <client-level>
client code level: "run" to run only, "deploy" to run and deploy (includes an imageBase64 of a binary contract)
tondev CLI allows switching between compiler versions; run:
tondev use 0.14.0
The command pulls a relevant Docker container. You can also run:
tondev use [options] <version> to use specified version for containers
In order to remove Docker containers and images related to TON Dev, run:
tondev clean
The following options are available to customize the command:
-n
,--networks
clean local node docker containers and images-m
,--compilers
clean compilers docker containers and images-c
,--containers
clean containers only (default: false)
If no option is specified, the command removes all TON Dev docker containers and images.
command: keys
Usage: tondev keys|k
[options]
Generate random Key Pair
Usage: tondev [options] [command]
TON Labs development tools
Options:
-V, --version output the version number
-a, --available Show available versions.
-h, --help display help for command
Commands:
info [options] Show summary about dev environment.
sol [options] [files...] Build solidity contract[s].
gen [options] [files...] Generate client code for contract[s].
start [options] Start dev containers.
stop [options] Stop dev containers.
restart [options] Restart dev containers.
recreate [options] Recreate dev containers.
setup [options] Setup dev environment.
clean [options] Remove docker containers and images related to
TON Dev.
use [options] <version> Use specified version for containers.
set [options] [network...] Set network[s] options.
add [network...] Add network[s].
remove|rm [network...] Remove network[s].
keys|k Generate random Key Pair.
addr|a <addr> Convert address.
help [command] display help for command
Usage: tondev info [options]
Show summary about dev environment.
Options:
-a, --available Show available versions.
-h, --help display help for command
Usage: tondev sol [options] [files...]
Build solidity contract[s].
Options:
-l, --client-languages <languages> Generate client code for specified
languages separated by comma, supported
languages: "js".
-L, --client-level <client-level> Client code level: "run" to run only,
"deploy" to run and deploy (includes an
imageBase64 of binary contract) (default:
"deploy")
--js-module <module-type> Java Script module type: `node` to use
with `const FooContract =
require('foo')`, `nodeNoDefault` to use
with `const {FooContract} =
require('foo')`, `es` to use with `import
FooContract from 'foo'`, `esNoDefault` to
use with `import {FooContract} from
'foo'`. (default: "node")
-h, --help display help for command
Usage: tondev gen [options] [files...]
Generate client code for contract[s].
Options:
-l, --client-languages <languages> Generate client code for specified
languages separated by comma, supported
languages: "js". (default: "js")
-L, --client-level <client-level> Client code level: "run" to run only,
"deploy" to run and deploy (includes an
imageBase64 of binary contract) (default:
"deploy")
--js-module <module-type> Java Script module type: `node` to use
with `const FooContract =
require('foo')`, `nodeNoDefault` to use
with `const {FooContract} =
require('foo')`, `es` to use with `import
FooContract from 'foo'`, `esNoDefault` to
use with `import {FooContract} from
'foo'`. (default: "node")
-h, --help display help for command
Usage: tondev start [options]
Start dev containers.
Options:
-n, --networks [names] Apply command to specified network[s] (names must be
separated with comma).
-m, --compilers Apply command to the compilers container.
-h, --help display help for command
Usage: tondev stop [options]
Stop dev containers.
Options:
-n, --networks [names] Apply command to specified network[s] (names must be
separated with comma).
-m, --compilers Apply command to the compilers container.
-h, --help display help for command
Usage: tondev restart [options]
Restart dev containers.
Options:
-n, --networks [names] Apply command to specified network[s] (names must be
separated with comma).
-m, --compilers Apply command to the compilers container.
-h, --help display help for command
Usage: tondev recreate [options]
Recreate dev containers.
Options:
-n, --networks [names] Apply command to specified network[s] (names must be
separated with comma).
-m, --compilers Apply command to the compilers container.
-h, --help display help for command
Usage: tondev setup [options]
Setup dev environment.
Options:
-n, --networks [names] Apply command to specified network[s] (names must be
separated with comma).
-m, --compilers Apply command to the compilers container.
-h, --help display help for command
Usage: tondev clean [options]
Remove docker containers and images related to TON Dev.
Options:
-n, --networks Clean local node docker containers and images.
-m, --compilers Clean compilers docker containers and images.
-c, --containers Clean containers only. (default: false)
-h, --help display help for command
Usage: tondev use [options] <version>
Use specified version for containers.
Options:
-n, --networks [names] Apply command to specified network[s] (names must be
separated with comma).
-m, --compilers Apply command to the compilers container.
-h, --help display help for command
Usage: tondev set [options] [network...]
Set network[s] options.
Options:
-p, --port <port> Host port to bound local node.
-d, --db-port <binding> Host port to bound local nodes Arango DB ("bind" to
use default Arango DB port, "unbind" to unbind
Arango DB port).
-n, --new-name <name> Set new name for network.
-h, --help display help for command
Usage: tondev add [options] [network...]
Add network[s].
Options:
-h, --help display help for command
Usage: tondev remove|rm [options] [network...]
Remove network[s].
Options:
-h, --help display help for command
Usage: tondev keys|k [options]
Generate random Key Pair.
Options:
-h, --help display help for command
Usage: tondev addr|a [options] <addr>
Convert address.
Options:
-h, --help display help for command
Usage: tondev [options] [command]
TON Labs development tools
Options:
-V, --version output the version number
-a, --available Show available versions.
-h, --help display help for command
Commands:
info [options] Show summary about dev environment.
sol [options] [files...] Build solidity contract[s].
gen [options] [files...] Generate client code for contract[s].
start [options] Start dev containers.
stop [options] Stop dev containers.
restart [options] Restart dev containers.
recreate [options] Recreate dev containers.
setup [options] Setup dev environment.
clean [options] Remove docker containers and images related to
TON Dev.
use [options] <version> Use specified version for containers.
set [options] [network...] Set network[s] options.
add [network...] Add network[s].
remove|rm [network...] Remove network[s].
keys|k Generate random Key Pair.
addr|a <addr> Convert address.
help [command] display help for command
Copyright 2018-2020 TON DEV SOLUTIONS LTD.
Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at: https://www.ton.dev/licenses
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific TON DEV software governing permissions and limitations under the License.