project screenshot 1
project screenshot 2
project screenshot 3
project screenshot 4
project screenshot 5
project screenshot 6

JustinTime

Trustless atomic swaps between TRON & EVM chains using HTLCs + 1inch Fusion+ for price discovery

JustinTime

Created At

Unite Defi

Project Description

Key innovations include solving TRON's unique keccak256 implementation differences through string-based preimage handling, ensuring 100% hash compatibility across chains. The architecture features identical Solidity contracts deployed on both ecosystems, a TypeScript resolver service for event monitoring and preimage management, and a React frontend with dual wallet support (MetaMask + TronLink). The bridge implements staggered timelocks (t_dst < t_src) for security, comprehensive error handling, and automatic refund mechanisms. All operations are non-custodial users retain control of their assets throughout the swap process. The system achieved extensive test coverage using Foundry for smart contracts and Cypress for endtoend user flows. Production features include gas/energy optimization, robust monitoring, and failsafe mechanisms. The project demonstrates true cross-chain interoperability while maintaining the security guarantees of atomic swaps.

How it's Made

Tech Used:

  • Smart Contracts: Solidity for both chains (TRON supports Solidity via TVM)
  • Testing: Foundry was used for comprehensive unit/integration tests, achieving high coverage
  • Using mock Tron contracts for the swap tests.
  • Frontend: React with TypeScript for type safety
  • Web3 Integration: TronWeb for TRON, wagmi/viem for EVM chains
  • E2E Testing: Cypress for full user flow validation
  • Wallet Support: TronLink and MetaMask integration

TRON's keccak256 implementation differs subtly from EVMs, I saw that using string preimages instead of bytes ensures consistent hashing across both chains but this did lead to numerous complications as a result.

Development Process: Started with the smart contract architecture, ensuring the atomic swap logic was bulletproof but ran into issues with the frontend preImage issues due to Trons keccak256 implementation differences. But then built extensive test suites to verify cross chain compatibility. The UI came last, focusing on making complex cross chain operations feel simple for users!

background image mobile

Join the mailing list

Get the latest news and updates