project screenshot 1
project screenshot 2
project screenshot 3
project screenshot 4
project screenshot 5
project screenshot 6

hermes

Hermes is a Fusion+ implementation enabling swaps between Stellar and Ethereum.

hermes

Created At

Unite Defi

Project Description

Hermes is a Fusion+-style cross-chain bridge enabling atomic swaps between Ethereum-compatible chains and Stellar using HTLCs on Stellar, deterministic contract addresses, and a custom EVM deployment. It features bespoke relayer and resolver services that coordinate off-chain verification, guarantee atomicity, and optimize finality. By integrating Stellar’s native capabilities with EVM programmability, Hermes ensures secure, trust-minimized, and deterministic asset movement across both ecosystems without centralized custody.

How it's Made

Hermes - Cross-Chain Atomic Swap Protocol

Overview

Hermes implements a cross-chain atomic swap protocol using Hash Time Locked Contracts (HTLCs) with time-locked escrow contracts on both Ethereum and Stellar chains. The system ensures trustless, atomic exchanges without requiring centralized custody.

Core Technologies

Smart Contracts

Ethereum (EVM): Solidity contracts built with Foundry framework

  • EscrowFactory deploys source and destination escrow contracts
  • EscrowSrc and EscrowDst handle the actual token locking and unlocking
  • Uses OpenZeppelin's Create2 for deterministic contract addresses

Stellar: Rust-based Soroban smart contracts

  • Mirror functionality of EVM contracts but adapted for Stellar's account model
  • Built using the Stellar SDK and Soroban CLI

Frontend Stack

  • React with TypeScript for the user interface
  • RainbowKit/Wagmi for Ethereum wallet integration
  • Freighter for Stellar wallet connectivity
  • Vite for build tooling and development server

Cross-Chain Coordination

The resolver service (resolver/nevm.ts) orchestrates the four-step atomic swap process:

  1. Create Source Escrow: Deploys and funds escrow on the source chain
  2. Create Destination Escrow: Deploys corresponding escrow on destination chain
  3. Withdraw Destination: Recipient claims tokens using the secret
  4. Withdraw Source: Original sender completes the swap using the revealed secret

Key Technical Innovations

Deterministic Addresses

The system uses deterministic contract deployment to ensure both parties can independently verify escrow addresses before funding, eliminating trust requirements.

Time-Lock Mechanisms

Sophisticated timelock encoding ensures proper sequencing:

  • Withdrawal windows for legitimate swaps
  • Cancellation periods for failed swaps
  • Public withdrawal/cancellation for resolver intervention

Cross-Chain State Management

The resolver maintains state consistency across chains by:

  • Generating shared secrets for each swap
  • Coordinating timing to prevent race conditions
  • Handling edge cases like network delays or failed transactions

Development & Deployment

Monorepo Structure

  • Modular TypeScript packages for shared utilities
  • Separate build processes for contracts, frontend, and resolver
  • Docker containerization for easy deployment

Testing & Verification

  • Foundry for EVM contract testing
  • Rust toolchain for Stellar contract validation
  • Contract verification on Etherscan for transparency

Notable Implementation Details

Secret Management

const secret = random32Bytes();
const hashlock = keccak256(secret);

Each swap uses a unique 32-byte secret, with its keccak256 hash serving as the commitment.

Cross-Chain Token Bridging

The system doesn't actually "bridge" tokens but rather enables atomic exchanges of native tokens on each chain, avoiding the complexities and risks of wrapped token approaches.

Environment Configuration

Extensive environment variable configuration supports multiple networks and deployment scenarios, with separate variables for frontend and backend services.

Architecture Benefits

This architecture creates a trustless bridge that leverages the strengths of both Ethereum's programmability and Stellar's efficiency while maintaining security through cryptographic commitments and time-based constraints.

background image mobile

Join the mailing list

Get the latest news and updates