On TON, smart contracts never call each other synchronously. Each contract is an independent actor with its own balance, code and storage, and the only way to interact is to send it a message, which is processed in a separate transaction, often in a later block and possibly on a different shard. There is no shared call stack, no return value and no atomic rollback across contracts: if a later step fails, the earlier ones have already happened, and a bounce message is the only way to undo them. Jettons (the TEP-74 fungible token standard) follow from this design: instead of one contract holding a balance table for every user, a jetton master defines the token and each holder gets their own jetton wallet contract. That keeps every contract's storage small and bounded, spreads load across shards, and makes each holder pay their own storage fees.
Everything is a message
TON applies the actor model literally. A contract wakes up when a message arrives, runs its code against its own state, and can emit new messages. There are two kinds that matter day to day:
- External inbound messages come from outside the chain, such as a user's signed instruction to their wallet contract. They carry no TON, so the receiving contract has to check the signature and sequence number, then call
accept_message()to agree to pay gas from its own balance. Wallets add avalid_untiltime and aseqnoto stop replays. - Internal messages are sent from one contract to another. They carry TON value (which pays for the recipient's processing), an optional body starting with a 32-bit opcode and 64-bit
query_id, and a bounce flag.
A contract can't read another contract's state on-chain. Get-methods such as get_wallet_address exist only for off-chain callers through a node or API. If a contract needs information from another, it sends a request message and handles the reply in a later transaction.
The only ordering guarantee is per pair: messages from contract A to contract B arrive in the order A sent them, tracked by logical time. Messages from different senders to B have no guaranteed relative order.
What happens inside a TON transaction?
Each incoming message produces one transaction on the receiving contract, executed in phases:
| Phase | What happens |
|---|---|
| Storage | Storage fees owed since the last transaction are deducted. A contract that can't pay can be frozen. |
| Credit | The value attached to an internal message is added to the balance. |
| Compute | TVM runs the contract code. An exception here aborts state changes. |
| Action | Outgoing messages and other actions queued during compute are carried out. Running out of funds here also fails. |
| Bounce | If compute or action failed and the message was bounceable, a bounce message is sent back to the sender. |
A bounce returns the remaining value minus fees, with a body that starts with 0xFFFFFFFF followed by the beginning of the original body, so the sender can identify the failed request and undo its own earlier change. Sending to an address with no deployed contract with bounce = true simply returns the money; to fund a new wallet, you send non-bounceable (the UQ... address form rather than EQ...).
Why not just allow synchronous calls?
Because TON shards dynamically. The basechain (workchain 0) splits into more shardchains as load grows, and two contracts can sit in different shards produced by different validator groups. A synchronous call across shards would need both to be executed together, which defeats the point of sharding. Message passing lets each shard process its own contracts and hand messages on to whichever shard holds the recipient.
Since the Catchain 2.0 upgrade in April 2026, TON produces blocks roughly every 400 ms, but a flow with several hops still spans several blocks. NEAR makes the same trade-off for sharding, with asynchronous cross-contract calls and callbacks.
For EVM developers the biggest adjustment is that there is no atomicity. In Solidity, a revert anywhere unwinds everything. On TON, a three-step flow can succeed at step one, fail at step two and leave your system half-updated unless you design the bounce handling. Classic EVM-style reentrancy doesn't exist, but its cousin does: between sending a message and receiving the reply, other messages can arrive and see intermediate state.
Why do Jettons use separate wallets?
On Ethereum, an ERC-20 token is one contract with a mapping(address => uint256). On TON that design breaks down:
- Unbounded storage is expensive. TON charges rent for storage over time. A single contract holding millions of balances would pay ever-growing fees, and its dictionary operations get more expensive as it grows.
- One contract is one hot spot. Every transfer would hit the same contract in the same shard, serialising the whole token's activity.
- Who pays? With separate wallets, each holder's jetton wallet pays its own rent from TON attached to it, much as each Bitcoin coin is its own unit of state in the UTXO model.
So TEP-74 splits the token in two:
- The jetton master stores total supply, metadata, the admin and the jetton wallet code. It mints.
- Each holder has a jetton wallet storing just their balance, owner address and master address. Its address is derived deterministically from the wallet code and that initial data, so anyone can compute (or ask the master via
get_wallet_address) which jetton wallet belongs to which owner.
Solana reaches a similar shape for a different reason: its associated token accounts are also one per owner per mint, derived deterministically.
How does a Jetton transfer flow?
Alice sends 100 tokens to Bob:
- Alice's wallet contract receives her signed external message and sends an internal
transfer(0x0f8a7ea5) to Alice's jetton wallet, with TON attached for fees. - Alice's jetton wallet checks the sender is its owner, subtracts 100, and sends
internal_transfer(0x178d4519) to Bob's jetton wallet, attaching its code and data so the wallet is deployed if it doesn't exist yet. - Bob's jetton wallet checks that the message came from a genuine jetton wallet of the same master (by recomputing its address) or the master itself, then adds 100.
- If
forward_ton_amountis above zero, it sendstransfer_notification(0x7362d09c) to Bob, carrying the amount, the original sender and theforward_payload. - Leftover TON goes back to the
response_destinationasexcesses(0xd53276db).
If step 3 fails, Bob's jetton wallet bounces the internal_transfer, and Alice's jetton wallet handles the bounce by adding the 100 back. Burning uses burn (0x595f07bc) and burn_notification (0x7bdd97de) in the same pattern.
Building a transfer body with @ton/core looks like this. It is sent to your own jetton wallet, not to the recipient's:
import { Address, beginCell, toNano } from "@ton/core";
export function jettonTransferBody(opts: {
amount: bigint; // in the jetton's base units
to: Address; // recipient's main wallet, not their jetton wallet
responseTo: Address; // receives leftover TON
comment?: string;
}) {
const forwardPayload = opts.comment
? beginCell().storeUint(0, 32).storeStringTail(opts.comment).endCell()
: null;
return beginCell()
.storeUint(0x0f8a7ea5, 32) // op: transfer
.storeUint(BigInt(Date.now()), 64) // query_id
.storeCoins(opts.amount)
.storeAddress(opts.to)
.storeAddress(opts.responseTo)
.storeMaybeRef(null) // custom_payload: none
.storeCoins(toNano("0.000000001")) // forward_ton_amount: 1 nanoton so a notification fires
.storeMaybeRef(forwardPayload) // forward_payload: in a ref, or empty
.endCell();
}
// Send it to your jetton wallet with about 0.05 TON attached and bounce = true.
How do I accept Jetton deposits safely?
This is where most TON integration bugs live. Anyone can deploy a contract that sends your address a message with opcode 0x7362d09c and any amount it likes. A fake "USDT" notification looks byte-for-byte like a real one. The only thing that proves a deposit is the sender address: it must be the jetton wallet that the trusted master assigns to your address.
import { Address, beginCell } from "@ton/core";
import { TonClient } from "@ton/ton";
const client = new TonClient({ endpoint: "https://toncenter.com/api/v2/jsonRPC" });
export async function jettonWalletOf(master: Address, owner: Address): Promise<Address> {
const res = await client.runMethod(master, "get_wallet_address", [
{ type: "slice", cell: beginCell().storeAddress(owner).endCell() },
]);
return res.stack.readAddress();
}
// For each incoming message to your deposit address:
// 1. first 32 bits of the body == 0x7362d09c
// 2. message source equals jettonWalletOf(TRUSTED_MASTER, depositAddress)
// 3. read query_id (64), amount (coins), sender (address), forward_payload
// 4. credit `amount` in base units, deduplicating by transaction hash
Cache the expected jetton wallet address per (master, owner) pair, keep an allowlist of masters you support, and treat forward_payload as untrusted user input. If your service sends jettons, set forward_ton_amount to at least one nanoton, or recipients that rely on notifications (exchanges, contracts) won't see the transfer.
What this means in practice
- Attach enough TON for the whole chain of messages. A jetton transfer pays gas in at least two contracts plus forwarding fees; leftovers come back as
excesses. Too little value fails partway and bounces. - Design every multi-step flow around bounces. Decide what each contract does if its outgoing message fails, and test that path explicitly.
- Don't treat "sent" as "done". A transfer is complete only when the recipient's jetton wallet has processed
internal_transfer. Indexers and backends should follow the trace of transactions, not just the first one. - Verify senders by derived address, never by opcode or claimed token name.
- Watch storage rent. Long-lived contracts with little TON can be frozen; keep a balance on contracts you operate.
- Expect message reordering across senders. Use
query_idto match requests to replies, and don't assume a reply comes back before the next request arrives.
TON's own documentation now recommends the Tolk language over FunC for new contracts, but the message model above is the same in both. The mental model shift is similar to moving from EVM storage to Sui's object ownership: state is split into many small units that can be processed independently.
Summary
| Concept | On TON |
|---|---|
| Contract interaction | Asynchronous messages only; no synchronous calls or return values |
| Atomicity | Per contract transaction; multi-contract flows can partially succeed |
| Undoing a failed step | Bounce message back to the sender, handled explicitly |
| Ordering | Guaranteed only between the same sender and receiver |
| Jetton design | One master plus one wallet contract per holder (TEP-74) |
| Why separate wallets | Bounded storage, per-holder rent, parallelism across shards |
| Safe deposit check | Sender must equal the master's get_wallet_address(you) |
Get the weekly commit
New blockchain deep dives every week.