{"id":24433276,"url":"https://github.com/mollybeach/rug-watch-dog","last_synced_at":"2026-02-28T05:05:43.176Z","repository":{"id":271929087,"uuid":"914673979","full_name":"mollybeach/rug-watch-dog","owner":"mollybeach","description":" The AI Rug Checker 🤖 is a platform that uses AI and blockchain data analysis to assess cryptocurrency risks, especially meme coins 🐕💰, helping investors detect potential \"rug pulls.\" With machine learning and chatbot interaction, it delivers real-time insights, promoting transparency and security in the crypto space ","archived":false,"fork":false,"pushed_at":"2025-01-17T20:08:20.000Z","size":3308,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-17T20:33:57.096Z","etag":null,"topics":["ai","analysis","cryptocurrency","rugpull"],"latest_commit_sha":null,"homepage":"https://rugwatchdog.vercel.app/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mollybeach.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-01-10T04:26:28.000Z","updated_at":"2025-01-17T20:08:21.000Z","dependencies_parsed_at":"2025-01-10T20:29:17.828Z","dependency_job_id":"dc09df2f-c014-4ada-ba41-7640bf0ca31a","html_url":"https://github.com/mollybeach/rug-watch-dog","commit_stats":null,"previous_names":["mollybeach/rug-watch-dog"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mollybeach%2Frug-watch-dog","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mollybeach%2Frug-watch-dog/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mollybeach%2Frug-watch-dog/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mollybeach%2Frug-watch-dog/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mollybeach","download_url":"https://codeload.github.com/mollybeach/rug-watch-dog/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234821498,"owners_count":18892042,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai","analysis","cryptocurrency","rugpull"],"created_at":"2025-01-20T16:33:58.267Z","updated_at":"2026-02-28T05:05:43.169Z","avatar_url":"https://github.com/mollybeach.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🐕 Rug Watch Dog 🤖🔗\n\nWelcome to the **Rug Watch Dog**, an advanced AI-driven platform that helps investors analyze cryptocurrency tokens, especially meme coins 🐕💰, to detect potential \"rug pulls\" 🛑. This project combines cutting-edge machine learning 📊, blockchain data analysis 🔗, and chatbot integration 🤝 to enhance security 🔒 in the crypto ecosystem\nCheck out the live demo: [RugWatchDog](https://rugwatchdog.vercel.app/)\n\n![Rug Watch Dog](./assets/images/rug-watch-dog.png)\n\n## 🌟 Features\n\n- **AI Risk Analysis**: Automatically analyze meme coins for risks like insider holding %, sniper wallet activity, and volume anomalies.\n- **Blockchain Data Fetching**: Integrates with APIs (Etherscan, DexScreener) to fetch real-time token and transaction data.\n- **EdgeDB Database**: Stores and retrieves token data and model predictions.\n- **Eliza Chatbot Integration**: Interact with a conversational AI assistant on Discord, Telegram, and Twitter for real-time insights.\n- **FUD Alerts**: Automatically generate social media alerts for high-risk tokens to keep the community informed.\n- **Customizable AI Models**: Train and adapt the AI to detect emerging fraud patterns in the crypto ecosystem.\n\n## 🔄 Application Flow\n\n```\nUser Request\n    │\n    ▼\nAPI Layer (src/api/)\n    │\n    ▼\nData Collection Layer\n    │\n    ├─► Etherscan API\n    │   (src/data-harvesting/fetcher.ts)\n    │\n    └─► DexScreener API\n        (src/data-harvesting/fetcher.ts)\n    │\n    ▼\nData Processing\n    │\n    ├─► Token Metrics\n    │   (src/data-processing/metrics.ts)\n    │\n    └─► Data Storage\n        (src/data-processing/storage.ts)\n    │\n    ▼\nML Analysis\n    │\n    ├─► Model Prediction\n    │   (src/training/predictor.ts)\n    │\n    └─► Risk Evaluation\n        (src/training/evaluator.ts)\n    │\n    ▼\nResponse/Alerts\n    │\n    ├─► API Response\n    │   (src/api/routes/)\n    │\n    └─► Social Integrations\n        (src/integrations/)\n```\n\n### Process Explanation:\n\n1. **Input**: User submits a token address for analysis\n2. **Data Collection**: System fetches data from multiple sources\n3. **Processing**: Raw data is transformed into risk metrics\n4. **Analysis**: AI model evaluates the risk factors\n5. **Output**: Generates alerts or stores results for training\n\n\nFor more details on each step, see the documentation below.\n\n## 🔧 Technical Architecture\n\n### 1. API Layer (`src/api/`)\n- `routes/`: API endpoint handlers\n  - `analyze.ts`: Token analysis endpoints\n  - `metrics.ts`: Metrics retrieval\n  - `tokens.ts`: Token management\n- `middleware/`: Request processing\n  - `auth.ts`: Authentication handling\n\n### 2. Data Collection (`src/data-harvesting/`)\n- `fetcher.ts`: External API integrations\n- `collector.ts`: Data collection orchestration\n- `chainMonitor.ts`: Blockchain scanning\n- `tokenScanner.ts`: Token-specific scanning\n\n### 3. Data Processing (`src/data-processing/`)\n- `metrics.ts`: Token metrics calculation\n- `parser.ts`: Raw data parsing\n- `storage.ts`: Data persistence layer\n\n### 4. Machine Learning (`src/training/`)\n- `modelPredictor.ts`: Risk prediction logic\n- `modelEvaluator.ts`: Model evaluation\n- `modelTrainer.ts`: Model training pipeline\n\n### 5. Database Layer (`src/db/`)\n- `models/`: Database schemas\n- `migrations/`: Database migrations\n- `connection.ts`: Database configuration\n\n### 6. Monitoring \u0026 Scripts (`src/scripts/`)\n- `collect-data.ts`: Training data collection\n- `clean-db.ts`: Database maintenance\n- `train.ts`: Model training execution\n\n### 7. Types \u0026 Utils (`src/types/`, `src/utils/`)\n- `api.ts`: API interfaces\n- `data.ts`: Data structure types\n- `utils.ts`: Helper functions\n\n### 8. Model Storage (`/models/`)\n- `datasets/`: Training datasets\n- `trained/`: Trained model files\n\n### 9. Integration Layer\n- `src/chat/index.ts`: Chat interface implementation\n- `src/clients/index.ts`: Social media client integrations\n- `src/cache/index.ts`: Performance optimization\n---\n\n\n\n## 🔧 Database Schema\n\nThe database schema is defined in the `dbschema` directory. The schema is specified in the `default.esdl` file. You can generate the schema using the EdgeDB CLI with the following command:\n\n```bash\nedgedb schema generate\n```\n\n## 🔧 Database Migrations\n\nDatabase migrations are managed in the `migrations` directory. You can generate migrations using the EdgeDB CLI with the following command:\n\n```bash\nedgedb migration generate\n```\n\n## Using EdgeDB Shell\n\n1. **Open EdgeDB Shell**:\n   Run the following command in your terminal to open the EdgeDB interactive shell:\n   ```bash\n   edgedb\n   ```\n\n2. **List All Object Types**:\n   Use the following EdgeQL command to list all object types (tables) and their properties:\n   ```edgeql\n   SELECT schema::ObjectType {\n       name,\n       properties: {\n           name,\n           target: {\n               name\n           }\n       }\n   } FILTER .name LIKE 'default::%';\n   ```\n\n## Step-by-Step Guide for Migrations\n\n1. **Create a New Migration**:\n   - Ensure your `.esdl` files reflect the current desired schema state.\n   - Run the following command to create a new migration:\n     ```bash\n     edgedb migration create\n     ```\n\n2. **Apply the Migration**:\n   - Run the following command to apply the migration:\n     ```bash\n     edgedb migrate\n     ```\n\n3. ** Create a new migration and apply it to the cloud instance and generate the query builder\n```bash\n     edgedb migration create \n     edgedb migrate\n     edgedb migrate -I mollybeach/rug-watch-dog-db\n     pnpm generate edgeql-js\n```\n\n4. Connect to the EdgeDB instance\n```bash\n     edgedb -I mollybeach/rug-watch-dog-db\n```\n\n5. Write a SELECT query to check the data\n```edgeql\n    SELECT Token {\n    address,\n    name,\n    symbol,\n    metrics: {\n        tokenAddress,\n        volumeAnomaly,\n        holderConcentration,\n        liquidityScore,\n        priceVolatility,\n        sellPressure,\n        marketCapRisk,\n        bundlerActivity,\n        accumulationRate,\n        stealthAccumulation,\n        suspiciousPattern,\n        isRugPull,\n        timestamp,\n        holders,\n        totalSupply,\n        currentPrice,\n        isHoneyPot\n    },\n    price: {\n        tokenAddress,\n        price,\n        liquidity,\n        volume24h,\n        marketCap,\n        timestamp\n    },\n    createdAt,\n    updatedAt\n};\n\nSELECT TokenMetrics;\n```\n\n\n## Checking Data in EdgeDB\n\nTo check the contents of your EdgeDB database, you can use the EdgeDB shell to run a `SELECT` query. Here’s how you can do it:\n\n- **Select Data**:\n  Execute a `SELECT` query to retrieve data from the `TokenMetrics` table. For example:\n  ```edgeql\nSELECT TokenMetrics;\nSELECT TokenPrices;\n  ```\n\n  4. Login to EdgeDB\n  ```edgeql\n edgedb cloud login\n  ```\n\n5. Connect to Your EdgeDB Instance:\nUse the edgedb command to connect to your EdgeDB instance. You will need the connection details such as host, port, username, and database name. Here’s an example command:\n```bash\nedgedb -H your-edgedb-host -P your-port -u your-username -d your-database\n```\nor\n```bash\nedgedb -I your-instance-name\n```\nGenerate the Query builder\n```bash\npnpm generate edgeql-js\n```\n\nMigrate to the cloud instance\n```\nedgedb migrate -I mollybeach/rug-watch-dog-db\n```\nTo close the EdgeDB shell, type `CTRL + D` and press Enter.\n\n---\n\n## 🛠️ Setup\n\n### 1. Clone the Repository\n```bash\ngit clone https://github.com/mollybeach/rug-watch-dog.git\ncd rug-watch-dog\n```\n\n### 2. Install Dependencies\n```bash\npnpm install\n```\n\n### 3. Set Up Environment Variables\nCreate a `.env` file in the root directory:\n```env\n# API Keys\nETHERSCAN_API_KEY=your_etherscan_key_here\nBSCSCAN_API_KEY=your_bscscan_api_key_here\nPOLYGONSCAN_API_KEY=your_polygonscan_api_key_here\nALCHEMY_API_KEY=your_alchemy_api_key_here\n\n# RPC Endpoints\nETHEREUM_RPC=https://eth-mainnet.g.alchemy.com/v2/your_alchemy_api_key\nBSC_RPC=https://bsc-dataseed1.binance.org\nPOLYGON_RPC=https://polygon-mainnet.g.alchemy.com/v2/your_alchemy_api_key\n\n# Discord Integration (Optional)\nDISCORD_APPLICATION_ID=your_discord_app_id\nDISCORD_API_TOKEN=your_discord_bot_token\n\n# OpenRouter AI (Optional)\nOPENROUTER_API_KEY=your_openrouter_key\n\n# Twitter Bot Integration (Optional)\nTWITTER_USERNAME=your_twitter_username\nTWITTER_PASSWORD=your_twitter_password\nTWITTER_EMAIL=your_twitter_email\n\n# API URLs\nETHERSCAN_API_URL=https://api.etherscan.io/api\nDEX_SCREENER_API_URL=https://api.dexscreener.com/latest/\nALCHEMY_API_URL=https://eth-mainnet.g.alchemy.com/v2/\n\n# Server Configuration\nPORT=3000\nNODE_ENV=development\n```\n\nNote: DexScreener API does not require an API key but has a rate limit of 300 requests per minute.\n\n### 4. Quick Commands\n- Use ⌘K to generate a command\n- Common commands:\n  ```bash\n  pnpm start        # Start the server\n  pnpm train        # Train the model\n  pnpm collect-data # Collect training data\n  pnpm test         # Run tests\n  ```\n\n## 🔧 Troubleshooting\n\n### Common TypeScript Errors\n\n1. **Property Missing Error**\n```typescript\nProperty 'marketCap' does not exist on type '{ volumeAnomaly: boolean; holderConcentration: boolean; liquidityScore: boolean; }'\n```\nFix: Ensure your interfaces match the data structure:\n```typescript\ninterface TokenMetrics {\n  volume: number;\n  holders: number;\n  liquidity: number;\n  priceChange24h: number;\n  buyTxns24h: number;\n  sellTxns24h: number;\n  marketCap: number;\n  totalSupply: number;\n  currentPrice: number;\n  isRugPull: boolean;\n  isHoneyPot: boolean;\n  timestamp: Date;\n}\n```\n\n2. **Training Data Type Mismatch**\n```typescript\nArgument of type '{ volumeAnomaly: number; holderConcentration: number; liquidityScore: number; isRugPull: boolean; }[]' is not assignable to parameter of type 'TrainingData[]'\n```\nFix: Make sure your training data includes all required fields:\n```typescript\ninterface TrainingData {\n  volumeAnomaly: number;\n  holderConcentration: number;\n  liquidityScore: number;\n  priceVolatility: number;\n  sellPressure: number;\n  marketCapRisk: number;\n  isRugPull: boolean;\n}\n```\n\n## 📊 Model Training\n\nThe model is trained on a diverse dataset including:\n- 15 known rug pull tokens (including SQUID, SAFEMOON, LUNA Classic)\n- 15 legitimate tokens (including WETH, USDC, UNI)\n\nTraining data is collected from:\n- Etherscan (holder data, contract info)\n- DexScreener (price, volume, liquidity data)\n\n## 🚀 Usage\n\n1. Analyze a token:\n```bash\ncurl -X POST http://localhost:3000/analyze \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"tokenAddress\":\"0x...\"}'\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmollybeach%2Frug-watch-dog","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmollybeach%2Frug-watch-dog","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmollybeach%2Frug-watch-dog/lists"}