Parasite Pool Stats Page https://parasite.space
  • TypeScript 98.3%
  • JavaScript 0.7%
  • Shell 0.5%
  • CSS 0.4%
  • Just 0.1%
Find a file
2026-03-23 21:41:47 +00:00
.github Make targets configurable (#161) 2026-02-23 15:49:08 -06:00
app Tweak private/public toggle (#205) 2026-03-23 21:41:47 +00:00
bin API Key from env (#74) 2025-09-30 17:32:09 -04:00
lib feat: frontend user badge display (#202) 2026-03-23 17:39:50 -04:00
public Update layout metadata and replace images; remove unused SVG files (#30) 2025-05-10 17:07:06 -07:00
scripts feat: round stats (#187) 2026-03-18 13:56:20 -04:00
.gitignore Add Stratum component (#91) 2025-11-14 16:40:08 -05:00
CHANGELOG.md Release 0.1.0 (#128) 2025-12-17 11:12:21 -05:00
eslint.config.mjs Update dependencies (#107) 2025-12-08 21:27:51 -05:00
justfile Make targets configurable (#161) 2026-02-23 15:49:08 -06:00
next.config.ts Fix some miscellaneous warnings (#200) 2026-03-20 16:30:06 -04:00
package.json Bump the minor-and-patch group across 1 directory with 7 updates (#196) 2026-03-20 17:28:45 +00:00
pnpm-lock.yaml Bump the minor-and-patch group across 1 directory with 7 updates (#196) 2026-03-20 17:28:45 +00:00
postcss.config.mjs Initial implementation (#2) 2025-05-08 22:15:19 -07:00
README.md Tweak http client logic (#105) 2025-12-09 16:46:21 -05:00
STATS_COLLECTOR.md Initial implementation (#2) 2025-05-08 22:15:19 -07:00
STRATUM_IMPLEMENTATION.md Add parasite block template analysis (#58) 2025-06-25 13:46:48 -04:00
tsconfig.json Update dependencies (#107) 2025-12-08 21:27:51 -05:00

Parastats

A mining pool frontend for parasite

Features

  • Real-time Statistics: Monitor pool and individual miner statistics with automatic updates
  • Historical Data: Track performance over time with detailed charts
  • User Dashboard: Personal dashboard for miners
  • Automated Data Collection: Background service collecting pool and user statistics every minute
  • Stratum Pool Integration: Real-time connection to Parasite stratum pool for block template notifications
  • Automated Data Retention: Automatic cleanup of old data (30-day retention) with daily maintenance

Tech Stack

  • Frontend: Next.js 15.3 with React 19
  • Styling: TailwindCSS 4.1
  • Database: SQLite (via better-sqlite3)
  • Charts: ECharts 5.6
  • HTTP Client: Undici with HTTP/2 support for optimized API requests
  • Bitcoin Integration: @mempool/mempool.js

Getting Started

  1. Install dependencies:
pnpm install
  1. Start the development server:
pnpm dev
  1. Start the stats collector (in a separate terminal):
pnpm collect-stats

This will start:

  • Pool Stats Collector: Fetches pool statistics every minute
  • User Stats Collector: Fetches individual miner statistics every minute
  • Stratum Collector: Connects to the Parasite stratum pool for real-time block template notifications
  • Data Maintenance: Runs daily cleanup at midnight to purge data older than 30 days

The application will be available at http://localhost:3000.

Development

  • pnpm dev - Start development server with Turbopack
  • pnpm build - Create production build
  • pnpm start - Start production server
  • pnpm lint - Run linter
  • pnpm lint:fix - Fix linting issues
  • pnpm collect-stats - Start the statistics collector

Project Structure

  • /app - Next.js application code
    • /components - React components
    • /api - API routes
    • /user - User dashboard
    • /worker - Worker dashboard
  • /lib - Shared utilities and database code
  • /scripts - Background jobs and utilities
  • /data - SQLite database and other data files

Configuration

The stats collector can be configured using environment variables:

Required

  • API_URL - URL of server to fetch statistics from (example: https://example.com/api)
  • API_TOKEN - Bearer access token (example: supersecrettoken)
  • LIGHTNING_API_URL - Lightning wallet API URL (example: https://api.example.com)
  • LIGHTNING_API_ID - Lightning authentication identifier

Optional

Stats Collection:

  • PARASTATS_DATA_DIR - Database location (default: ./data)
  • MAX_FAILED_ATTEMPTS - Failed fetch attempts before deactivating a user (default: 10)
  • USER_BATCH_SIZE - Users to process concurrently (default: 500)
  • FAILED_USER_BACKOFF_MINUTES - Wait time before retrying failed users (default: 2)
  • AUTO_DISCOVER_USERS - Auto-discover and monitor new miners (default: true)
  • AUTO_DISCOVER_BATCH_LIMIT - Max new users to add per cycle (default: 100)

HTTP/2 Client:

  • HTTP2_MAX_CONNECTIONS - Max concurrent connections per origin (default: 30)
  • HTTP2_CLIENT_TTL - Connection lifetime in ms (default: 120000)
  • HTTP2_CONNECT_TIMEOUT - Connection timeout in ms (default: 1500)
  • HTTP2_HEADERS_TIMEOUT - Response headers timeout in ms (default: 10000)
  • HTTP2_BODY_TIMEOUT - Response body timeout in ms (default: 10000)
  • HTTP2_KEEPALIVE_TIMEOUT - Keep-alive timeout in ms (default: 60000)
  • HTTP2_REQUEST_TIMEOUT - Hard request timeout in ms (default: 18000)

Examples

Basic usage:

API_URL=https://example.com/api API_TOKEN=supersecrettoken pnpm collect-stats
API_URL=https://example.com/api API_TOKEN=supersecrettoken pnpm dev

With auto-discovery disabled:

API_URL=https://example.com/api API_TOKEN=supersecrettoken AUTO_DISCOVER_USERS=false pnpm collect-stats

Custom configuration:

PARASTATS_DATA_DIR=/path/to/data MAX_FAILED_ATTEMPTS=5 pnpm collect-stats

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License.

This means you are free to:

  • Share — copy and redistribute the material in any medium or format
  • Adapt — remix, transform, and build upon the material

Under the following terms:

  • Attribution — You must give appropriate credit, provide a link to the license, and indicate if changes were made.
  • NonCommercial — You may not use the material for commercial purposes.