Atomic Swap

Atomic Swap: Trustless P2P cross-chain bridge for Sepolia Sui Testnet using HTLCs.

Visit Repo
Atomic Swap banner

About

GIST

Atomic Swap is a decentralized, peer-to-peer (P2P) cross-chain bridge protocol that extends the 1inch Network’s Fusion+ system to enable secure, trustless token exchanges between Ethereum Sepolia and Sui Testnet. Built on Hashed Time-Locked Contracts (HTLCs) and integrated with 1inch resolvers, the protocol ensures atomic execution—swaps either complete fully for both parties or revert entirely, eliminating partial or failed transactions. As a major track sponsor, 1inch provides critical infrastructure, including its Fusion+ intent-based swap technology and resolver network, which Atomic Swap leverages to optimize cross-chain swap execution. Deployed on testnets, Atomic Swap serves as a developer-friendly proof-of-concept, with a modular architecture designed for scalability to mainnets and additional blockchains (e.g., Solana, Polygon, Aptos). By building on 1inch’s robust ecosystem, Atomic Swap enhances cross-chain interoperability while maintaining decentralization, security, and user sovereignty, addressing key challenges in Web3 asset transfers.

What Is Atomic Swap?

Atomic Swap is a protocol that enables trustless P2P token exchanges between Ethereum Sepolia (EVM-based) and Sui Testnet (Move-based), expanding the capabilities of 1inch’s Fusion+ system. It uses HTLCs to enforce atomicity, ensuring swaps are all-or-nothing, and integrates 1inch resolvers—professional market makers who compete to execute swaps efficiently under 1inch’s intent-based architecture. This eliminates reliance on centralized bridges, custodians, or wrapped tokens, aligning with Web3’s ethos of decentralization. Currently deployed on testnets, Atomic Swap provides a low-risk environment for developers to test cross-chain functionality, particularly bridging Ethereum’s EVM and Sui’s Move-based ecosystems. By leveraging 1inch’s Fusion+ technology, which supports gasless, intent-based swaps and MEV protection, Atomic Swap enhances swap efficiency and security. The protocol’s modular design supports future expansion to mainnets and other chains, making it a scalable foundation for Web3 infrastructure. As a hackathon submission under the 1inch major track, Atomic Swap builds on 1inch’s resolver network to deliver a cutting-edge solution for cross-chain interoperability.

Core Features

  • Trustless P2P Swaps: Direct token exchanges via HTLCs, eliminating intermediaries and custodial risks.
  • Hashed Time-Locked Contracts (HTLCs): Cryptographic hashlocks and timelocks ensure atomic execution and secure fund locking.
  • 1inch Resolver Integration: Leverages 1inch’s professional resolvers to execute swaps efficiently, benefiting from Fusion+’s intent-based mechanics and MEV protection.
  • Cross-Chain Interoperability: Enables swaps between Ethereum Sepolia and Sui Testnet, bridging EVM and Move ecosystems.
  • Atomic Execution: Guarantees all-or-nothing swaps, ensuring fairness and no fund loss.
  • Self-Custody: Users retain full control of private keys and assets throughout the process.
  • No Wrapped Tokens: Direct swaps eliminate intermediary assets, reducing complexity and vulnerabilities.
  • Modular Architecture: Designed for scalability to additional chains (e.g., Solana, Polygon, Aptos).
  • Developer-Friendly Testnet: Low-risk environment for testing cross-chain dApps.
  • Privacy-Focused: No KYC or third-party data sharing; all logic is on-chain.

Integration with 1inch

As a project under the 1inch major track, Atomic Swap builds on 1inch’s Fusion+ technology, which revolutionizes cross-chain swaps with intent-based, gasless, and MEV-resistant execution. Key integrations include:

  • 1inch Resolvers: Atomic Swap uses 1inch’s network of resolvers—professional market makers who compete to fill orders under a Dutch auction model. Resolvers execute swaps on behalf of users, optimizing rates and ensuring efficiency. By integrating with 1inch’s resolver system, Atomic Swap benefits from their expertise and infrastructure, enhancing swap execution across Sepolia and Sui Testnet.
  • Fusion+ Intent-Based Architecture: 1inch’s Fusion+ allows users to define swap parameters off-chain, which resolvers execute on-chain. Atomic Swap extends this by incorporating HTLCs for cross-chain atomicity, ensuring secure and efficient swaps without relying on traditional bridges.
  • MEV Protection: Inherited from Fusion+, Atomic Swap protects users from maximal extractable value (MEV) exploits, a critical feature for secure DeFi transactions.
  • Gasless Execution: Leveraging 1inch’s gasless swap capabilities, Atomic Swap minimizes costs for users on testnets, with resolvers covering gas fees.
  • Resolver Incentive Program: Atomic Swap aligns with 1inch’s incentive model, where resolvers are rewarded with 1INCH tokens for filling orders, encouraging participation and liquidity provision.

How It Works

Atomic Swap integrates 1inch resolvers with HTLCs to enable secure cross-chain swaps between Ethereum Sepolia and Sui Testnet. Below is the detailed process, using two users, Akshat (on Sepolia) and Kartik (on Sui Testnet), swapping testnet tokens (e.g., Sepolia ETH for Sui Testnet SUI):

  • Secret Generation & Hashlock Setup: Akshat generates a cryptographic secret (e.g., a random string) and creates its hash using SHA-256. Akshat shares the hash with Kartik off-chain via a secure channel or the Atomic Swap dApp, which integrates with 1inch’s off-chain intent construction.
  • Deploy HTLCs with 1inch Resolver Coordination: Akshat deploys an HTLC on Sepolia, locking his testnet ETH. The contract specifies: Hashlock (requires the secret matching the provided hash), Timelock (a deadline, e.g., 24 hours, for refunds if the swap fails), Recipient (Kartik’s Sepolia address). A 1inch resolver verifies Akshat’s HTLC deployment and coordinates the swap. Kartik deploys a corresponding HTLC on Sui Testnet, locking his testnet SUI with the same hashlock and a shorter timelock (e.g., 12 hours). The resolver ensures compatibility between the Sepolia and Sui HTLCs, leveraging 1inch’s Fusion+ intent-based framework.
  • Deposits and Verification: Akshat’s ETH is locked in the Sepolia HTLC, visible on-chain. Kartik confirms the deposit via the dApp or testnet explorer and locks his SUI in the Sui HTLC. The 1inch resolver monitors both contracts to ensure funds are correctly escrowed, using 1inch’s API for real-time data.
  • Reveal & Redeem with Resolver Execution: Akshat redeems Kartik’s SUI on Sui Testnet by submitting the secret to the Sui HTLC, unlocking the funds. The secret is revealed on-chain, and the 1inch resolver retrieves it (e.g., via Sui’s event logs or 1inch’s API). The resolver uses the secret to unlock Akshat’s ETH on Sepolia for Kartik, completing the swap. 1inch’s Dutch auction mechanics ensure the resolver executes the swap at the most favorable rate.
  • Guaranteed Atomicity: If Akshat fails to reveal the secret within the Sui timelock, Kartik’s SUI is refunded. If Kartik (or the resolver) fails to claim the ETH within the Sepolia timelock, Akshat’s ETH is refunded. The resolver’s role ensures timely execution, reducing the risk of timelock expirations.

Technical Architecture

  • Blockchains: Ethereum Sepolia (EVM-based testnet for Solidity HTLCs), Sui Testnet (Move-based testnet for Move HTLCs).
  • Smart Contracts: Sepolia HTLC (Solidity-based, handles escrow, hashlock, and timelock logic), Sui HTLC (Move-based, optimized for Sui’s object-oriented model), Integrated with 1inch’s Fusion+ contracts (e.g., Settlement and RouterV6) for resolver execution.
  • Frontend: React-based dApp with Web3.js (Ethereum) and Sui Wallet Kit (Sui) for wallet integration. Interfaces with 1inch’s API for resolver coordination and swap monitoring.
  • Backend: Node.js for off-chain tasks (e.g., secret sharing, resolver notifications). Relies on 1inch’s API for real-time swap data and resolver management.
  • 1inch Integration: Uses 1inch’s Fusion+ intent-based architecture for gasless swaps and MEV protection. Leverages 1inch’s resolver network for swap execution, with resolvers competing to fill orders. Incorporates 1inch’s Pathfinder algorithm to optimize swap routes, even across testnets.
  • Security: HTLCs use SHA-256 for hashlocks. Timelocks prevent indefinite fund locking. Inherits 1inch’s audited contract security and MEV protection. Post-hackathon audits planned for mainnet readiness.

Problem Statement

Cross-chain asset transfers face significant challenges: 1. Centralized Bridges: Most bridges (e.g., Wormhole) rely on custodians, introducing hack risks ($2B+ lost in 2022-2023). 2. Counterparty Risk: P2P swaps require trust, risking scams or non-delivery. 3. Wrapped Tokens: Bridges mint wrapped assets, adding complexity and vulnerabilities. 4. Testnet Gaps: Developers lack robust testnet environments for EVM-Move interoperability. 5. Costs and Complexity: High gas fees and complex UX deter users and developers. 6. Security Vulnerabilities: Outdated protocols (e.g., 1inch’s Fusion v1) have exposed resolvers to exploits.

Atomic Swap, built on 1inch’s Fusion+, addresses these by: - Using HTLCs for trustless, atomic swaps. - Leveraging 1inch resolvers for efficient, MEV-protected execution. - Eliminating wrapped tokens and intermediaries. - Providing a testnet playground for EVM-Move experimentation. - Inheriting 1inch’s gasless and secure swap infrastructure.

Solution & Benefits

Atomic Swap extends 1inch’s Fusion+ to deliver a decentralized, secure, and efficient cross-chain swap solution: - Decentralized Bridging: HTLCs and 1inch resolvers replace centralized bridges. - Trustless Execution: Atomicity ensures no counterparty risk. - 1inch Resolver Optimization: Resolvers compete to execute swaps at optimal rates, leveraging 1inch’s Dutch auction model. - Gasless Testnet Swaps: Resolvers cover gas fees, making testnet swaps cost-free. - EVM-Move Interoperability: Bridges two distinct ecosystems, fostering innovation. - Privacy: No KYC; all logic is on-chain. - Scalability: Modular design for multi-chain expansion.

Impact & Use Cases

  • Developers: Test EVM-Move dApps using 1inch’s resolver network.
  • Web3 Enthusiasts: Experiment with trustless swaps in a safe testnet environment.
  • Protocol Builders: Use Atomic Swap as a foundation for mainnet bridges or DeFi protocols.
  • 1inch Ecosystem: Enhances 1inch’s cross-chain capabilities, aligning with its vision to unite DeFi ecosystems.

Example: A developer can use Atomic Swap to test a cross-chain DEX, leveraging 1inch resolvers to optimize swap execution across Sepolia and Sui Testnet.

Why Atomic Swap Stands Out

  • 1inch Integration: Builds on 1inch’s Fusion+ and resolver network for secure, efficient swaps.
  • EVM-Move Bridge: Pioneers interoperability between Ethereum and Sui.
  • Atomicity: HTLCs ensure trustless, secure swaps.
  • Testnet Focus: Developer-friendly environment for innovation.
  • Scalability: Ready for multi-chain expansion.
  • Alignment with 1inch: Enhances 1inch’s mission as a major track sponsor to advance DeFi interoperability.

From the public ETHGlobal showcase page. Votes, swipes and the judge score are hackfeed's own.

AI judge

Not judged yet. A free model reads this page, compares it with similar projects and this event's winners, then scores it and says what would make it win.

Still being built?

Not checked yet.

Swipe stats

0upvotes
0skips
0saves

Discussion 0

No comments yet. Ask the team something, or say what you'd use it for.

Posting as a guest. Plain text, 1,000 characters max.

Already built nearby

Closest projects by meaning and shared words. Similar isn't the same as copied: read them.

Atomic-Inch

A cross-chain atomic swap protocol enabling secure, trustless swaps between Ethereum and Algorand.

ThunderPortal

Atomic swaps between ETH and BTC extending 1inch Fusion+ with custom Bitcoin HTLC service.

Opto

1inch Cross-chain Swap (Fusion+) with thorough UI to show ETH Sepolia ↔ Sui testnet swaps