Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

29 Commits

Repository files navigation

ENSRouter Banner

ENSRouter Logo ENSRouter

Your ENS, Your Rules

A cross-chain payment routing platform that leverages ENS text records to store user payment preferences. Configure once, receive payments anywhere — automatically routed to your preferred chain and token allocation.

What is itHow It WorksArchitectureChainsStackQuick StartAPI


🔮 What is ENSRouter?

ENSRouter solves the fragmented wallet problem in crypto. Instead of managing multiple addresses across different chains and asking senders to bridge manually, you configure your preferences once via ENS text records — and every payment automatically routes to your desired chain and token allocation.

"One ENS. Any chain. Your tokens. Automatically."

View on ETHGlobal Showcase

The Problem

  • You have USDC scattered across 5 chains
  • Senders never know which address to use
  • Manual bridging is expensive and time-consuming
  • You want ETH on Base but receive USDC on Ethereum

The Solution

Set up your ENSRouter profile once:

  • Preferred chain: Base
  • Token allocation: 60% USDC, 30% ETH, 10% DAI
  • Slippage tolerance: 0.5%

Now anyone can send USDC to yourname.eth on any chain — ENSRouter reads your ENS preferences and automatically bridges + swaps via LI.FI to deliver exactly what you want, where you want it.


✨ Key Features

  • 📛 ENS-Native Preferences — Your payment routing rules live in ENS text records, portable across all dApps
  • ⛓️ Cross-Chain Routing — Send from any chain, receive on your preferred chain via LI.FI
  • 💱 Automatic Token Conversion — Set allocation percentages and receive a diversified portfolio
  • 📱 QR Code Sharing — Generate shareable payment links and QR codes for your profile
  • 🔔 Telegram Notifications — Get notified when payments arrive
  • ⚡ Real-Time Tracking — Watch your payment progress through each step

🔄 How It Works

ENSRouter follows a simple flow: Setup Profile → Share Link → Receive Payments.

┌─────────────────────────────────────────────────────────────────┐
│ ENSROUTER — PAYMENT FLOW │
├─────────────────────────────────────────────────────────────────┤
│ │
│ ① SET UP YOUR PROFILE │
│ Connect wallet, enter ENS name, configure preferences │
│ → Writes to ENS text records on Ethereum mainnet │
│ ↓ │
│ ② SHARE YOUR PAYMENT LINK │
│ Get a QR code or link: chainrouter.app/pay/yourname.eth │
│ Share it anywhere — Twitter, invoices, your website │
│ ↓ │
│ ③ SENDER INITIATES PAYMENT │
│ Sender enters your ENS + USDC amount │
│ ENSRouter resolves your profile from ENS text records │
│ ↓ │
│ ④ AUTOMATIC ROUTING │
│ For each token in your allocation: │
│ • Direct transfer if same chain + same token │
│ • LI.FI bridge + swap for cross-chain conversions │
│ ↓ │
│ ⑤ RECEIVE YOUR TOKENS │
│ Tokens arrive on your preferred chain │
│ Get notified via Telegram (optional) │
│ │
└─────────────────────────────────────────────────────────────────┘

ENS Text Record Schema

ENSRouter stores preferences in standard ENS text records:

KeyExample ValueDescription
ENSRouter.chainbaseDestination chain ID
ENSRouter.tokenAllocUSDC:60,ETH:30,DAI:10Token allocation percentages
ENSRouter.slippage0.5Maximum slippage tolerance (%)

These records are written via the ENS Public Resolver in a single multicall transaction.


🏗️ Architecture

High-Level System Design

┌──────────────────────────────────────────────────────────────────────┐
│ ENSROUTER SYSTEM │
│ │
│ ┌─────────────────────────────────────────────────────────────────┐ │
│ │ NEXT.JS 16 FRONTEND │ │
│ │ │ │
│ │ /profile /send Landing Page │ │
│ │ ┌──────────┐ ┌──────────┐ ┌──────────────┐ │ │
│ │ │ ENS Setup │ │ Payment │ │ 3D Dither │ │ │
│ │ │ Chain │ │ Preview │ │ Animation │ │ │
│ │ │ Tokens │ │ Tracker │ │ (Three.js) │ │ │
│ │ │ Slippage │ │ Status │ │ │ │ │
│ │ └────┬─────┘ └────┬─────┘ └──────────────┘ │ │
│ │ │ │ │ │
│ │ ▼ ▼ │ │
│ │ ┌─────────────────────────────────────────────────┐ │ │
│ │ │ WAGMI + VIEM │ │ │
│ │ │ useEnsText() · useWriteContract() · useBridge() │ │ │
│ │ └──────────────────────┬──────────────────────────┘ │ │
│ └──────────────────────────┼──────────────────────────────────────┘ │
│ │ │
│ ┌───────────────────┼───────────────────┐ │
│ │ │ │ │
│ ▼ ▼ ▼ │
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────────┐ │
│ │ ENS Public │ │ LI.FI │ │ Express.js │ │
│ │ Resolver │ │ Protocol │ │ Backend │ │
│ │ │ │ │ │ │ │
│ │ Read/Write │ │ Bridge │ │ /api/ens/* │ │
│ │ Text Records│ │ Swap │ │ /api/webhook/* │ │
│ │ on Ethereum │ │ Quote │ │ /api/telegram/*│ │
│ └─────────────┘ └─────────────┘ └────────┬────────┘ │
│ │ │
│ ┌───────────────────┼───────────────┐ │
│ │ │ │ │
│ ▼ ▼ │ │
│ ┌─────────────┐ ┌─────────────┐ │ │
│ │ MongoDB │ │ Telegram │ │ │
│ │ │ │ Bot API │ │ │
│ │ users │ │ │ │ │
│ │ txns │ │ Notify on │ │ │
│ │ queue │ │ payment │ │ │
│ └─────────────┘ └─────────────┘ │ │
│ │ │
└──────────────────────────────────────────────────────────────────────┘

Payment Execution Flow

Sender Frontend LI.FI Recipient
│ │ │ │
│ Enter ENS + amount │ │ │
│─────────────────────────►│ │ │
│ │ │ │
│ │ Read ENS text records │ │
│ │◄───────────────────────│ │
│ │ │ │
│ Preview: 60% USDC, │ │ │
│ 30% ETH, 10% DAI on Base│ │ │
│◄─────────────────────────│ │ │
│ │ │ │
│ Confirm payment │ │ │
│─────────────────────────►│ │ │
│ │ │ │
│ │ For each allocation: │ │
│ │ ────────────────────► │ │
│ │ │ │
│ │ Bridge + Swap │ │
│ │ ◄──────────────────── │ │
│ │ │ │
│ │ │ Tokens arrive │
│ │ │ ───────────────────►│
│ │ │ │
│ Payment complete! │ Webhook notification │ │
│◄─────────────────────────│─────────────────────► │ Telegram alert │
│ │ │ ───────────────────►│

⛓️ Supported Chains

ChainChain IDStatus
Ethereum1✅ Source + Destination
Base8453✅ Source + Destination
Arbitrum42161✅ Source + Destination
Polygon137✅ Source + Destination
Optimism10✅ Source + Destination

Supported Tokens

TokenEthereumBaseArbitrumPolygonOptimism
USDC
ETH
DAI
USDT

🛠️ Tech Stack

LayerTechnologyPurpose
FrontendNext.js 16 + React 19App router, SSR, API routes
StylingTailwind CSS 4 + shadcn/uiComponent library + custom design
Web3wagmi v3 + viem v2Wallet connection, contract calls
Wallet UIRainbowKit v2Multi-wallet connection modal
BridgingLI.FI SDKCross-chain swaps and bridges
3D GraphicsThree.js + React Three FiberLanding page animations
StateZustand v5Client-side state management
FormsReact Hook Form + ZodForm handling + validation
BackendExpress.js + TypeScriptREST API server
DatabaseMongoDB + MongooseUser registry, transaction history
NotificationsTelegraf (Telegram Bot)Payment alerts
ENSviem ENS utilitiesRead/write text records

📁 Project Structure

ensrouter/
├── frontend/ # Next.js 16 application
│ ├── app/ # App router pages
│ │ ├── page.tsx # Landing page with 3D animation
│ │ ├── profile/page.tsx # ENS profile setup
│ │ └── send/page.tsx # Send payment interface
│ ├── components/ # React components
│ │ ├── ENSProfileCard.tsx # Display recipient profile
│ │ ├── PaymentStatusTracker.tsx # Real-time payment progress
│ │ ├── PaymentPreview.tsx # Payment breakdown preview
│ │ ├── AllocationSliders.tsx # Token allocation UI
│ │ ├── ChainSelector.tsx # Chain dropdown
│ │ ├── Dither.tsx # Three.js dither effect
│ │ └── ui/ # shadcn/ui components
│ ├── hooks/ # Custom React hooks
│ │ ├── useChainRouterProfile.ts # Read ENS preferences
│ │ ├── useSetProfile.ts # Write profile to ENS
│ │ ├── usePayment.ts # Execute payment flow
│ │ ├── useBridgeUSDC.ts # LI.FI bridge integration
│ │ └── useBridgeEstimate.ts # Get bridge quotes
│ ├── lib/ # Utilities & config
│ │ ├── chains.ts # Supported chains config
│ │ ├── tokenList.ts # Token addresses per chain
│ │ ├── validations.ts # Zod schemas
│ │ └── wagmi.ts # Wagmi configuration
│ └── types/ # TypeScript interfaces
│
├── backend/ # Express.js API
│ ├── src/
│ │ ├── index.ts # Express app + routes
│ │ ├── config/ # Database connection
│ │ ├── routes/
│ │ │ ├── ens.ts # ENS resolution endpoints
│ │ │ ├── webhook.ts # Bridge event webhooks
│ │ │ └── telegram.ts # Telegram bot webhook
│ │ ├── services/
│ │ │ ├── ENSService.ts # ENS resolution logic
│ │ │ ├── TelegramService.ts # Telegram notifications
│ │ │ └── WebhookService.ts # Webhook processing
│ │ └── models/
│ │ ├── User.ts # ENS → address mapping
│ │ └── NotificationQueue.ts # Retry queue
│ ├── docker-compose.yml # MongoDB + mongo-express
│ └── render.yaml # Render.com deployment
│
└── assets/ # Images, logos

🚀 Quick Start

Prerequisites

  • Node.js 20+
  • MongoDB (local via Docker or Atlas)
  • Ethereum RPC URL (for ENS resolution)

Installation

# Clone the repository
git clone https://github.com/SakshiShah29/ENSRouter.git
cd ENSRouter
# ─── Frontend ──────────────────────────────────────────────────cd frontend
npm install
cp .env.example .env.local
# Add your environment variables
npm run dev # Starts on http://localhost:3000# ─── Backend ───────────────────────────────────────────────────cd ../backend
npm install
cp .env.example .env
# Add your environment variables# Start MongoDB with Docker
npm run db:up
# Start the server
npm run dev # Starts on http://localhost:3001

Environment Variables

Frontend (.env.local)

NEXT_PUBLIC_API_URL=http://localhost:3001NEXT_PUBLIC_WEBHOOK_SECRET=your-webhook-secret

Backend (.env)

# DatabaseMONGODB_URI=mongodb://localhost:27017/ensrouter# Ethereum RPC (for ENS resolution)ETHEREUM_RPC_URL=https://eth-mainnet.g.alchemy.com/v2/YOUR_KEY# Telegram Bot (optional)TELEGRAM_BOT_TOKEN=your-bot-tokenBACKEND_URL=https://your-backend-url.com# SecurityWEBHOOK_SECRET=your-webhook-secretPORT=3001

📡 API Reference

ENS Routes

MethodEndpointDescription
GET/api/ens/resolve/:ensNameResolve ENS name to address + text records
GET/api/ens/user/:ensNameGet stored user mapping
POST/api/ens/registerRegister/update user (ENS + ETH address)

Webhook Routes

MethodEndpointDescription
POST/api/webhook/bridge-eventsReceive bridge completion events

Telegram Routes

MethodEndpointDescription
POST/api/telegram/webhookTelegram bot webhook endpoint

Health Check

MethodEndpointDescription
GET/healthServer status

🔐 Key Addresses

ENS Public Resolver (Ethereum Mainnet)

0xF29100983E058B709F3D539b0c765937B804AC15

USDC Addresses

ChainAddress
Ethereum0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48
Base0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913
Arbitrum0xaf88d065e77c8cC2239327C5EDb3A432268e5831
Polygon0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359
Optimism0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85

🤝 Contributing

Contributions are welcome! Whether you want to add new chains, improve the UI, or enhance the bridging logic:

  1. Fork the repository
  2. Create your feature branch (git checkout -b feat/new-chain)
  3. Commit your changes (git commit -m 'Add Avalanche support')
  4. Push to the branch (git push origin feat/new-chain)
  5. Open a Pull Request

📄 License

MIT License — see LICENSE for details.


Built with ENS + LI.FI
Cross-chain payments, simplified.

About

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages