← Back to home

Polaris

Trustless cross-chain swaps between Bitcoin, Lightning Network & EVM chains using HTLCs

Problem Statement

DescriptionPolarisis a cross-chain swap protocol that extends the 1inch Fusion+ architecture to connect the Native Bitcoin and Lightning Network ecosystem with EVM-compatible blockchains. Built for ETHGlobal Unite 2025, it solves the critical problem of Bitcoin's isolation from DeFi liquidity networks.The Problem We SolveWhile 1inch Fusion+ enables trustless swaps between EVM chains and Solana, Bitcoin—holding over $1.9 trillion in value—remains mostly isolated. Users have to rely on centralized bridges with custody risks, high fees, and slow settlement times, or simply can't access cross-chain opportunities at all.Our SolutionPolaris implements a trustless, intent-based swap protocol that treats Bitcoin's Lightning Network as a native HTLC (Hash Time-Locked Contract) system. By leveraging Lightning's HODL invoices and native Bitcoin scripting, we enable:Instant Bitcoin Swaps: Sub-second settlements via Lightning Network instead of 60-minute Bitcoin confirmationsTrue Atomic Swaps: No bridges, no wrapped tokens—pure cryptographic guarantees ensure trustless executionGasless UX: Users only sign intents; professional resolvers handle all gas costs and executionUnified Liquidity: Connects Bitcoin's massive liquidity to EVM ecosystems, improving rates and reducing slippageHow It WorksUsers create swap intentsspecifying source/destination assets and amountsAutomated resolversmonitor these intents and compete to fulfill themSmart contracts on EVM chainslock funds using HTLCs with SHA256 hash locksLightning invoices or Bitcoin scriptscreate matching HTLCs on the Bitcoin sideAtomic executionensures either both sides complete or neither does—no trust requiredTechnical InnovationLightning-as-HTLC: First protocol to use Lightning HODL invoices as native HTLCs for cross-chain swapsDual Bitcoin Support: Handles both Lightning (instant) and on-chain Bitcoin (secure but slower)Intent-Based Architecture: Users express desired outcomes; resolvers handle complex executionOpinionated UX/UI: ¯_(ツ)_/¯Polaris demonstrates that Bitcoin doesn't need to remain isolated—with the right cryptographic primitives and architecture, it can participate fully in the cross-chain future of finance.

Solution

How it's madeCore Technology StackFrontendNext.js 15with App Router for server-side rendering and optimal performanceTypeScriptfor type-safe development across the entire codebaseEthers.js v6for Web3 interactions and wallet connectionsBackend & InfrastructureNext.js API Routesfor serverless backend endpointsSupabase(PostgreSQL) for real-time order tracking and swap state managementWebSocket connectionsfor live status updatesBlockchain IntegrationSolidity 0.8.20with Foundry framework for smart contract developmentOpenZeppelincontracts for security primitivesbitcoinjs-libfor native Bitcoin transaction constructionln-servicefor Lightning Network integration via LNDArchitectural Innovations1. Dual Bitcoin IntegrationWe implemented two parallel approaches for Bitcoin integration:Lightning Network Path:Uses HODL invoices as native HTLCsLeveragesln-serviceto communicate with LND nodesEnables sub-second settlementsPerfect for smaller, time-sensitive swapsNative Bitcoin Path:Custom P2SH HTLC scripts usingbitcoinjs-libDirect on-chain settlements for larger amountsFallback option when Lightning liquidity is insufficient2. Intent-Based ArchitectureTo extend 1inch Fusion+, we built an intent system where:Users express desired outcomes, not execution stepsProfessional resolvers (will) compete to fulfill swapsSmart contracts enforce atomic executionState machine tracks 12 distinct swap states for reliability3. Smart Contract Designcontract EVMHtlcEscrow { // Core HTLC functionality with SHA256 hash locks // 0.3% protocol fee for sustainability // Emergency withdrawal mechanisms // Multi-asset support (ETH, ERC20) }4. Unified Cross-Chain Abstractionexport enum ChainType { EVM = "evm", BITCOIN = "bitcoin", LIGHTNING = "lightning" }This abstraction allows seamless addition of new chains while maintaining consistent swap logic.Partner Technology Integration1inch IntegrationFusion+ Architecture: We studied and adapted their intent-based designSpot Price API: Real-time pricing for accurate quotesResolver Pattern: Professional market makers can plug into our systemLightning NetworkLND Integration: Direct node communication for invoice managementHODL Invoices: Revolutionary use as cross-chain HTLCsPayment Hash Coordination: SHA256 hashes link Lightning to EVMBitcoin InfrastructureBlockstream API: UTXO management and transaction broadcastingCustom HTLC Scripts: Native Bitcoin script engineeringFee Estimation: Dynamic fee calculation for timely confirmationsNotable Hacks & Innovations1. Lightning-as-HTLCThe biggest hack: treating Lightning HODL invoices as first-class HTLCs. By using the payment hash as the cross-chain secret, we achieve instant Bitcoin settlements without any protocol modifications.2. Unified State MachineWe built a comprehensive state machine that tracks swaps across blockchains:CREATED → WAITING_FOR_DEPOSIT → DEPOSIT_DETECTED → HTLC_CREATED → HTLC_CLAIMED → COMPLETED3. Core Infrastructure for DevelopmentCreated services for Lightning nodes and Bitcoin operations, allowing rapid development without real infrastructure.4. Opinionated UI/UXExtensive Tailwind customization with:Matrix rain animationsHolographic effectsTerminal-style componentsASCII art integrationAll contributing to an immersive cross-chain experienceSecurity ConsiderationsCryptographic Security: SHA256 hash locks ensure atomic executionTimeout Protection: Both sides have timeout mechanisms to reclaim fundsNo Custody Risk: Users maintain control until atomic swap completesAuditable Events: Comprehensive event logging for transparencyScalability FeaturesModular Architecture: Easy to add new chains or assetsResolver Competition: Market-driven efficiencyReal-time Updates: WebSocket connections for responsive UXGas Optimization: Batched operations where possibleThis project represents a fusion of Bitcoin's security, Lightning's speed, and Ethereum's programmability—demonstrating that trustless cross-chain swaps are not just possible, but can be elegant and user-friendly.

Hackathon

ETHGlobal Unite

2025

Contributors