Trustless ETH-Scroll cross-chain swaps with HTLCs, resolvers, and real-time pricing.
Project Overview We built a trustless cross-chain swap protocol between Ethereum and Scroll, inspired by the 1inch Fusion architecture. Our system enables users to swap native assets across chains without needing to trust a third party, central bridge, or shared custodian. The design incorporates hashed time-locked contracts (HTLCs), resolvers, partial fills, and time-based refunds, along with real-time price quoting via 1inch and Chainlink.
This protocol serves as a foundation for gasless, atomic, cross-chain swaps with built-in protections for both sides of the trade.
Core Features (Completed) HTLC-Based Atomic Swaps Swaps are executed through hash time-locked contracts (HTLCs) on both chains. A swap only completes when both sides lock funds using the same hashlock, and the secret is revealed before the timelock expires. If not, users can claim a refund. This ensures that funds are either securely swapped or returned, without risk of loss. To maintain security and prevent premature secret exposure, the swap secrets are also stored on the frontend, allowing users to retain control while enabling resolvers to unlock their respective portions only when appropriate.
Relayers and Resolvers Orders are created and signed off-chain by users, then propagated by relayers to ensure broad visibility. Relayers play a critical role by monitoring the cross-chain escrow states—verifying that funds are securely locked on both Ethereum and Scroll before sharing the relevant secrets with resolvers. Resolvers then compete to fill the orders by submitting transactions to the on-chain swap contracts and paying the associated gas fees, enabling a gasless user experience. This coordination between relayers, resolvers, and users ensures swaps are executed atomically and trustlessly.
Partial Fills and Secret Management Orders can be partially filled by one or more resolvers, improving capital efficiency and liquidity by allowing flexible, incremental execution of swaps. To securely manage multiple partial fills without revealing secrets prematurely, we implemented a Merkle tree of secrets. Each partial fill corresponds to a leaf in the Merkle tree, allowing resolvers to reveal only the specific secret needed to unlock their portion of the swap. This structure maintains the security of the overall hashlock, preventing front-running or early secret exposure while enabling granular, trustless partial executions.
Refund Mechanism If an order is not filled within the specified deadline, users can reclaim their funds via the built-in refund mechanism, further enhancing trustlessness.
Pricing Integration Since direct ETH-to-Scroll token pricing is not available from a single source, we combine multiple oracles to ensure accurate and manipulability-resistant pricing. Chainlink provides reliable on-chain price feeds for ETH to USDC. 1inch API is then used to fetch a quote for USDC to the target token on Scroll. By composing these two sources, we generate end-to-end swap pricing across chains in a way that is both reactive to market conditions and resistant to manipulation.
Planned but Incomplete Features (At Time of Submission) Dual-Escrow Atomic Cross-Chain Locking: We designed a trustless mechanism where escrowing funds on one chain would automatically trigger escrow on the other chain. This system was intended to use cross-chain messaging (e.g., LayerZero) to ensure atomic dual-locking and dual-withdrawal. This would have removed the need to rely on off-chain behavior by resolvers and made cross-chain swaps even more secure. While the architecture was scoped and partially implemented, we did not complete it in time for submission.
Trust-Based Dutch Auction Mechanism: We also planned to implement a Dutch auction variation where resolvers would earn or lose reputation based on their reliability. Those who mishandled or failed to refund orders would accumulate "distrust points," resulting in a slower reward curve in future auctions. This would incentivize long-term honest behavior and create a dynamic, self-regulating ecosystem. The concept was designed, but not yet implemented in the final build.
Use Cases: Seamless, decentralized token swaps between Ethereum and Scroll Gasless UX where users sign orders and resolvers handle execution Programmable swap execution with native token support A foundation for future fully trustless cross-chain DEX infrastructure
Technical Stack: Solidity smart contracts (HTLC, partial fills, escrow) Foundry (Forge) for testing and deployment Node.js backend for order propagation and relayer logic 1inch Quote API and Chainlink Price Feeds for pricing Scroll and Ethereum as connected networks
This project is a minimal but powerful framework for secure and flexible cross-chain swaps. While our initial goal included advanced features like dual escrow and trust-scored auctions, our final submission focuses on delivering a functional, gasless swap system with strong guarantees of atomicity, refundability, and price reliability.
We believe this system lays the groundwork for the next generation of cross-chain trading protocols, combining composability, trust minimization, and efficient capital flow.
Technologies & Stack Solidity Smart Contracts We developed the core swap contracts in Solidity, implementing HTLC logic with hashlocks and timelocks, partial fill tracking, refund mechanisms, and escrow state management. Contracts were deployed on both Ethereum and Scroll testnets.
Foundry (Forge) Foundry was our primary tool for rapid development, testing, and deployment. Its fast compilation and powerful testing framework helped ensure contract robustness and security.
Node.js Backend The off-chain infrastructure, including order propagation, relayers, and resolver coordination, was built using Node.js. It manages the orderbook, monitors escrow states on both chains, and facilitates communication between relayers and resolvers.
1inch API & Chainlink Price Feeds Because there is no direct ETH-to-Scroll token price feed, we combined Chainlink’s on-chain ETH-to-USDC price oracles with 1inch’s off-chain USDC-to-Scroll token quotes. This hybrid approach ensured accurate, timely pricing data across chains.
Frontend (React + ethers.js) The user interface uses React and ethers.js to interact with both chains. Secrets required for unlocking swaps are securely stored client-side to maintain user control and prevent premature exposure.
Cross-Chain Messaging (LayerZero Planned) The architecture anticipates integration with LayerZero or similar cross-chain messaging protocols for atomic escrow synchronization, though this is not yet implemented.
Architecture & Workflow Order Creation Users create and sign swap orders off-chain in the frontend, generating secrets stored locally.
Order Propagation & Validation Relayers pick up signed orders, verify that escrows are locked on both chains, and propagate orders to resolvers.
Partial Fills Using Merkle Tree of Secrets To support secure partial fills, secrets are organized in a Merkle tree. This allows resolvers to reveal only the secrets for the portion they are filling, maintaining hashlock security without risking secret exposure.
Resolver Execution Resolvers submit on-chain transactions to fill parts of the swap and cover gas fees, enabling a gasless experience for users.
Refund Handling Unfilled orders can be safely refunded by users once the timelock expires.
Partner Technologies & Benefits 1inch API : Provided efficient off-chain price discovery without the need to build complex oracles. Inspiration from 1inch Fusion Before building the protocol, we studied the 1inch Fusion whitepaper and architecture to understand how gasless, off-chain order execution and Dutch auction pricing were implemented in a production-grade system. This served as a strong foundation for our own architecture. We borrowed core ideas such as:
Off-chain order signing Execution by external resolvers Gasless UX for users Dutch auction-based pricing logic From there, we extended the model to suit a cross-chain environment, adapting the design to include HTLC-based atomic swaps, partial fills, and eventually a trust reputation system and dual escrow coordination, both tailored for the challenges of cross-chain security and execution.
Notable Hacks & Workarounds Merkle Tree of Secrets A novel use of Merkle trees to securely handle multiple partial fills, ensuring secrets are only revealed as needed. Hybrid Pricing Composition Combining Chainlink and 1inch feeds creatively solved the absence of direct cross-chain price oracles. Frontend Secret Storage Storing secrets on the client side ensured user custody and minimized secret leakage risks.