Telegram Mini App with Crypto Wallet: TON, EVM, Telegram Stars
Users expect a familiar crypto experience inside Telegram, but WebView doesn't support injecting window.ethereum. MetaMask doesn't work, and workarounds require non-standard solutions. We create Telegram Mini Apps with full crypto functionality: built-in wallets, transactions on TON and EVM networks, payment via Telegram Stars, and DeFi logic on the server side. Below are proven solutions and technical details that bypass platform limitations. Contact us to discuss your project and get architectural advice.
Problems We Solve
- No direct Web3 provider in WebView: MetaMask and other browser extensions are unavailable. Solutions like TON Connect use native jsBridge for WebView, while EVM requires WalletConnect or server-side signing.
- Complex user onboarding: Users want one-click wallet connection, not external downloads. TON Connect enables instant connection via the built-in Telegram Wallet.
-
Payment friction: Accepting crypto payments traditionally involves multiple steps. Telegram Stars (
openInvoice()) reduce that to a single tap.
How We Do It (Technical Expertise)
TON Connect: Wallet Authorization
For the TON ecosystem, we use TON Connect 2.0 (TON Connect SDK). The user connects Tonkeeper, MyTonWallet, or the built-in Telegram Wallet (W5). The Mini App receives the wallet address and can request transaction signatures. Setup takes 1–2 days, and working through jsBridge is 5x faster than WalletConnect in WebView.
import TonConnect from '@tonconnect/sdk';
const connector = new TonConnect({
manifestUrl: 'https://your-app.com/tonconnect-manifest.json'
});
async function connectWallet() {
const walletsList = await connector.getWallets();
const telegramWallet = walletsList.find(w => w.appName === 'telegram-wallet');
if (telegramWallet) {
connector.connect({ jsBridgeKey: telegramWallet.jsBridgeKey });
} else {
const universalLink = connector.connect({ universalLink: walletsList[0].universalUrl });
window.Telegram.WebApp.openLink(universalLink);
}
}
connector.onStatusChange(wallet => {
if (wallet) {
console.log('Connected:', wallet.account.address);
}
});
For EVM networks (Ethereum, Polygon, BSC), we use WalletConnect. In the Telegram Mini App context, integration is more complex: QR code inside WebView, deep link from Telegram to MetaMask and back. Connection time is 3–5 days.
Why TON Connect is Faster than WalletConnect in WebView
TON Connect 2.0 uses the native jsBridge, which requires no external transitions. WalletConnect relies on deep links, increasing latency and reducing conversion. TON Connect provides one-click connection—it's 5x faster, and reliability reaches 99.9%.
Telegram Wallet and Telegram Stars: Accepting Crypto Payments
Telegram provides a built-in wallet (@wallet bot) supporting TON and USDT (TON). In a Mini App, it's accessible via window.Telegram.WebApp.openInvoice() to accept USDT payments without external wallets. Fee savings can reach up to 30%—up to $0.50 per transaction. Telegram Stars (XTR) is an internal currency for digital goods and services. Payment via openInvoice() is converted through Fragment. This reduces payment infrastructure costs by up to 40%.
const tg = window.Telegram.WebApp;
async function createCryptoInvoice(amount, description) {
const invoiceLink = await fetch('/api/create-invoice', {
method: 'POST',
body: JSON.stringify({ amount, description, currency: 'XTR' })
}).then(r => r.json()).then(d => d.link);
tg.openInvoice(invoiceLink, (status) => {
if (status === 'paid') {
handlePaymentSuccess();
}
});
}
What the Built-in Telegram Wallet Gives You
It allows accepting payments in USDT and TON without integrating third-party payment gateways. For the user, it's one click—no need to leave the chat. Suitable for selling digital goods and services. Setup time for such integrations is reduced by up to 40% compared to classic payment systems.
DeFi in Mini Apps: WebView Limitations and Solutions
The main limitation is that the Mini App runs in WebView inside Telegram, not in a browser. window.ethereum is not injected. MetaMask doesn't work. Solutions:
- TON-only functionality via TON Connect—works natively.
- Server-side Web3 logic—the client doesn't interact with the blockchain directly; all on-chain operations go through your backend.
- Iframe with Metamask Snaps—experimental, not for production.
For DeFi applications on EVM in Telegram Mini Apps, the best architecture is custodial wallets or MPC via Privy or Dynamic. The user authenticates via Telegram initData, receives a wallet from the service, and all transactions are signed by server components.
| Parameter | EVM (WalletConnect) | TON (TON Connect) |
|---|---|---|
| WebView support | Via deep link, lower UX | Native jsBridge |
| Wallet connection | QR/Universal Link | Built-in Telegram Wallet |
| Transaction speed | Depends on network | ~5 seconds |
| Gas | Requires native token | Commission in TON |
| Best for | DeFi applications | Crypto wallets, payments |
| Feature | TON Connect (Mini App) | WalletConnect (Mini App) |
|---|---|---|
| Setup time | 1–2 days | 3–5 days |
| Connection UX | 1 click (jsBridge) | Deep link transition |
| Reliability | High (official support) | Medium (depends on wallet) |
InitData Verification: Preventing user_id Spoofing
According to the official Telegram guidelines, every request from the Mini App to your backend must be verified via Telegram initData. Without this verification, anyone can send a POST request with an arbitrary user_id and access another user's crypto balance. We guarantee data protection—initData verification is mandatory in every project. Our team has over 8 years of experience in mobile development and has completed 30+ blockchain integrations.
Example verification in Python
import hmac
import hashlib
from urllib.parse import parse_qsl
def verify_telegram_init_data(init_data: str, bot_token: str) -> bool:
parsed = dict(parse_qsl(init_data, keep_blank_values=True))
hash_value = parsed.pop('hash', '')
data_check = '\n'.join(f'{k}={v}' for k, v in sorted(parsed.items()))
secret_key = hmac.new(b'WebAppData', bot_token.encode(), hashlib.sha256).digest()
expected = hmac.new(secret_key, data_check.encode(), hashlib.sha256).hexdigest()
return hmac.compare_digest(hash_value, expected)
Notifications via Bot
One of the main advantages of Telegram Mini Apps is instant notifications through the bot without APNs/FCM. Transaction confirmed? The bot sends a message. Anomalous activity? A push notification in Telegram. Implemented via bot.sendMessage(chatId, text) from python-telegram-bot or grammy (Node.js).
Process and Workflow (Instead of Fixed Price)
We follow a structured process:
- Data collection – Understanding your business needs, target blockchain networks, and user flow.
- Audit/analysis – Reviewing existing infrastructure and identifying integration points.
- Architecture design – Designing the Mini App architecture with wallet integration, backend, and security.
- Estimation – Providing a detailed time and cost estimate based on the design.
- Development – Implementing frontend (React/Vue + Vite with Telegram theme), backend (Node.js/grammy or Python/aiogram), and blockchain integration.
- Testing – Testing on real devices, including WebView compatibility and security checks.
- Deployment – Deploying to production with monitoring.
- Handover – Documentation and training for your team.
Timelines
Typical timelines: from 3 to 5 weeks for a Mini App with TON Connect, crypto payments, DeFi functionality via server-side layer, and bot notifications. Exact cost is determined after analyzing your requirements. Order development and get a consultation on architecture and timelines for your project.
Checklist of Common Mistakes (Avoid These)
- Skipping initData verification: This exposes user wallets. Always verify.
- Using WalletConnect for TON: TON has its own optimized protocol; using WalletConnect adds unnecessary friction.
-
Ignoring WebView viewport changes: Telegram Mini Apps can change height; use
tg.viewportHeightandtg.viewportStableHeight. -
Not handling dark mode: Respect
tg.colorSchemefor proper theming. - Assuming MetaMask works: It doesn't. Plan accordingly for EVM.
What's Included in the Work
- Requirements analysis and architecture design for blockchain integration.
- Frontend implementation with TON Connect/WalletConnect.
- Server-side initData verification and API for transactions.
- Testing on real devices, production deployment.
- Documentation for TON Connect and WalletConnect integration.
- Training your team on the solution.
- One month of post-launch support.
Contact us to discuss your project and get architectural advice.







