Syntheos Atomic Swap

VaultOS with Atomic Swap with 1inch Fusion+. Breaking down the walls between EVM and Solana.

Syntheos Atomic Swap

Created At

ETHGlobal Prague

Project Description

This project implements a trustless, decentralized cross-chain atomic swap between EVM-compatible blockchains (like Ethereum or Polygon) and Solana. At its core, it leverages Hashed Timelock Contracts (HTLCs) on both chains to allow users to swap assets without relying on any centralized exchange or custodian.

Users start by locking their assets on one chain using an HTLC smart contract, providing a hashlock and a timelock. On the other chain, the counterparty also locks their assets in a parallel HTLC, using the same hashlock and similar timelock. The secret to unlock the assets is only known to one party initially. Once one party claims their asset by revealing the secret on-chain, the secret is then observed and relayed to the other chain, enabling the other party to unlock their asset as well. If the swap is not completed within the timelock period, users can safely reclaim their funds via the refund mechanism.

To coordinate the atomic swap, we built a relayer script (off-chain bot) that listens for secret revelations on both EVM and Solana. When the secret is revealed on either chain, the relayer captures it and submits it to the other chain, maintaining the atomicity of the swap. The whole flow is trustless: no funds are ever in custody, and neither user can lose their money unless they willingly release the secret.

This system demonstrates a fundamental building block for decentralized finance: permissionless, trustless interoperability between ecosystems. It provides the infrastructure needed for multi-chain swaps, cross-chain liquidity pools, and a foundation for more advanced cross-chain protocols.

How it's Made

This project is built using several interconnected technologies across two blockchains. On solana side, we wrote a Solana Anchor program that implements the HTLC logic: lock, claim, and refund. The account structure closely matches the EVM side, with fields for the sender, receiver, hashlock, timelock, and secret. The Anchor IDL provides the interface for TypeScript/Javascript clients to interact with the program.

On EVM side, we wrote a Solidity smart contract (compatible with Ethereum and other EVM chains) that mirrors the HTLC pattern: locking ERC20 tokens, validating hashlocks, handling claims and refunds based on timelocks, and emitting events when secrets are revealed.

For off-chain relayer, The critical “bridge” is an off-chain Node.js script (the relayer), which listens to on-chain events on both EVM (via ethers.js) and Solana (via @solana/web3.js). When a claim occurs and the secret is revealed on one chain, the relayer submits the same secret to the other chain’s HTLC contract/program, completing the swap flow. All actions are logged, and failures are safely handled.

The hardest part was integrating Solana’s account management with EVM’s contracts, especially with manual creation of accounts and working around Anchor’s strict account expectations. Our team spent significant effort debugging account creation, offset mismatches, and cross-chain relay logic. Ultimately, our architecture and contracts are solid and the off-chain relayer infrastructure is robust, though we encountered a low-level Solana bug at the final claim step. With a bit more time, this is easily fixable.

We leveraged Solana Devnet for fast iteration and Anchor for simplified Solana development. Ethers.js enabled efficient event listening on EVM, while Anchor’s IDL enabled safer cross-chain TypeScript integrations.

To work around Solana Anchor bugs and devnet quirks, we sometimes manually crafted instructions and constructed accounts using lower-level web3.js APIs. We also wrote scripts to verify and decode on-chain accounts for easy debugging. The relayer is fully modular: it can easily be extended to any other chain or asset, simply by pointing it at a new contract and program.

background image mobile

Join the mailing list

Get the latest news and updates