All Projects

๐Ÿ”— CCNext Cross-Chain Bridge Worker

๐ŸŒ‰ Production-grade cross-chain off-chain worker bridging Ethereum Sepolia โ†’ CCNext custom L2. Monitors EVM events, generates cryptographic proofs via Proof API with exponential backoff retry, and submits verified transactions with per-wallet nonce management.

Blockchain / Backend EngineerGluwa / 2022โ€“2024

Stack

NestJSTypeScriptethers.jsviemPostgreSQLTypeORMRedisDockerAzure App Configuration

CCNext Cross-Chain Bridge Worker

๐Ÿ”ญ Overview

A production-grade off-chain worker system that orchestrates cross-chain token transfers between Ethereum Sepolia and a custom Substrate-based L2 (CCNext). This is the infrastructure layer that makes the bridge actually work โ€” event monitoring, proof generation, confirmation handling, and cross-chain submission, all with proper resilience patterns.

โ“ The Problem

Cross-chain bridges require an off-chain coordinator: something that watches for events on the source chain, waits for sufficient confirmations, requests a cryptographic proof from an external prover service, then submits that proof to the destination chain. Every step can fail, and failures need to be handled gracefully without double-spending or losing transactions.

๐Ÿ› ๏ธ Architecture

Ethereum Sepolia (ERC-20 Transfer Event)
    โ†“ wait N confirmations
Off-Chain Worker (NestJS)
    โ†“ call Proof API (exponential backoff, 20 retries, 15-min timeout)
External Proof API (generates cryptographic inclusion proof)
    โ†“ submit proof transaction
CCNext L2 (USC Contract โ€” verify proof + mint)

๐Ÿ› ๏ธ What I Built

๐Ÿ“ก Event Monitoring Layer

  • ๐Ÿ“ก Subscribes to Ethereum Sepolia ERC-20 Transfer events via ethers.js
  • โณ Implements confirmation window logic: waits for N block confirmations before processing
  • ๐Ÿ’พ Persistent event state tracking in PostgreSQL via TypeORM (prevents reprocessing on restart)

๐Ÿ”„ Proof API Orchestration

  • ๐Ÿ” Calls external Proof API with exponential backoff retry (20 attempts, 15-minute total timeout)
  • ๐Ÿ›ก๏ธ Handles API timeouts, rate limits, and transient failures gracefully
  • ๐Ÿ“‹ Logs all retry attempts with structured metadata for observability

๐Ÿ“ค CCNext Transaction Submission (viem)

  • โ›“๏ธ Uses viem for CCNext L2 interactions (EIP-1559 transaction construction)
  • ๐Ÿ”ข Per-wallet nonce management: tracks nonce per wallet address to enable parallel transaction submission
  • ๐Ÿ‘› Supports 4 concurrent wallets with independent nonce tracking

๐Ÿงช Traffic Simulator

  • ๐Ÿ”ง Companion tool that generates parallel ERC-20 transfers across 4 wallets for load testing
  • ๐Ÿ”ข Per-wallet nonce management with EIP-1559 support
  • โœ… Used for end-to-end bridge flow validation and stress testing

โš™๏ธ Infrastructure

  • ๐Ÿณ Docker Compose with NestJS worker + PostgreSQL + Redis
  • โ˜๏ธ Azure App Configuration for dynamic config management across environments
  • ๐ŸŒ Environment-specific deployments: testnet, devnet, production

โญ Key Highlights

  • ๐Ÿ” Exponential backoff proof API retry: 20 attempts, 15-min total timeout โ€” handles real network conditions
  • ๐Ÿ”ข Per-wallet nonce management enabling parallel cross-chain submissions
  • ๐Ÿ’พ Persistent state prevents duplicate processing on worker restart
  • โ˜๏ธ Full multi-environment support via Azure App Configuration
  • ๐Ÿงช Companion traffic simulator for end-to-end load testing