TON Development: Architecture and Implementation
TON is not just a blockchain with fast transactions. The architecture with infinite sharding and the actor model imposes strict constraints on smart contract and back-end design. If you transfer approaches from EVM, you'll run into issues with parallel requests and bounce messages on mainnet. For instance, in one project we faced implementing a DEX with atomic swaps — due to the asynchronous model we had to switch to escrow contracts, saving months of development.
We build TON applications end-to-end. Our team has 5+ years of experience in blockchain and 20+ completed TON projects, covering the full cycle: from design to deployment and monitoring. We'll estimate your project in 1-2 days — just contact us.
How TON Architecture Affects Application Development
In TON, every smart contract is an actor. Messages are processed sequentially within a contract, but in parallel across different contracts. There is no global state, no synchronous calls. Instead, messages have a 1-2 block delay. This means atomicity of complex operations requires the commit-confirm-rollback pattern:
- Contract A locks a preliminary state and sends a request to Contract B.
- B processes the request and sends a confirm or reject.
- A receives the response and finalizes or rolls back the state.
Bounce messages are critical: if B returns an error, the bounced message goes back to A. If A lacks a handler, funds can get stuck. Proper bounce handling reduces risk by 90%.
Smart Contracts: FunC vs Tact, When to Use What
For most tasks we use Tact — strict typing, built-in checks, readable syntax. Jetton (TEP-74), NFT (TEP-62), custom business logic — all in Tact. Compared to FunC, Tact cuts development time by 30–50% (2x faster).
FunC is for maximum gas optimization or non-standard cell layout work.
| Criterion | Tact | FunC |
|---|---|---|
| Security | High (typed) | Medium (low-level) |
| Development speed | High (2x faster) | Low |
| Gas optimization | Good | Maximum |
| Suited for | Jetton, NFT, business logic | High-load contracts |
We use standard audited templates (Jetton Minter + Wallet) from TON Foundation. This reduces audit costs by 70% (from $10,000 to $3,000).
Why Store Data in Child Contracts?
TON charges storage fees for data storage. If a contract accumulates all user data in one place, it quickly depletes its balance and freezes. The correct pattern: master contract + per-user contracts (like jetton minter + jetton wallet). This reduces storage fees by orders of magnitude compared to a monolithic contract, saving up to $5,000 per month for a high-load dApp.
How to Integrate TON Connect?
TON Connect 2.0 is the protocol for connecting wallets (Tonkeeper, MyTonWallet, Tonhub). Integration via @tonconnect/sdk or @tonconnect/ui-react. Step-by-step:
- Install the package:
npm install @tonconnect/sdk. - Create a
TonConnectinstance with app settings. - Call
connector.connect()to display a QR code. - Handle the
onStatusChangeevent to get the wallet address. - Use
connector.sendTransaction()to sign transactions, verifying the result via polling.
import { useTonConnectUI } from '@tonconnect/ui-react'; const [tonConnectUI] = useTonConnectUI(); const sendTransaction = async () => { const result = await tonConnectUI.sendTransaction({ messages: [{ address: contractAddress, amount: toNano('0.05').toString(), payload: beginCell() .storeUint(0x1234, 32) .storeAddress(userAddress) .endCell() .toBoc() .toString('base64') }] }); }; Back-end and Event Indexing
TON has no event logs. Transactions are read via TON HTTP API or tonapi.io. For production, we use tonapi.io — reliable, with high rate limits and webhooks. For custom indexing, we build our own indexer based on ton-index-worker or managed solutions (TONX, GetBlock). We write data to PostgreSQL and build the API on Node.js/FastAPI. This handles up to 10,000 requests per second.
Front-end: Stack and Specifics
The EVM stack doesn't work for TON. We use:
- @ton/core, @ton/ton
- @tonconnect/ui-react
- Telegram Mini App (TMA) via @telegram-apps/sdk
TMA is the primary pattern for mass-market applications. Contact us to discuss your project and get a commercial proposal.
What's Included in the Work
- Architecture design (message flow diagram, storage model)
- Smart contract development and testing
- Back-end deployment (API, indexer)
- Front-end with TON Connect
- Mainnet deployment and monitoring
- Documentation and source code delivery
- Post-launch support (optional)
Development Process
| Stage | Timeline |
|---|---|
| Design | 3-5 days |
| Contract development | 1-2 weeks |
| Back-end | 1-2 weeks |
| Front-end + TON Connect | 1-2 weeks |
| Deployment and monitoring | 2-3 days |
Final timelines for a full TON application: 2-4 weeks depending on complexity. Order development — we'll calculate exact timelines and cost in 1-2 days.
Typical Mistakes
- Ignoring bounce. Handle bounced messages in every contract that sends funds.
- Storing everything in one contract. Use per-user contracts.
- Not accounting for storage fees. Build in a replenishment mechanism.
We have ready-made solutions and templates to accelerate development. Get a consultation — we'll answer all your questions. Our proven experience guarantees delivery on time and within budget.







