{"id":46638230,"url":"https://github.com/tetherto/miningos-wrk-minerpool-ocean","last_synced_at":"2026-03-08T02:13:17.167Z","repository":{"id":335332544,"uuid":"1129676997","full_name":"tetherto/miningos-wrk-minerpool-ocean","owner":"tetherto","description":null,"archived":false,"fork":false,"pushed_at":"2026-02-26T23:00:35.000Z","size":93,"stargazers_count":1,"open_issues_count":0,"forks_count":5,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-02-27T05:33:21.454Z","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":null,"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:55.000Z","updated_at":"2026-02-26T23:00:40.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/tetherto/miningos-wrk-minerpool-ocean","commit_stats":null,"previous_names":["tetherto/miningos-wrk-minerpool-ocean"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/tetherto/miningos-wrk-minerpool-ocean","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tetherto%2Fminingos-wrk-minerpool-ocean","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tetherto%2Fminingos-wrk-minerpool-ocean/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tetherto%2Fminingos-wrk-minerpool-ocean/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tetherto%2Fminingos-wrk-minerpool-ocean/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tetherto","download_url":"https://codeload.github.com/tetherto/miningos-wrk-minerpool-ocean/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tetherto%2Fminingos-wrk-minerpool-ocean/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:12.754Z","updated_at":"2026-03-08T02:13:17.155Z","avatar_url":"https://github.com/tetherto.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# miningos-wrk-minerpool-ocean\n\nOcean Mining Pool Worker - MiningOS worker implementation for integrating with Ocean.xyz mining pool API.\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 Ocean mining pool API to collect and monitor mining statistics, including:\n- Real-time hashrate monitoring (60s, 1h, 24h intervals)\n- Worker status and performance tracking\n- Earnings and payout tracking\n- Transaction history\n- Block statistics and pool luck calculations\n- Monthly earnings reports\n\n## Prerequisites\n\n- Node.js \u003e= 20.0\n- Valid Ocean account username for production use\n\n## Installation\n\n1. Clone the repository:\n```bash\ngit clone https://github.com/tetherto/miningos-wrk-minerpool-ocean.git\ncd miningos-wrk-minerpool-ocean\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/ocean.json)\n\nConfigure the Ocean API endpoint:\n\nDevelopment/Staging:\njson\n{\n  \"apiUrl\": \"http://127.0.0.1:8000\",\n  \"accounts\":[\"account-id-1\"]\n}\n\nProduction:\njson\n{\n  \"apiUrl\": \"https://api.ocean.xyz\",\n  \"accounts\":[\"account-id-1\"]\n}\n\n## Starting the Worker\n\n### Production Mode\n```bash\nDEBUG=\"*\" node worker.js --wtype wrk-minerpool-rack-ocean --env production --rack rack-1\n```\n\n### Development Mode\n```bash\nDEBUG=\"*\" node worker.js --wtype wrk-minerpool-rack-ocean --env development --rack rack-1\n```\n\n### Mock Server (Development)\n```bash\nDEBUG=\"*\" node mock/server.js\n```\n\n## Architecture\n\n### Core Classes\n\n#### `OceanMinerPoolApi` (`workers/lib/ocean.minerpool.api.js`)\nThin API wrapper class that handles:\n- API communication with Ocean.xyz endpoints\n- Rate limiting (1 second between requests)\n- Request formatting and response parsing\n- Minimal error handling (HTTP facility handles retries)\n\n#### `WrkMinerPoolRackOcean` (`workers/ocean.rack.minerpool.wrk.js`)\nMain worker class extending `TetherWrkBase` that:\n- Initializes HTTP facilities for Ocean API communication\n- Schedules periodic data collection:\n  - Every 1 minute: Fetch stats (hashrate, earnings, balances)\n  - Every 5 minutes: Fetch workers and save stats to database\n  - Daily: Fetch transactions and blocks\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:\n\n1. **Real-time Stats** (every 5 minutes):\n   - Worker count and status\n   - Hashrate (60s, 1h, 24h averages)\n   - Active worker count\n   - Daily transactions\n\n2. **Daily Stats**:\n   - Block information\n   - Network difficulty\n   - Pool shares and luck calculations\n   - Earnings per block\n\n3. **Monthly Stats**:\n   - Aggregated earnings\n   - Pool luck percentages\n   - Historical performance\n\n### Data Flow\n\n1. Worker connects to Ocean API using configured credentials\n2. Periodically fetches mining statistics based on schedules\n3. Processes and aggregates data\n4. Stores statistics for historical tracking\n5. Provides data via RPC interface\n\n## API Endpoints Used\n\nThe worker interacts with the following Ocean API endpoints:\n- `/v1/earnpay/{username}/{timestamp}` - Earnings and payouts\n- `/v1/user_hashrate/{username}` - Current hashrate information\n- `/v1/user_hashrate_full/{username}` - Detailed worker statistics\n- `/v1/monthly_earnings_report/{username}/{month}` - Monthly earnings\n- `/v1/blocks` - Pool block information\n\n## Development\n\n### Running Tests\n```bash\nnpm run lint        # Check code style\nnpm run lint:fix    # Fix code style issues\nnpm run test    \n```\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\n2. **No statistics collected**\n   - Confirm worker is running (`DEBUG=\"*\"` shows activity)\n   - Check API endpoint configuration\n   - Verify thing registration was successful\n\n3. **Rate limit errors**\n   - Worker implements 1-second delays between requests\n   - Multiple workers may need staggered start times\n\n4. **Missing configuration**\n   - Run `setup-config.sh` to create config files\n   - Check all required fields are populated\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-ocean","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftetherto%2Fminingos-wrk-minerpool-ocean","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftetherto%2Fminingos-wrk-minerpool-ocean/lists"}