{"id":46638243,"url":"https://github.com/tetherto/miningos-wrk-minerpool-f2pool","last_synced_at":"2026-03-08T02:13:16.684Z","repository":{"id":340876266,"uuid":"1129676966","full_name":"tetherto/miningos-wrk-minerpool-f2pool","owner":"tetherto","description":null,"archived":false,"fork":false,"pushed_at":"2026-02-26T23:00:45.000Z","size":93,"stargazers_count":0,"open_issues_count":0,"forks_count":4,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-02-27T05:33:31.390Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tetherto.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":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-01-07T12:29:53.000Z","updated_at":"2026-02-26T23:00:50.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/tetherto/miningos-wrk-minerpool-f2pool","commit_stats":null,"previous_names":["tetherto/miningos-wrk-minerpool-f2pool"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/tetherto/miningos-wrk-minerpool-f2pool","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tetherto%2Fminingos-wrk-minerpool-f2pool","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tetherto%2Fminingos-wrk-minerpool-f2pool/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tetherto%2Fminingos-wrk-minerpool-f2pool/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tetherto%2Fminingos-wrk-minerpool-f2pool/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tetherto","download_url":"https://codeload.github.com/tetherto/miningos-wrk-minerpool-f2pool/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tetherto%2Fminingos-wrk-minerpool-f2pool/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30242406,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-08T00:58:18.660Z","status":"online","status_checked_at":"2026-03-08T02:00:06.215Z","response_time":56,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2026-03-08T02:13:15.960Z","updated_at":"2026-03-08T02:13:16.669Z","avatar_url":"https://github.com/tetherto.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# miningos-wrk-minerpool-f2pool\n\nF2Pool Mining Pool Worker - MiningOS worker implementation for integrating with F2Pool's API v2.\n\n## Table of Contents\n\n1. [Overview](#overview)\n2. [Prerequisites](#prerequisites)\n3. [Installation](#installation)\n4. [Configuration](#configuration)\n5. [Starting the Worker](#starting-the-worker)\n6. [Architecture](#architecture)\n7. [API Endpoints Used](#api-endpoints-used)\n8. [Development](#development)\n9. [Monitoring](#monitoring)\n10. [Troubleshooting](#troubleshooting)\n11. [Contributing](#contributing)\n\n## Overview\n\nThis worker connects to the F2Pool API v2 to collect and monitor mining statistics, including:\n- Real-time hashrate monitoring (current, 1h, 24h intervals)\n- Worker status and performance tracking\n- Balance and revenue information\n- Transaction history\n- Stale hashrate monitoring\n\n## Prerequisites\n\n- Node.js \u003e= 20.0\n- Access to F2Pool API v2 (API secret required)\n- Valid F2Pool account username for production use\n\n## Installation\n\n1. Clone the repository:\n```bash\ngit clone https://github.com/tetherto/miningos-wrk-minerpool-f2pool.git\ncd miningos-wrk-minerpool-f2pool\n```\n\n2. Install dependencies:\n```bash\nnpm install\n```\n\n3. Setup configuration files:\n```bash\nbash setup-config.sh\n```\n\n## Configuration\n\n### Base Configuration (config/f2pool.json)\n\nConfigure the F2Pool API endpoint and collection intervals:\n\nDevelopment/Staging:\n```json\n{\n  \"baseUrl\": \"http://127.0.0.1:8000\",\n  \"apiSecret\": \"secret-key\",\n  \"accounts\":[]\n}\n```\n\nProduction:\n```json\n{\n  \"apiUrl\": \"https://api.f2pool.com/v2\",\n  \"apiSecret\": \"secret-key\",  \n  \"accounts\":[]\n}\n```\n\n**Configuration Options:**\n- `baseUrl`: F2Pool API endpoint\n- `apiSecret`: Your F2Pool API secret key\n\n## Starting the Worker\n\n### Production Mode\n```bash\nDEBUG=\"*\" node worker.js --wtype wrk-minerpool-rack-f2pool --env production --rack rack-1\n```\n\n### Development Mode\n```bash\nDEBUG=\"*\" node worker.js --wtype wrk-minerpool-rack-f2pool --env development --rack rack-1\n```\n\n### Mock Server (Development)\n```bash\nnpm run dev\n# Or specify custom usernames:\nnode mock/server.js --usernames username1,username2 --port 8000\n```\n\n## Architecture\n\n### Core Classes\n\n#### `F2PoolMinerPool` (`workers/lib/f2pool.minerpool.js`)\nAPI client wrapper class that handles:\n- API communication with F2Pool API v2\n- API authentication via `F2P-API-SECRET` header\n- Rate limiting (1 second between requests)\n- Request formatting and response parsing\n- Balance, hashrate, worker, and transaction data fetching\n\n#### `WrkMinerPoolRackF2Pool` (`workers/f2pool.rack.minerpool.wrk.js`)\nMain worker class extending `TetherWrkBase` that:\n- Initializes HTTP facilities for F2Pool API communication\n- Schedules periodic data collection:\n  - Every 1 minute: Fetch stats (hashrate, balance, yearly balances)\n  - Every 5 minutes: Fetch workers and save stats to database\n  - Daily: Fetch transactions\n- Implements data aggregation and storage logic\n- Manages multiple mining accounts via configuration\n- Provides RPC interface for querying collected data\n\n### Statistics Collection\n\nThe worker collects and stores various statistics every 5 minutes:\n\n1. **Account Snapshots**:\n   - Total balance and unsettled amounts\n   - 24h revenue\n   - Estimated daily income\n   - Active/total worker counts\n   - Yearly balance history (last 12 months)\n\n2. **Worker Statistics**:\n   - Worker online/offline status\n   - Individual worker hashrates\n   - Stale hashrate metrics\n   - Last share timestamps\n\n3. **Daily Transactions**:\n   - Revenue transactions for the current day\n   - Transaction amounts and timestamps\n\n### Data Flow\n\n1. Worker initializes with configuration\n2. Every 5 minutes:\n   - Fetches worker statistics\n   - Collects daily transactions\n   - Updates account snapshots\n3. Data stored in time-series logs with keys:\n   - `stat-workers-t-minerpool`: Worker performance data\n   - `stat-transactions-t-minerpool`: Transaction records\n4. Available for querying via RPC interface\n\n## API Endpoints Used\n\nThe worker interacts with the following F2Pool API v2 endpoints:\n- `/v2/assets/balance` - Account balance and revenue\n- `/v2/hash_rate/info` - Hashrate statistics\n- `/v2/hash_rate/worker/list` - Worker information\n- `/v2/assets/transactions/list` - Transaction history\n\nAll API requests require authentication via the `F2P-API-SECRET` header.\n\n## Development\n\n### Running Tests\n```bash\nnpm run lint        # Check code style\nnpm run lint:fix    # Fix code style issues\nnpm test           # Run tests (currently runs linting)\n```\n\n### Mock Server\nThe mock server provides a development environment that simulates F2Pool API v2 responses:\n- Default port: 8000\n- Configurable usernames\n- Simulates all API endpoints\n\n## Monitoring\n\nMonitor worker activity through debug logs:\n- API requests and responses\n- Statistics collection cycles\n- Worker status updates\n- Error messages and stack traces\n\n## Troubleshooting\n\n### Common Issues\n\n1. **Registration fails**\n   - Ensure username is valid for production\n   - Check network connectivity to API endpoint\n   - Verify configuration file syntax\n   - Confirm API secret is correct\n\n2. **No statistics collected**\n   - Confirm worker is running (`DEBUG=\"*\"` shows activity)\n   - Check API endpoint configuration\n   - Ensure API secret is valid\n\n3. **Authentication errors**\n   - Verify `apiSecret` in config/base.thing.json\n   - Ensure API secret matches your F2Pool account\n   - Check API secret has proper permissions\n\n4. **Missing configuration**\n   - Run `bash setup-config.sh` to create config files\n   - Check all required fields are populated\n   - Verify facilities configs exist: `config/facs/*.json`\n\n## Contributing\n\nContributions are welcome and appreciated!\nWhether you’re fixing a bug, adding a feature, improving documentation, or suggesting an idea, here’s how you can help:\n\n### How to Contribute\n\n1. **Fork** the repository.\n2. **Create a new branch** for your feature or fix:\n\n   ```bash\n   git checkout -b feature/your-feature-name\n   ```\n3. **Make your changes** and commit them with a clear message.\n4. **Push** to your fork:\n\n   ```bash\n   git push origin feature/your-feature-name\n   ```\n5. **Open a Pull Request** describing what you changed and why.\n\n### Guidelines\n\n* Follow the existing code style and structure.\n* Keep PRs focused—one feature or fix per pull request.\n* Provide screenshots or examples if your change affects the UI/UX.\n* Update documentation/tests as needed.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftetherto%2Fminingos-wrk-minerpool-f2pool","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftetherto%2Fminingos-wrk-minerpool-f2pool","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftetherto%2Fminingos-wrk-minerpool-f2pool/lists"}