Skip to main content


A person can deploy smart-contracts using tons and tonsdk. There are three options: send-boc, send-internal and send-external.

Send internal allows a user to send any internal message using any of their wallets

$ tons dev send-internal ./scripts/ deploy_through_internal MY_WALLET_NAME 0.1 --wait
# ./scripts/ example. 
# Function must receive WalletContract and return (str, Optional[Cell], Optional[Cell]) values.

from typing import Optional

from tonsdk.contract.wallet import WalletContract
from tonsdk.boc import Cell
from tonsdk.contract.token.ft import JettonMinter

def deploy_through_internal(wallet: WalletContract) -> (str, Optional[Cell], Optional[Cell]):
minter = JettonMinter(admin_address=wallet.address,

return minter.address.to_string(), minter.create_state_init()["state_init"], None

Send external allows a user to create an external message using tonsdk and send it to the TON blockchain

$ tons dev send-external ./scripts/ deploy_through_external --wait
# ./scripts/ example. 
# Function must receive nothing and return (str, Cell) values.
from tonsdk.contract.wallet import WalletContract, WalletVersionEnum, Wallets
from tonsdk.boc import Cell

def deploy_through_external() -> (str, Cell):
wallet_workchain = 0
wallet_version = WalletVersionEnum.v3r2
wallet_mnemonics = "YOUR 24 ... WORDS".split(" ")

_mnemonics, _pub_k, _priv_k, wallet = Wallets.from_mnemonics(
wallet_mnemonics, wallet_version, wallet_workchain)
return wallet.address.to_string(), wallet.create_init_external_message()["message"]

Note: to deploy a wallet one can use '$ tons wallet init WALLET_NAME'

Send boc allows to send a .boc file to the TON blockchain

$ tons dev send-boc ./generated-through-fif.boc --wait


Example of automatic salary payment, you may use cron to run

$ cat
employee1 EQDvtizebIVTGYASXgjYX5sHfkGLW8aFTa7wfYCyARIpARB0 10
employee2 EQA-Ri7Oftdjq--NJmuJrFJ1YqxYk6t2K3xIFKw3syhIUgUe 20
employee3 EQCNLRRZkvoqAW6zwYyy_BVwOBcMnwqvyrSpm8WnACdzXuu3 15.5

$ cat
cd ~/team_workspace/ton/
source venv/bin/activate
tons config tons.keystore_name myKeystore

while IFS= read -r line

tons wallet transfer salaryWallet $name $salary --wait
done < "$input"


toncli uses deploy wallet with the following params:

  • version v3r2
  • subwallet-id 0
  • workchain 0

First a developer should create a tons wallet

$ tons wallet create toncli-deployer -v v3r2 -w 0 -id 0 --save-to-whitelist toncli-deployer

Then get the path of toncli deploy wallet

$ python
>>> from appdirs import user_config_dir
>>> import os
>>> user_config_dir("toncli") # output may be different
/Users/username/Library/Application Support/toncli
>>> os.path.join(user_config_dir("toncli"), "wallet", "build") # output may be different
/Users/username/Library/Application Support/toncli/wallet/build

Finally, replace toncli default wallet with the tons one

$ tons wallet to-addr-pk toncli-deployer '/Users/username/Library/Application Support/toncli/wallet/build'
$ cd '/Users/username/Library/Application Support/toncli/wallet/build'
$ mv && mv contract.addr backup_old.addr
$ mv && mv toncli-deployer.addr contract.addr