Overview
ChainWise is an AI agent that solves real, everyday crypto-routing problems: finding the cheapest chain to withdraw from an exchange, bridging tokens cross-chain, recovering stuck assets with zero gas, checking P2P availability by country, and scanning exchanges for active giveaways — all through natural conversation.
The Problem It Solves
| Question | What ChainWise Does |
|---|---|
| "Which chain is cheapest to withdraw USDT from Binance?" | Queries the fee database and ranks every chain by cost |
| "I have $7 USDC on Ethereum but zero gas" | Builds a step-by-step recovery plan using P2P + LI.FI bridging |
| "What's the cheapest bridge from ETH to Base?" | Calls the LI.FI API for real-time bridge quotes |
| "Any active giveaways on Binance?" | Scans exchange X/Twitter accounts |
| "Which exchange has the lowest USDT fees?" | Compares fees across all supported exchanges |
Architecture
A Next.js 14 frontend talks to an Express backend, which routes requests to an AI agent (Groq / LLaMA 3.3 70B), a MongoDB-backed fee database, and a BullMQ + Redis sync system. The backend integrates six exchanges via CCXT (Binance, Bybit, KuCoin, Bitget, Gate.io, CoinEx), plus LI.FI for bridge routing, CoinGecko for market data, Twitter/X for giveaway scanning, and Supabase for auth.
AI Agent
The agent runs a tool-calling loop (up to 5 iterations) with 9 tools covering withdrawal fees, bridge routes, coin/chain lookups, P2P availability, stuck-asset recovery planning, exchange comparison, and giveaway scanning. Responses are tuned to be concise, bullet-pointed, and to prioritize P2P options for African users.
Fee Database
Fee data starts from a manual seed (real exchange screenshots), can be edited by an admin, and is kept fresh by an hourly auto-sync job that pulls live data via CCXT — while never overwriting manually-entered data, protected by a dataSource: "manual" flag.
Auto-Sync System
A node-cron job queues sync work every hour via BullMQ; a worker (concurrency 2) decrypts stored exchange API keys, fetches live fee data with CCXT, and merges it into MongoDB, busting the Redis cache as it goes. All background jobs are protected by a distributed Redis lock so nothing runs twice at once.
Tech Stack
Backend: Node.js, Express, MongoDB + Mongoose, Redis, BullMQ, Groq (LLaMA 3.3 70B), CCXT, Supabase (auth), Winston
Frontend: Next.js 14 (App Router), TypeScript, Tailwind CSS, Framer Motion, Supabase SSR
Author
Built by Brian Ouma (@rockstarbryant) in Nairobi, Kenya 🇰🇪
