Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

PolyWhale - Polymarket On-Chain Whale Intelligence

Track whale trades on Polymarket, classify wallets (Smart Money / Degen / Insider), and get real-time alerts via Telegram and X/Twitter.

Architecture

  • Backend (/backend): Node.js + TypeScript. Polls Polygon OrderFilled events from Polymarket's CTF Exchange contracts via Alchemy RPC, processes trades, scores wallets, sends alerts.
  • Frontend (/frontend): React + TypeScript (Vite). Dashboard showing whale trades, wallet explorer with classification badges, trade feed with filters.
  • Database: Supabase (PostgreSQL) for trades, wallets, markets, scanner state.
  • Alerts: Telegram bot for all whale trades; X/Twitter for smart money and insider trades only.

Setup

1. Supabase

Create a Supabase project and run the SQL schema:

-- Copy contents of backend/src/db/schema.sql into the Supabase SQL editor

2. Backend

cd backend
cp .env.example .env
# Fill in your API keys in .env
npm install
npm run dev

Required environment variables:

  • ALCHEMY_RPC_URL — Alchemy Polygon mainnet RPC URL
  • SUPABASE_URL — Supabase project URL
  • SUPABASE_SERVICE_KEY — Supabase service role key
  • TELEGRAM_BOT_TOKEN / TELEGRAM_CHAT_ID — (optional) Telegram alerts
  • TWITTER_API_KEY / TWITTER_API_SECRET / TWITTER_ACCESS_TOKEN / TWITTER_ACCESS_SECRET — (optional) X/Twitter posting

3. Frontend

cd frontend
cp .env.example .env
# Fill in VITE_SUPABASE_URL and VITE_SUPABASE_ANON_KEY
npm install
npm run dev

How It Works

  1. Block Scanner polls eth_getLogs every 12s from both CTF Exchange (0x4bFb41...8982E) and Neg Risk CTF Exchange (0xC5d563...0f80a)
  2. Trade Processor decodes OrderFilled events, filters trades > $5,000 USD, resolves market metadata
  3. Wallet Tracker aggregates stats per wallet (volume, win rate, ROI) and classifies:
    • Smart Money (win rate >= 65%, positive ROI)
    • Degen (win rate < 40%)
    • Possible Insider (win rate >= 80%, large bets, bets before odds move)
  4. Insider Detection snapshots prices at trade time, checks 5min/30min price movements
  5. Market Resolution background job checks if markets resolved, updates trade outcomes, recalculates wallet scores
  6. Alerts go to Telegram (all whales) and X/Twitter (smart money + insiders)

Deployment

  • Backend: Railway (run npm start after npm run build)
  • Frontend: Vercel (auto-deploys from git, framework preset: Vite)

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages