Skip to content

dylanpersonguy/DCC-TG-Meme-Scanner-Bot

Repository files navigation

πŸ”Ž DCC Token Scanner Bot

Real-Time Token Intelligence for DecentralChain β€” Powered by Telegram

TypeScript Node.js Telegram Bot PostgreSQL Redis pnpm License: MIT

Scan any token. Detect risk. Track deployers. Monitor alpha.

A production-grade, Telegram-native token intelligence platform for the DecentralChain ecosystem. Instantly scan tokens, analyze risk scores, inspect deployer history, monitor whale movements, track trending assets, and surface alpha β€” all from inside Telegram.

Getting Started Β· Architecture Β· Features Β· Commands Β· Self-Hosting


✨ Features

Feature Description
πŸ”Ž Instant Token Scan Paste any asset ID or use /scan β€” get name, supply, price, risk score, deployer info in seconds
⚠️ Risk Scoring Engine Pluggable rule-based risk evaluation (0–100) with severity factors and confidence scores
πŸ—οΈ Deployer Profiling Track deployer wallets β€” token count, scam history, first-seen block, labels
πŸ“Š Market Data Real-time price, volume, liquidity, market cap, and 24h change metrics
πŸ“ˆ Trending Tokens Algorithmically ranked trending assets based on on-chain activity
πŸ‘₯ Holder Analysis Top holder distribution with balance rankings and concentration percentages
πŸ’§ Pool & Liquidity DEX pool discovery with reserve tracking and liquidity depth
πŸ•―οΈ OHLCV Charts Candle aggregation service (1m β†’ 1d) for charting via Mini App
πŸ”” Smart Alerts User-configurable alerts delivered directly via Telegram DM
πŸ† Alpha Leaderboard Track who calls winning tokens first in group chats
⭐ Watchlists Personal token watchlists with quick-access scanning
πŸ“± Telegram Mini App Rich UI with interactive charts, holder tables, and risk badges
πŸ›‘οΈ Admin Console Web dashboard for managing flags, scam entities, and system health

πŸ— Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Telegram    β”‚     β”‚  Telegram   β”‚     β”‚   Admin      β”‚
β”‚  Bot         β”‚     β”‚  Mini App   β”‚     β”‚   Console    β”‚
β”‚  (Telegraf)  β”‚     β”‚  (Next.js)  β”‚     β”‚   (Next.js)  β”‚
β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜
       β”‚                    β”‚                    β”‚
       β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                    β”‚
            β”Œβ”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”
            β”‚  Scanner API   β”‚  ← Fastify REST + WebSocket gateway
            β”‚  (Fastify)     β”‚
            β””β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                    β”‚
       β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
       β”‚            β”‚                    β”‚
β”Œβ”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”  β”Œβ”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”
β”‚ Market   β”‚  β”‚   Risk     β”‚  β”‚  Chart          β”‚
β”‚ Data Svc β”‚  β”‚   Engine   β”‚  β”‚  Service        β”‚
β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜
       β”‚            β”‚                    β”‚
       β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                    β”‚
            β”Œβ”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”
            β”‚  Chain Indexer  β”‚  ← Real-time block ingestion
            β””β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                    β”‚
            β”Œβ”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”
            β”‚  DecentralChainβ”‚  ← Mainnet node
            β”‚  Node          β”‚
            β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Cross-cutting: PostgreSQL Β· Redis Β· BullMQ

Monorepo Structure

dcc-tg-meme-scanner-bot/
β”œβ”€β”€ apps/
β”‚   β”œβ”€β”€ scanner-api/           # Fastify REST/WS API gateway
β”‚   β”œβ”€β”€ telegram-bot/          # Telegraf-based Telegram bot
β”‚   β”œβ”€β”€ telegram-miniapp/      # Next.js Telegram Mini App (TWA)
β”‚   β”œβ”€β”€ chain-indexer/         # Real-time block & transaction ingestion
β”‚   β”œβ”€β”€ market-data-service/   # Price, volume, trending computation
β”‚   β”œβ”€β”€ risk-engine/           # Token risk scoring pipeline
β”‚   β”œβ”€β”€ alerts-engine/         # Alert evaluation & Telegram delivery
β”‚   β”œβ”€β”€ chart-service/         # OHLCV candle aggregation
β”‚   └── admin-console/         # Next.js admin dashboard
β”‚
β”œβ”€β”€ packages/
β”‚   β”œβ”€β”€ blockchain-client/     # DecentralChain node adapter layer
β”‚   β”œβ”€β”€ shared-sdk/            # Types, DTOs, constants, event defs
β”‚   β”œβ”€β”€ db/                    # Prisma schema (25 tables), migrations
β”‚   β”œβ”€β”€ config/                # Zod-validated env loading
β”‚   β”œβ”€β”€ logger/                # Pino structured logging
β”‚   β”œβ”€β”€ telegram-ui/           # Message formatters & keyboard builders
β”‚   └── risk-rules/            # Pluggable risk rule modules
β”‚
β”œβ”€β”€ docker/                    # Per-service Dockerfiles
β”œβ”€β”€ docker-compose.yml         # Full-stack local dev environment
└── architecture.md            # Detailed architecture document

Data Flow

  1. Chain Indexer polls DecentralChain nodes for new blocks in real-time
  2. Transactions are parsed into normalized events (TOKEN_CREATED, SWAP_EXECUTED, TRANSFER, etc.)
  3. Events persist to PostgreSQL and publish to Redis/BullMQ job queues
  4. Market Data Service computes rolling metrics (price, volume, trending scores)
  5. Risk Engine evaluates tokens against pluggable rule modules, producing 0–100 risk scores
  6. Chart Service aggregates swap events into multi-timeframe OHLCV candles
  7. Alerts Engine evaluates user-defined rules and delivers notifications via Telegram
  8. Scanner API serves unified REST + WebSocket access to all data
  9. Telegram Bot handles commands, auto-detects pasted asset IDs, and renders rich scan cards
  10. Mini App provides interactive charts, holder tables, and detailed token views

πŸ€– Bot Commands

Command Description
/scan <assetId> Full token scan with risk analysis
/trending View top trending tokens by on-chain activity
/deployer <address> Inspect deployer wallet history
/wallet <address> View wallet profile and activity
/alpha Group alpha caller leaderboard
/watchlist Manage your personal token watchlist
/help Show all available commands

Tip: You can also paste any DCC asset ID directly β€” the bot auto-detects and scans it.

πŸš€ Getting Started

Prerequisites

Dependency Version Purpose
Node.js β‰₯ 20.0 Runtime
pnpm β‰₯ 9.0 Package manager
PostgreSQL β‰₯ 15 Primary database
Redis β‰₯ 7.0 Caching & job queues

Quick Start

# Clone the repository
git clone https://github.com/dylanpersonguy/DCC-TG-Meme-Scanner-Bot.git
cd DCC-TG-Meme-Scanner-Bot

# Install dependencies
pnpm install

# Set up environment variables
cp .env.example .env
# Edit .env with your configuration (see Environment Variables below)

# Set up database
pnpm db:generate
pnpm db:migrate
pnpm db:seed

# Build all packages
pnpm build

# Start all services in development mode
pnpm dev

Docker Quick Start

# Start full stack with Docker Compose
docker compose up -d

# View logs
docker compose logs -f

βš™οΈ Environment Variables

Create a .env file in the project root:

# Database
DATABASE_URL=postgresql://user:password@localhost:5432/dcc_scanner

# Redis
REDIS_URL=redis://localhost:6379

# DecentralChain Node
DCC_NODE_URL=https://mainnet-node.decentralchain.io
DCC_DATA_SERVICE_URL=https://mainnet-node.decentralchain.io
DCC_CHAIN_ID=D

# Telegram
TELEGRAM_BOT_TOKEN=your_bot_token_here

# API
API_PORT=3200

# Indexer
INDEXER_START_HEIGHT=0
INDEXER_BATCH_SIZE=10
INDEXER_POLL_INTERVAL_MS=2000

πŸ›  Self-Hosting Guide

1. Create a Telegram Bot

  1. Message @BotFather on Telegram
  2. Send /newbot and follow the prompts
  3. Copy the bot token to your .env file

2. Set Up PostgreSQL

createdb dcc_scanner
pnpm db:migrate
pnpm db:seed

3. Start Services

You can start services individually or all at once:

# All services (development)
pnpm dev

# Individual services
pnpm --filter @dcc-scanner/chain-indexer run dev
pnpm --filter @dcc-scanner/scanner-api run dev
pnpm --filter @dcc-scanner/telegram-bot run dev
pnpm --filter @dcc-scanner/market-data-service run dev
pnpm --filter @dcc-scanner/risk-engine run dev
pnpm --filter @dcc-scanner/alerts-engine run dev
pnpm --filter @dcc-scanner/chart-service run dev

4. Production Deployment

# Build all services
pnpm build

# Start in production
NODE_ENV=production pnpm --filter @dcc-scanner/scanner-api run start
NODE_ENV=production pnpm --filter @dcc-scanner/telegram-bot run start
# ... repeat for each service

πŸ§ͺ Tech Stack

Layer Technology
Language TypeScript 5.7 (strict mode)
Runtime Node.js 20+ (ES2022 target)
Monorepo pnpm workspaces
Bot Framework Telegraf 4
API Framework Fastify 5 (REST + WebSocket)
Frontend Next.js 15 + React 19 + Tailwind CSS 4
Database PostgreSQL 16 + Prisma ORM
Cache & Queues Redis 7 + BullMQ 5
Charts Lightweight Charts (TradingView)
Logging Pino (structured, JSON)
Validation Zod schemas at all boundaries
Testing Vitest

πŸ“Š Database Schema

25 tables covering the full token intelligence domain:

  • Users & Telegram β€” telegram_users, telegram_groups
  • Tokens & Metadata β€” tokens, deployers, pools
  • Market Data β€” token_price_snapshots, candles
  • Risk Scoring β€” risk_scores, risk_score_factors
  • Holder Analytics β€” holder_snapshots
  • Trading Activity β€” swaps, transfers
  • Alerts & Watchlists β€” alerts, alert_notifications, watchlists, watchlist_items
  • Alpha Tracking β€” group_alpha_calls, group_alpha_performance
  • System β€” indexer_checkpoints, scan_history, admin_flags, known_scam_entities

πŸ”‘ Design Principles

  • Event-Driven Architecture β€” Chain indexer publishes normalized events; downstream services subscribe via BullMQ
  • Adapter Pattern β€” All blockchain SDK access isolated in blockchain-client package
  • Idempotent Ingestion β€” Indexer supports replay from any block height
  • Pluggable Risk Rules β€” Each risk factor is a self-contained, testable module
  • BigNumber Everywhere β€” No floating-point math for financial data
  • Zod at Boundaries β€” All API input/output validated with typed schemas
  • Structured Logging β€” Pino with correlation IDs across all services
  • Graceful Degradation β€” Bot falls back to direct node queries when API is unavailable

πŸ“ API Endpoints

Scanner API (/api)

Method Endpoint Description
GET /tokens/trending Trending tokens by activity
GET /tokens/new Recently created tokens
GET /tokens/:assetId Token details
GET /tokens/:assetId/scan Full token scan with risk
GET /tokens/:assetId/holders Holder distribution
GET /tokens/:assetId/candles OHLCV price candles
GET /tokens/:assetId/risk Risk score breakdown
GET /deployers/:address Deployer profile
GET /deployers/:address/tokens Deployer's tokens
GET /wallets/:address Wallet profile
GET /watchlists/:userId User watchlist
POST /watchlists/:userId/items Add to watchlist
GET /health Service health check

🀝 Contributing

Contributions are welcome! Please read the contribution guidelines before submitting a PR.

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

πŸ“„ License

This project is licensed under the MIT License β€” see the LICENSE file for details.


Built for the DecentralChain ecosystem

⭐ Star this repo if you find it useful!

About

πŸ”Ž Real-time token intelligence for DecentralChain β€” Telegram bot with risk scoring, deployer profiling, whale tracking, and alpha detection. 9 microservices, TypeScript monorepo.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors