Multi-blockchain contract analysis and indexing system with AI-powered security audits using evmbench
Fork of kismp123/BugChainIndexer Β· Significantly improved by 0xMilenov
β οΈ Note: This project is still in active development.Planned: Solodit API integration (50,000+ vulnerabilities); one-click fuzz campaigns via getrecon.
BugChainIndexer is a comprehensive blockchain analysis platform that monitors, analyzes, and indexes contract data across 14+ blockchain networks. The original project by @kismp123 provides the core indexing engine and multi-chain scanning. This fork adds: Etherscan API v2 support; source code storage and a query-based search to search and compare across stored contracts; a significantly improved UI with dedicated contract pages; AI-powered security audits via evmbench; and production deployment tooling.
- 14+ Blockchain Networks: Ethereum, BSC, Polygon, Arbitrum, Optimism, Base, Avalanche, Gnosis, Linea, Scroll, Mantle, opBNB, Unichain, Berachain
- Unified Processing: Single codebase handles all networks with consistent data structures
- Parallel Execution: Process multiple networks simultaneously
- Network-Specific Token Decimals: 1,254+ tokens across 18 networks
- One-Click AI Audits: Run AI security analysis on any verified contract from the UI
- evmbench Integration: Uses paradigmxyz/evmbench as a submodule
- Manual & Automated Reports: Support for manual audit notes and evmbench job results
- OpenAI Integration: Users provide their own API key; keys are sent directly to evmbench and not stored
- 50,000+ addresses/hour per network
- 5-in-1 Pipeline: Transfer events β Address filtering β EOA detection β Contract verification β Database storage
- UnifiedScanner: Main pipeline with ERC-20 balance checking
- FundUpdater: Portfolio tracking with PostgreSQL advisory locks
- ERC20TokenBalanceScanner: ERC-20 balances for verified contracts
- DataRevalidator: Data validation and reclassification
- BalanceHelper Contracts: Batch balance queries (550M gas limit optimized)
- Alchemy Prices API: Real-time token prices with 7-day update cycle
- PostgreSQL Advisory Locks: Concurrent-safe fund updates
- Dynamic Batch Sizing: Adaptive chunk sizes (50-1000 addresses)
- Sub-second Response: Optimized queries with composite indexes
- 4-Hour Network Counts Cache: Eliminates expensive GROUP BY queries
- REST API: Filtering, pagination, contract details, bookmarks, audit reports
- Source Code Search: Full-text search across verified contract sources
- Add Contract: Manually add contracts by address and network
- Bookmarks: Save and manage favorite contracts
- Audit Reports: View AI audit results, manual reports, and recon data
- Contract Details: Verified source, deployment info, token balances
BugChainIndexer/
βββ scanners/ # Core blockchain analysis engine
β βββ common/ # Shared utilities (core.js, database.js, alchemyRpc.js)
β βββ core/ # UnifiedScanner, FundUpdater, DataRevalidator, ERC20TokenBalanceScanner
β βββ config/networks.js # 18 network configurations
β βββ tokens/ # Token configs (ethereum.json, binance.json, ...)
β βββ cron/ # Cron scripts for automation
β βββ run.sh # Main scanner runner
βββ server/
β βββ backend/ # Express.js REST API
β β βββ controllers/ # address, bookmark
β β βββ services/ # address, bookmark, addContract, evmbench, db
β β βββ routes/public.js # API routes
β βββ frontend-next/ # Next.js 16 web interface
β βββ services/ # systemd units + install script
βββ evmbench-main/ # Git submodule (paradigmxyz/evmbench)
β βββ backend/ # Docker: FastAPI, RabbitMQ, Postgres, workers
βββ contract/ # BalanceHelper & validator contracts (Foundry)
βββ deploy.sh # Deployment script
βββ run-local-ui.sh # Local dev: backend + frontend
βββ docs/ # Documentation
- Node.js (v18+)
- PostgreSQL (v12+)
- Docker & Docker Compose (for evmbench)
- Alchemy API key
- Etherscan API keys
git clone --recurse-submodules https://github.com/0xMilenov/BugChainIndexer.git
cd BugChainIndexerOr, if already cloned:
git submodule update --init --recursive# Scanners
cp scanners/.env.example scanners/.env
# Backend
cp server/backend/.env_example server/backend/.env
# Frontend (optional)
cp server/frontend-next/.env.example server/frontend-next/.env
# evmbench (for AI audits)
cp evmbench-main/backend/.env.example evmbench-main/backend/.envRequired variables:
scanners/.env:PGDATABASE,PGUSER,PGPASSWORD,DEFAULT_ETHERSCAN_KEYS,ALCHEMY_API_KEYserver/backend/.env:DATABASE_URL,EVMBENCH_API_URL=http://127.0.0.1:1337,PORT=8000evmbench-main/backend/.env:POSTGRES_PASSWORD,RABBITMQ_PASSWORD,SECRETS_TOKEN_RO,SECRETS_TOKEN_WO
GitHub OAuth (optional, for "Log in with GitHub"):
- Create an OAuth app at github.com/settings/applications/new
- Set Authorization callback URL to
http://localhost:3000/auth/github/callback(or your frontend URL +/auth/github/callback) - Add
GITHUB_CLIENT_ID,GITHUB_CLIENT_SECRET,AUTH_JWT_SECRET, andFRONTEND_URLtoserver/backend/.env - Restart the backend. If not configured, clicking "Log in" shows a setup guide at
/auth/setup.
Local OAuth testing: See docs/LOCAL-AUTH-SETUP.md for using .env.local to test auth locally alongside production config.
# Scanners
cd scanners && npm install && cd ..
# Backend
cd server/backend && npm install && cd ../..
# Frontend
cd server/frontend-next && npm install && npm run build && cd ../..
# Start evmbench (Docker)
cd evmbench-main/backend && docker compose up -d --build && cd ../..
# Start backend + frontend (local dev)
./run-local-ui.sh start- Backend: http://localhost:8000
- Frontend: http://localhost:3000
- evmbench API: http://127.0.0.1:1337 (internal)
cd scanners
NETWORK=ethereum ./run.sh unified # Single network
./run.sh unified parallel # All networks
NETWORK=ethereum ./run.sh funds # Update balances
./run.sh erc20-balances # ERC-20 balances./deploy.shThis script:
- Pulls latest code and submodules
- Starts evmbench Docker stack
- Installs backend/frontend deps and builds
- Restarts BugChainIndexer services (systemd or run-local-ui)
sudo server/services/install-systemd.sh
systemctl start evmbench bugchain-backend bugchain-frontendServices start on boot in order: evmbench β bugchain-backend β bugchain-frontend.
See docs/EVMBENCH_SETUP.md for evmbench configuration details.
| Method | Endpoint | Purpose |
|---|---|---|
| GET | /health |
Health check |
| GET | /getAddressesByFilter |
Addresses with filters (networks, address, contractName, fund, deployed, cursor) |
| GET | /getContractCount |
Contract count |
| GET | /networkCounts |
Network statistics (4-hour cache) |
| GET | /nativePrices |
Native token prices |
| GET | /contract/:network/:address |
Contract details |
| GET | /contract/:network/:address/reports |
Audit reports |
| POST | /contract/:network/:address/audit/start |
Start evmbench AI audit |
| POST | /contract/:network/:address/audit/manual |
Save manual audit |
| POST | /addContract |
Add contract manually |
| GET/POST | /searchByCode |
Source code search |
| GET/POST | /bookmarks |
Get/add bookmarks |
| DELETE | /bookmarks/:network/:address |
Remove bookmark |
cd scanners/cron
./setup-cron.sh --auto-setupDefault schedule:
- Unified analysis: Every 4 hours
- Fund updates: Every 6 hours
- ERC-20 balances: Every 2 hours (off-peak)
- Data validation: Weekly (Sunday 2 AM)
- DB optimization: Daily
cd scanners
./run.sh db-optimize-fast # Daily (fast)
./run.sh db-optimize # Weekly (with VACUUM)
./run.sh db-optimize-large # Monthly (10GB+)
./run.sh db-analyze # Performance analysis- RAM: 4GB+ (8GB+ for parallel processing)
- Storage: 50GB+ for database
- Docker: For evmbench AI audits
MIT License - see LICENSE for details.
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit changes (
git commit -m 'Add amazing feature') - Push to branch (
git push origin feature/amazing-feature) - Open a Pull Request
Original: kismp123/BugChainIndexer Β· Fork: VISUALISA Β· Built for scale Β· Optimized for performance