Fusion Plus Tron
Cross-chain atomic swaps between Tron and 9+ blockchains using HTLC smart contracts
Problem Statement
This project implements a production-ready cross-chain atomic swap system that connects Tron blockchain to the 1inch Fusion+ ecosystem. The integration enables secure, trustless token swaps between Tron and 9+ other blockchains including Ethereum, Bitcoin, Stellar, Aptos, Sui, Polygon, Arbitrum, Optimism, and BSC.Key Features:Atomic Security: Hash Time-Locked Contracts (HTLCs) ensure either both sides complete or both failDual-Chain Support: Native TRX and TRC20 token compatibility with cross-chain bridgingAutomated Relayers: TypeScript-based resolver service for seamless cross-chain coordinationProduction Ready: Deployed and tested on live testnets with real token transfersMulti-Hash System: SHA256 for Tron compatibility, KECCAK256 for Ethereum compatibilityEconomic Incentives: Safety deposits and protocol fees ensure reliable serviceThe system allows users to swap tokens across chains without centralized intermediaries. For example, a user can swap TRX for ETH by creating an order on Tron, having a relayer automatically create a matching order on Ethereum, and completing the atomic swap through cryptographic secret revelation.Live Deployments:Tron Shasta Testnet:TATH2MqmeKRDmDN4E5rjZkbnHLyc5LzWo7Resolver Contract:TT5tSZkG1526s7N6qgpCVkZZY1wGgRrMrnEthereum Sepolia:0x067423CA883d8D54995735aDc1FA23c17e5b62cc
Solution
Smart Contract Architecture: The core is built on two Solidity contracts deployed on Tron's TVM (Tron Virtual Machine):TronAtomicSwap.sol - The main HTLC contract featuring:SHA256 hashlock verification (compatible with Tron's crypto primitives)Unix timestamp-based timelocks (1-24 hour windows)Support for both native TRX and TRC20 tokensCross-chain bridge order management for 10 different blockchainsProtocol fee collection (0.5%) and comprehensive admin controlsTronResolver.sol - The relayer coordination contract providing:Source/destination escrow deployment functionsSafety deposit mechanisms to incentivize honest behaviorSecret revelation and fund withdrawal coordinationOrder lifecycle management with timeout handlingCross-Chain Coordination: The system uses a dual-hash approach to handle different blockchain hash functions:Tron side uses SHA256 for hashlock verificationEthereum side uses KECCAK256 for hashlock verificationSame 32-byte secret works on both chains, maintaining atomic guaranteesTypeScript Relayer Service: Built with TronWeb and Ethers.js, theTronResolverServiceprovides:Real-time event monitoring on both Tron and EthereumAutomatic order processing and escrow deploymentSecret revelation detection and claim executionError handling and timeout managementTechnologies Used:Solidity ^0.8.23: Smart contracts with latest security featuresTronWeb 5.3.2: Official Tron JavaScript SDK for blockchain interactionEthers.js 6.15.0: Ethereum interaction and wallet managementTronBox: Deployment and testing framework for TronNode.js/TypeScript: Backend relayer service developmentNotable Technical Innovations:Dual-Hash Compatibility: Solved the challenge of different hash functions across chains while maintaining atomicityEconomic Security Model: Safety deposits ensure relayers fulfill their obligationsGas Optimization: Struct packing and efficient storage patterns minimize TRX costsEvent-Driven Architecture: Real-time monitoring enables sub-minute cross-chain coordinationTesting & Production Readiness:Comprehensive test suite with unit and integration testsLive testnet deployments with verified transactionsReal cross-chain swaps demonstrated between Tron Shasta and Ethereum SepoliaProduction-grade error handling and security measuresThe integration successfully bridges Tron's unique TVM environment with the broader DeFi ecosystem, enabling seamless asset transfers while maintaining the security guarantees that make atomic swaps trustless.
Hackathon
ETHGlobal Unite
2025
Contributors
- passionate-dev7
1 contributions