Building Hybrid dApps: A Developer's Guide to EVM Logic with Native TON Experience

No items found.
September 17, 2025
September 19, 2025
 • 
Developers

The blockchain landscape has a fundamental problem: Telegram's 1 billion users are locked out of the richest application ecosystem in crypto. TON's massive user base can't easily access the DeFi protocols, games, and applications that make EVM chains compelling. Meanwhile, EVM developers can't tap into TON's unprecedented reach without completely rebuilding their applications in FunC.

Hybrid dApps solve this. They're applications that run EVM smart contract logic while providing a completely native TON user experience. Users interact through their TON wallets and Telegram interfaces, never knowing there's complex EVM machinery running behind the scenes. 

What Makes an App "Hybrid"

Traditional dApps exist entirely within one ecosystem. Hybrid dApps span two ecosystems:

  • Smart Contract (EVM Side): Solidity contracts running on TAC EVM with full access to battle-tested DeFi primitives, mature tooling, and rich ecosystem integrations
  • Frontend (TON Side): Native TON wallet integration, Telegram Mini Apps, familiar asset handling, and zero learning curve for users

The magic is that TON users never know they're interacting with EVM applications. They connect their Tonkeeper wallet, approve transactions in TON, and receive results back - all while Solidity contracts handle the heavy lifting.

Architecture Overview

TAC enables hybrid dApps through a three-layer architecture:

[TON User] → [Frontend/Telegram] → [TAC Infrastructure] → [EVM Contracts]

1. Frontend Layer: Standard TON/Telegram interfaces using TON Connect and familiar UX patterns

2. TON Infra: The critical part consisting of:

  • Sequencer Network: Distributed validators that securely route messages between chains
  • TON Adapter: Purpose-built messaging system 
  • Asset Management: Automatic token locking, minting, and bridging

3. EVM Component: Your existing Solidity contracts running on TAC EVM Layer

Basically, users interact with the frontend normally while the infrastructure invisibly handles cross-chain complexity.

Frontend Development

TON Wallet Integration

Start with standard TON Connect patterns that TON users already know:

// Standard TON Connect setup
import { TonConnectUI } from "@tonconnect/ui";

const tonConnect = new TonConnectUI({
  manifestUrl: "https://yourapp.com/tonconnect-manifest.json",
});

// Create TAC-compatible sender
const sender = await SenderFactory.getSender({
  tonConnect: tonConnect,
});

TAC SDK Integration

The TAC SDK handles all cross-chain complexity. Here's the core pattern:

// 1. Initialize SDK
const tacSdk = await TacSdk.create({ 
  network: Network.TESTNET 
});

// 2. Create cross-chain transaction
const evmProxyMsg = {
  evmTargetAddress: "0xYourDeFiContract",
  methodName: "swapTokens(bytes,bytes)",
  encodedParameters: encodedSwapParams,
};

const assets = [
  { amount: 10.5 }, // Native TON
  { address: "EQJettonAddress...", amount: 100.0 } // TON jetton
];

// 3. Send transaction (user approves in TON wallet)
const result = await tacSdk.sendCrossChainTransaction(
  evmProxyMsg,
  sender,
  assets
);

// 4. Track status in real-time
const tracker = new OperationTracker(Network.TESTNET);
const status = await tracker.getOperationStatus(result.operationId);

Asset Handling

TON assets work easily with EVM applications:

  • Native TON: Automatically bridges and works as a standard ERC-20 on the EVM side
  • Jettons: Bridge with preserved decimal precision (typically 9 decimals)
  • NFTs: Full cross-chain NFT support for gaming and collectible applications

The SDK handles all token mapping, decimal conversions, and address translation automatically.

Backend Development

Proxy Contract Patterns

EVM contracts receive cross-chain calls through proxy patterns. Here's the essential structure:

pragma solidity ^0.8.28;

import { TacProxyV1 } from "@tonappchain/evm-ccl/contracts/proxies/TacProxyV1.sol";

contract MyDeFiProxy is TacProxyV1 {
    constructor(address _crossChainLayer) 
        TacProxyV1(_crossChainLayer) {}

    // This function receives calls from TON users
    function executeSwap(bytes calldata tacHeader, bytes calldata args)
        external
        _onlyCrossChainLayer  // Critical security modifier
    {
        // 1. Decode user information
        TacHeaderV1 memory header = _decodeTacHeader(tacHeader);
        
        // 2. Decode application parameters
        SwapParams memory params = abi.decode(args, (SwapParams));
        
        // 3. Execute your business logic
        uint256 outputAmount = performSwapLogic(params);
        
        // 4. Send results back to TON user
        TokenAmount[] memory returnTokens = new TokenAmount[](1);
        returnTokens[0] = TokenAmount(params.outputToken, outputAmount);
        
        _sendMessageV1(OutMessageV1({
            shardsKey: header.shardsKey,
            tvmTarget: header.tvmCaller,  // Original TON user
            tvmPayload: "",
            toBridge: returnTokens
        }));
    }
}

Key Points:

  • Security: The _onlyCrossChainLayer modifier ensures only TAC infrastructure can call your functions
  • Asset Handling: Bridged assets are automatically transferred to your contract before function calls
  • Return Path: Use _sendMessageV1() to send results back to TON users in the same transaction

Deployment Patterns

Deploy on TAC EVM exactly like any other EVM chain:

# Using Hardhat

npx hardhat run scripts/deploy.js --network tacTestnet

# Using Foundry  

forge script script/Deploy.s.sol --rpc-url https://spb.rpc.tac.build --broadcast

TAC EVM supports all standard Ethereum tooling: Hardhat, Foundry, Remix, MetaMask, and existing Solidity contracts deploy without modification.

User Experience Flow

Let's trace a TON user swapping tokens through a hybrid DEX:

1. Discovery: User finds the DEX through a Telegram Mini App. The interface looks completely native to TON.

2. Connection: User connects Tonkeeper wallet using standard TON Connect. No new wallets or seed phrases required.

3. Asset Selection: User selects TON tokens to swap. Interface shows familiar token names and current wallet balances.

4. Transaction: User approves swap in TON wallet. Behind the scenes:

  • TAC locks user's tokens on TON
  • Sequencer network validates and reaches consensus
  • Assets are bridged to TAC EVM
  • rAMM logic executes the swap
  • Results are prepared for return to TON

5. Real-time Updates: User sees progress through familiar TON transaction patterns with real-time status updates.

6. Completion: New tokens appear directly in the user's TON wallet. The entire process felt like a native TON transaction.

The user never knew they interacted with an EVM application.

Transaction Lifecycle & Status Tracking

Cross-chain transactions go through several stages:

  • COLLECTED_IN_TON: TON transaction detected and validated
  • INCLUDED_IN_TAC_CONSENSUS: Sequencer network reaches consensus
  • EXECUTED_IN_TAC: EVM contract executes successfully
  • EXECUTED_IN_TON: Results delivered back to user (for round-trip operations)

Best Practices

User Experience

  • Make it feel native: Use TON-style UI patterns and terminology
  • Provide clear feedback: Show transaction progress with realistic time estimates
  • Handle failures gracefully: Failed transactions automatically rollback assets to users
  • Optimize for Telegram: Design for Mini App constraints and mobile interfaces


Development

  • Test thoroughly: Always test on Saint Petersburg testnet first
  • Validate inputs: Check parameters on both frontend and smart contract
  • Handle edge cases: Implement proper slippage protection and error handling
  • Monitor performance: Use built-in status tracking for debugging


Security

  • Use proxy patterns: Inherit from TacProxyV1 for proper cross-chain security
  • Validate messages: Always use _onlyCrossChainLayer modifier
  • Audit contracts: TAC provides audit resources and security best practices
  • Asset protection: System includes automatic rollback for failed transactions

Common Challenges

Cross-chain latency: Operations take minutes, make sure to use optimistic UI updates and clear progress indicators.

Testing complexity: Requires simulating both TON and EVM environments. TAC provides testing utilities.

Error handling: Failures can occur on either chain. TAC includes error recovery and automatic asset rollback.

Why Build Hybrid dApps?

Reach massive audience: Deploy once and serve both EVM and TON users - 1 billion+ potential users from day one.

Leverage existing code: Use proven Solidity contracts without rewrites. Import battle-tested DeFi primitives and maintain existing security audits.

Unified liquidity: Assets flow between ecosystems based on where they're needed most, creating network effects that benefit everyone.

Developer efficiency: Focus on application logic instead of cross-chain infrastructure. TAC handles the complex routing, validation, and asset management.

Future-proof: As both ecosystems grow, hybrid dApps benefit from expansion in either direction.

Getting Started

Ready to build your first hybrid dApp? Here's how to dive in:

1. Try the Quickstart

npx create-tac-app my-hybrid-dapp

This creates a complete project with smart contracts, frontend, and cross-chain functionality working out of the box.

2. Join the Developer Community

  • Documentation: docs.tac.build
  • Discord: Connect with other hybrid dApp builders [https://discord.gg/tacbuild]
  • GitHub: Contribute to TAC tooling and examples [https://github.com/tacbuild]

3. Explore Use Cases

  • DeFi: DEXes, lending protocols, yield farming with TON assets
  • Gaming: Cross-chain NFTs, in-game economies, tournament systems
  • Infrastructure: Cross-chain DAOs, governance systems, oracle networks
  • Consumer Apps: Telegram-native DeFi, social trading, creator economies

Hybrid dApps represent the next evolution: applications that serve users wherever they are while leveraging the best technology available.

Start building!