7Block Labs
Blockchain Development

ByAUJay

TON Development Services: Smart Contracts, Bots, and Mini Apps on TON

Short Summary

TON is shaping up to be a solid platform for rolling out consumer-focused Web3 in Telegram. We’re talking about some pretty cool features like audited smart contract languages (Tolk/Tact), seamless native payments (Stars, USDT), full-screen Mini Apps, and even 50/50 ad-revenue splits in Toncoin. This post breaks down everything decision-makers need to know to create secure, monetizable apps on TON by 2025, complete with real patterns, code snippets, and architecture tips. Check it out here!


Why build on TON now (2025)

  • Telegram just rolled out a new creator monetization feature! They’re splitting ad revenue 50/50 and paying exclusively in Toncoin. This is a game-changer for channels and apps looking for a straightforward business model. Check it out here!
  • Mini Apps are stepping up their game: you can now enjoy full-screen views, create homescreen shortcuts, use secure/local storage, and set up subscription tiers via Stars. Get the deets here!
  • If you’re into digital goods, Telegram Stars are your go-to in-app currency. Developers can easily convert Stars into Toncoin (or even discounted ads), which helps navigate around iOS and Play’s billing rules while still being crypto-friendly. Learn more here!
  • Big news for payments: USDT is now live on TON, backed by major exchanges and wallets. This opens up smooth consumer-grade payments and settlements. More info can be found here!
  • And check this out--the scale is impressive! Audited stress tests have recorded a whopping 104,715 TPS, thanks to TON’s dynamic sharding, or "infinite sharding," which keeps throughput super flexible. Dive into the details here!

What this means is that you can roll out experiences that users can actually make money from, with low fees, and that feel familiar and easy to use--just like what they know from Web2. Plus, you'll be doing this for a massive social network with a billion users, and the best part? You won’t have to teach them a whole new way to navigate.


What we build at 7Block Labs on TON

  • We're diving into product strategy for experiences that are native to Telegram, focusing on things like growth loops, monetizing with Stars, and integrating TON's on-chain components.
  • On the tech side, we’re looking into smart contracts in Tolk and Tact, which means dealing with everything from tokens (like Jettons and NFTs 2.0) to payments, escrows, sales, auctions, loyalty programs, and data registries.
  • Don't forget about Telegram Bots! They’re not just for fun; they’ll serve as essential acquisition and orchestration layers--think deep links, inline flows, Star subscriptions, and payment service providers for physical goods.
  • We’re also rolling out full Telegram Mini Apps that integrate TonConnect wallet flows, offer USDT checkout, and provide solid observability.
  • And let’s talk infrastructure: we’ll be setting up indexers, webhooks, and nodes, implementing continuous integration for contracts, running security reviews, optimizing gas and costs, and keeping an eye on telemetry.

Smart contracts on TON: languages, fees, and patterns

Languages you’ll use in 2025

  • Tolk (recommended): This one’s the modern pick--it’s statically typed and compiles to TVM with lower gas costs. Tolk has now become the go-to language for TON smart contracts. Check it out here.
  • Tact: If you like TypeScript, you’ll appreciate Tact. It's got great ergonomics, and its compiler went through a thorough assessment by Trail of Bits. Plus, it’s super popular and still gets regular updates. More info is available here.
  • FunC: While it’s a bit of an oldie, FunC has proven itself over time. It’s still handy when you want to dive into older references and standards.

Quickstart Developer Workflow:

  • Kick things off with Blueprint and pick a Tolk/Tact template:
npm create ton@latest 
npx blueprint create <CONTRACT> --type tolk-counter

Check out the details at (docs.ton.org).

Costs and fees, precisely

TON fee calculations break down into three main components: storage, compute (gas), and forwarding fees. The gas price is determined by the network configuration. According to the latest documentation, basechain gas prices are set around 20/21, and there are handy helper functions that help you convert these into nanotons. Just a heads up--avoid hardcoding any fixed TON amounts; you should always derive them from your config and take accurate measurements instead. Check it out here for more details!

Best practices:

  • Always keep a positive reserve. Make sure to measure your contract’s maximum cell/bit footprint to limit your storage, and steer clear of hardcoding fee amounts. You can check out more details here.
  • Go for bounceable internal messages whenever you can. It’s super important to handle any bounced messages properly and not execute the embedded query when a bounce occurs. You can find more on this topic here.
  • Make sure you’re using user-friendly addresses the right way. Pay attention to bounceable vs non-bounceable flags, testnet markers, and the rules for checksums. For more info, click here.

Asynchronous model and idempotency

TON is all about being message-driven and sharded, so you should think about every handler as if it might run at least once. Here are some handy patterns to keep in mind:

  • Make sure to include query_id and replay windows in your messages, and don't sweat the duplicates.
  • Keep your read models off-chain (using TonAPI or Toncenter) while writing with on-chain contracts. Just remember, direct cross-contract “reads” don’t operate the same way as they do in EVM; you should design everything around messages. (tondev.org)
  • Try simulating complex race scenarios, like concurrent bounces, in a sandbox. There's some exciting new research tooling that zooms in on temporal bugs within TON’s async model. (arxiv.org)

Example Tolk contract snippet (safe counter with bounce handling)

// contracts/counter.tolk
struct Storage { counter: int64, lastQuery: int64 }

fun Storage.load() { return Storage.fromCell(contract.getData()); }
fun Storage.save(self) { contract.setData(self.toCell()); }

type Op = Inc | Reset
struct Inc { query_id: int64, by: int32 }
struct Reset { query_id: int64 }

receive in_msg {
  // Reserve original balance + any due storage; fail-safe against depletion.
  contract.reserveWithStorage(); // helper in stdlib

  if (in_msg.isBounced()) {
    // Never execute original payload on bounce
    return ();
  }

  // Decode operation lazily to save gas
  let op = lazy Op.fromSlice(in_msg.body);

  var s = lazy Storage.load();
  let now = now();

  match (op) {
    Inc => {
      if (op.query_id <= s.lastQuery) return (); // idempotent
      s.counter += op.by;
      s.lastQuery = op.query_id;
    }
    Reset => {
      if (op.query_id <= s.lastQuery) return ();
      s.counter = 0;
      s.lastQuery = op.query_id;
    }
  }

  s.save();
}

Notes:

  • The function reserveWithStorage() shows off the “cover storage on demand” strategy outlined in the fee documentation. You can check it out here: (docs.ton.org).

Standards you’ll rely on

  • Jettons (those fungible tokens) and NFTs now come with TEP‑62/64/66. With NFT 2.0, you can actually signal enforceable royalties throughout the ecosystem. Plus, there are reference implementations that are good to go! You can check them out here.
  • TON DNS, TON Sites, and TON Proxy make it super easy to link .ton domains to contracts and create decentralized sites. This is a great way to manage your on-chain identity and set up app endpoints. Learn more about it here.
  • TON Payments lets you set up payment channels for super quick micropayments, which is perfect for metered services. Check out the details here.
  • TON Storage offers a decentralized way to store “bags of files” for your assets and app data, and it syncs up nicely with DNS and Payments. Find out more here.

Bots: acquisition, monetization, and orchestration

Telegram Bots: Your Gateway to TON Apps

When it comes to your TON app, Telegram bots are like the welcoming front door. Looking ahead to 2024-2025, there are three key monetization paths you’ll want to keep an eye on:

  1. Stars for Digital Goods (In-App Compliant)
  • When it comes to subscriptions and digital items, go for “XTR” (Stars). Set up recurring invoices so users can easily pay right inside Telegram. Plus, you'll have the option to convert Stars into Toncoin or ad credits with a sweet ~30% discount on ads. Just remember to implement /paysupport and handle refunds according to the policy. (core.telegram.org)

2) PSPs for Physical Goods

  • If you're dealing with physical products or services, you’ll want to tap into the Bot Payments API. A great option here is Stripe, which supports popular payment methods like Apple Pay and Google Pay. Just make sure to keep an eye on Stripe’s restricted business lists and follow their provider checklists. You can find more info here.

3) Ad Revenue Share in Toncoin

  • For those running channels, Telegram is handing out a sweet deal: you get 50% of the ad revenue, all settled in TON! It's a great opportunity to create bots that can turn your viewers into Mini App users, while also streamlining Stars and ads into a unified profit and loss statement. Check out more details here.
  • To pass parameters into Mini Apps, you can use startapp and startattach, but make sure to stick to the allowed charset and length. You can find all the details here.
  • If you're looking for direct Mini App links, you can use this format: t.me//?startapp=...&mode=fullscreen|compact. Check out more about it here.
  • For opening Mini Apps programmatically on clients, use messages.requestAppWebView, and don't forget to set the flags for fullscreen/compact mode and write permission. More info is available here.

Security: validate initData correctly

  • Make sure to check the Telegram WebApp initData on your server using HMAC‑SHA256 along with your bot token. If you're sharing with third parties, don’t forget to verify the new Ed25519 signature using Telegram’s public key. Also, be sure to reject any old auth_date. (core.telegram.org)

Example (Node, Minimal Idea):

Imagine you’re diving into a Node.js project. Here's a super simple concept to kick things off:

  1. Setup Your Project
    First things first, create a new directory for your project. You can do this by running:

    mkdir my-node-app && cd my-node-app
  2. Initialize NPM
    Next up, you’ll want to initialize your Node.js application. Just run:

    npm init -y

    This creates a package.json file with default settings, making it easier to manage dependencies later.

  3. Install Express
    Now, let’s add Express, which is super handy for building web applications. You can install it with:

    npm install express
  4. Create Your Server
    After that, it’s time to whip up your server. Create a file called server.js and add this code:

    const express = require('express');
    const app = express();
    const PORT = process.env.PORT || 3000;
    
    app.get('/', (req, res) => {
        res.send('Hello, World!');
    });
    
    app.listen(PORT, () => {
        console.log(`Server is running on http://localhost:${PORT}`);
    });
  5. Run Your Server
    Finally, you can start your server by running:

    node server.js

Now, if you open your browser and head to http://localhost:3000, you should see "Hello, World!" staring back at you. Voila! You’ve got a minimal Node.js application up and running!

import { verifyTelegramInitData } from 'tg-user-validation'; // community lib
const ok = verifyTelegramInitData(initData, process.env.BOT_TOKEN, { maxAgeSeconds: 300 });
if (!ok) throw new Error('Invalid initData');

libraries.io

Stars subscription example (Node + Telegraf)

import { Telegraf } from 'telegraf';
const bot = new Telegraf(process.env.BOT_TOKEN!);

bot.command('subscribe', async (ctx) => {
  const link = await ctx.telegram.createInvoiceLink({
    title: 'Pro Plan',
    description: 'Monthly access to premium features',
    payload: `sub:${ctx.from?.id}:${Date.now()}`,
    currency: 'XTR', // Telegram Stars
    prices: [{ label: 'Monthly', amount: 499 /* 4.99 USD in Stars */ }],
    subscription_period: 30 * 24 * 60 * 60, // recurring monthly
  });
  return ctx.reply(`Subscribe: ${link}`);
});

bot.launch();
  • Using currency: 'XTR' activates the Stars payment rail along with recurring billing. Check it out here: (core.telegram.org).

Mini Apps: full‑fidelity apps inside Telegram

What’s New Lately:

  • We’ve got some cool updates: full-screen mode, homescreen shortcuts, DeviceStorage/SecureStorage for keeping things persistent, and a bunch of richer APIs rolled out with Bot API versions 8.0 to 9.1. Check it out over at core.telegram.org.

Core Stack for Production

  • React/Vue Mini App paired with TonConnect UI for seamless wallet connections
  • Settlement using USDT/Toncoin through TonConnect or direct deep links
  • Utilizing webhooks/indexer to keep state and receipts up to date

Wallet connection in Mini App (React)

import { TonConnectUIProvider, TonConnectButton, useTonConnectUI } from '@tonconnect/ui-react';

export default function App() {
  return (
    <TonConnectUIProvider manifestUrl="https://your.app/tonconnect-manifest.json">
      <TonConnectButton />
      <Checkout />
    </TonConnectUIProvider>
  );
}

function Checkout() {
  const [tonConnectUI] = useTonConnectUI();
  const pay = async () => {
    await tonConnectUI.sendTransaction({
      validUntil: Math.floor(Date.now()/1000) + 300,
      messages: [{ address: 'EQC...', amount: '50000000', text: 'Order #123' }]
    });
  };
  return <button onClick={pay}>Pay 0.05 TON</button>;
}
  • Make sure to host a compliant tonconnect-manifest.json. Steer clear of CORS/proxies and ensure you have direct GET access. You can find more info here.

If you don't require signature tracking, deep links are definitely the easiest option:

ton://transfer/<ADDRESS>?jetton=<USDT_MASTER>&amount=5000000&text=order-123
  • Just a heads up: the USDT amount you're seeing is in micro‑USDT (6 decimals) rather than nanoTON. (docs.ton.org)

When to use what

  • TonConnect: If you need features like “who paid,” tracking signatures, sending multiple messages, or setting up programmatic retries, this is the way to go.
  • ton:// deep links: These provide a quick and smooth user experience, are friendly for QR codes, and don’t require a wallet connection state.

Architecture blueprint (battle‑tested)

  • Frontend: Create a Telegram Mini App using either React or Vue. You’ll want to save SKU/cart info in DeviceStorage and keep your tokens safe in SecureStorage. Check out the details here.
  • Identity: Use Telegram’s initData along with your server session (after you’ve validated it).
  • Payments:

    • Digital goods: Use Stars (with the option to withdraw to TON via Fragment). More info can be found here.
    • Physical goods: Utilize the Bot Payments API along with Stripe or a PSP like Apple Pay/Google Pay. Check the specifics here.
    • Crypto options: Consider TonConnect and USDT/TON for transactions.
  • Smart contracts:

    • Implement Tolk/Tact modules for things like escrow, loyalty Jettons, or NFT 2.0 inventory.
    • Keep your message schemas strict with query_ids and handle any bounces properly.
  • Indexing & reads:

    • Use TonAPI (REST/webhooks) or Toncenter JSON-RPC; it’s smart to set up webhooks for confirmation and balance events. More details can be found here.
  • Observability:

    • Set up alerts for any non-zero exit codes, bounce spikes, or growth in storage_due.
  • Growth:

    • Utilize startapp deep links within channels; configure your Main Mini App through @BotFather. Plus, make sure your store metadata aligns for featuring in the Mini App Store. More info can be found here.

Security and compliance checklist

  • Smart contracts:

    • Run unit tests in Blueprint; mix up message orders a bit; keep an eye on worst-case storage; and steer clear of unbounded maps. (docs.ton.org)
    • Do some static and dynamic analysis; and don't forget to check out the new simulators for async races. (arxiv.org)
  • Mini App/Server:

    • Make sure to validate initData (HMAC), and when you're sharing it with partners, definitely require Ed25519 signature verification using Telegram’s published key. Also, enforce auth_date TTL. (core.telegram.org)
  • Payments policy:

    • For digital goods, you’ll want to stick to using Stars within Telegram. Plus, implement /paysupport and set up refund flows. (core.telegram.org)
    • As for physical goods via PSP, make sure to follow the provider’s risk restrictions (like Stripe’s RB/Prohibited list). (stripe.com)

Running your own infra (when you need it)

  • Indexer/API: You’ve got a couple of options here! You can go with TonAPI (SaaS), which offers REST, webhooks, and SDKs. If you’re feeling adventurous, you can also set up your own open TON HTTP API (toncenter) with some basic hardware. Check out the details here.
  • Liteservers/Nodes: If you're looking to set up archival nodes, be ready to invest in some serious gear. The latest recommendations suggest you’ll need around 16 CPU cores, 128 GB of RAM, and anywhere from 16 to 20 TB of SSD storage. For more info, visit this page.

1) Channel-commerce with Stars + USDT

  • You can discover new stuff through channel posts, then just hit the startapp deep link to dive into the Telegram Mini App product interface.
  • Digital goodies are available through Stars subscriptions, and you can grab premium add-ons using one-time Stars invoices when you're feeling fancy.
  • The settlement treasury will swap Stars for Toncoin, making sure partners get their on-chain payouts smoothly. (theblock.co)

2) Loyalty Jetton with off‑chain state

  • You can mint or burn Jettons on Tolk, and check balances using TonAPI; plus, you can earn some rewards through bot quests.
  • We’re introducing NFT 2.0 for different tiers, complete with automatic royalty rules for secondary sales. Check out more details here.

3) USDT Checkout for Physical Goods

  • Bots take care of sending invoices via the Payment Service Provider (PSP) like Stripe, collecting shipping details and taxes. After your purchase, there's a handy Mini App that lets you tip using Stars or TON. Check out the details here!

Performance and scale notes for leadership

  • TON’s architecture: It features dynamic sharding across workchains and shardchains, plus this cool "accountchain" idea that fits nicely into shard blocks. This is what helps it ramp up throughput as demand increases. (docs.ton.org)
  • Verified speed: It hit an incredible 104,715 TPS using 256 validators, and yes, that’s been audited by CertiK. During testing, it even flexed its muscles with elastic sharding, splitting into 512 shards! (blog.ton.org)
  • Payment UX: With USDT now live on TON, the pricing volatility and accounting hassle have been cut down. Plus, it's backed by big exchanges and, of course, integrated into the Telegram Wallet. (cointelegraph.com)

Emerging best practices (2025)

  • For new builds, definitely go with Tolk. You can expect to save about 30-50% on gas compared to legacy code, plus the tooling and IDE LSP are much more user-friendly. Check it out here: (docs.ton.org).
  • When you're working with Mini Apps, make sure to use TonConnect for identifiable payers. Save ton:// links for quick “guest checkout” or for those QR code flows. More info here: (ton-connect.github.io).
  • For flows with high volume, it’s a good idea to offload reads to TonAPI webhooks. Treat the blockchain like your write-ahead log and avoid blocking the user experience on cross-contract reads. You can read up on it here: (docs.tonapi.io).
  • When it comes to address user experience, you should default to bounceable for contracts but go with non-bounceable when funding new (uninitialized) accounts. Wallets already switch bounce based on initialization, so it should be seamless. More details can be found here: (docs.ton.org).
  • Don't forget to add exp (expiry) to your deep links to help prevent any late replays of signed payloads. You can learn more about this here: (beta-docs.ton.org).

How we engage (7Block Labs)

  • 2-3 week Discovery: We’ll focus on figuring out the monetization model (Stars vs TON/USDT), map out user flows, and create a contract map.
  • 6-10 week MVP: This phase covers the Mini App, Bot, and on-chain module; we’ll roll these out in stages for channel pilots.
  • Scale: Here, we’ll tackle payments, conduct risk reviews, set up incident-ready telemetry, and implement A/B growth loops using deep links alongside the Main Mini App setup.

If you're looking to run a Toncoin-based business right inside Telegram--think ads, Stars, and stablecoin options all in one place--TON is finally ready for action. Let’s dive into your pilot project!

Sources: TON Docs/Blog, Telegram Bot API, and some trusted industry coverage linked right here. (docs.ton.org)

Like what you're reading? Let's build together.

Get a free 30-minute consultation with our engineering team.

7BlockLabs

Full-stack blockchain product studio: DeFi, dApps, audits, integrations.

7Block Labs is a trading name of JAYANTH TECHNOLOGIES LIMITED.

Registered in England and Wales (Company No. 16589283).

Registered Office address: Office 13536, 182-184 High Street North, East Ham, London, E6 2JA.

© 2026 7BlockLabs. All rights reserved.