project screenshot 1
project screenshot 2
project screenshot 3

Fusion Flow

dApp for trustless ETH-NEAR cross-chain swaps, leveraging 1inch Fusion+ protocol.

Fusion Flow

Created At

Unite Defi

Project Description

Our project is a cross-chain bridge solution that enables token transfers between Ethereum (EVM) and NEAR Protocol (non-EVM) blockchains. The system is built on three main pillars: Ethereum smart contracts (in Solidity), NEAR Protocol contracts (in Rust), and a Python-based relayer system.

The core functionality relies on Hashed Timelock Contracts (HTLC) and an escrow system for secure transactions. On Ethereum, the contracts handle partial fills using Merkle tree verification, allowing transactions to be split into equal parts. The NEAR side implements corresponding escrow and resolver contracts to manage token transfers on its blockchain.

The Python relayer service acts as the bridge between chains, featuring chain-specific listeners, a state manager, and an API server. This service monitors blockchain events, manages transaction states, and provides an interface for order management. Security is ensured through multiple mechanisms, including HTLCs, Merkle tree verification, and timelock systems.

The project's implementation includes detailed deployment procedures for both chains. On NEAR, this involves contract deployment via NEAR CLI, proper storage management for fungible tokens, and a system for contract updates using base64-encoded WASM files. The Ethereum side handles deployment through a factory pattern, with proper resolver registration and escrow contract creation mechanisms.

How it's Made

This project is built using a combination of modern web technologies and blockchain development tools, creating a bridge between Ethereum and NEAR Protocol. The frontend is developed using Next.js and React, incorporating specialized tools like NEAR Wallet Selector for NEAR blockchain integration and Ethers.js for Ethereum connectivity. This user interface layer is styled with Tailwind CSS and uses Zustand for efficient state management, providing users with a seamless experience for cross-chain operations. Behind the scenes, the project's backbone is a Python-based relayer system that acts as an intermediary between the two blockchains. This system uses FastAPI to provide high-performance API endpoints and implements two specialized listeners - one for Ethereum using Web3.py and another for NEAR. The relayer system is responsible for monitoring blockchain events, managing swap states, and coordinating the secure transmission of secrets necessary for atomic swaps. The smart contract layer is implemented differently on each blockchain to accommodate their unique architectures. On Ethereum, Solidity contracts handle escrow and factory functionality. The NEAR side features corresponding contracts written in Rust, implementing the necessary escrow operations for the cross-chain transfers. Both sets of contracts work together through a Hashed Timelock Contract (HTLC) mechanism, ensuring secure and atomic transfers. The system's architecture enables seamless token transfers between EVM and non-EVM blockchains through a series of coordinated operations. When a user initiates a transfer through the frontend, the system deploys escrow contracts on both chains, monitors their states through the relayer, and coordinates the token transfer using a secure secret-sharing mechanism.

background image mobile

Join the mailing list

Get the latest news and updates