Mining/site-docs/api/endpoints.md
snider 3057701ac1 feat: Add SQLite persistence, enhanced dashboard UI, and comprehensive E2E tests
- Add SQLite database package for hashrate history persistence with configurable retention
- Enhance dashboard with responsive stats bar, improved chart component, and worker selector
- Add terminal modal component for console output viewing
- Implement comprehensive E2E test suite with page objects pattern
- Add history API endpoints for historical data queries
- Update worker message handling with proper registration
- Add new UI pages structure with layouts and components
- Update Docker configuration for Go 1.24
- Add PostCSS configuration for Tailwind CSS processing

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-30 00:03:30 +00:00

5.3 KiB

API Endpoints

Complete reference for all REST API endpoints.

System

Get System Information

GET /api/v1/mining/info

Returns system and miner installation details.

Response:

{
  "platform": "linux",
  "cpu": "AMD Ryzen 9 5950X",
  "cores": 32,
  "memory_gb": 64,
  "installed_miners_info": [
    {
      "is_installed": true,
      "version": "6.25.0",
      "path": "/home/user/.local/share/lethean-desktop/miners/xmrig",
      "miner_binary": "xmrig"
    }
  ]
}

Miners

List Running Miners

GET /api/v1/mining/miners

Returns all currently running miner instances.

Response:

[
  {
    "name": "xmrig-123",
    "running": true,
    "full_stats": { ... }
  }
]

List Available Miners

GET /api/v1/mining/miners/available

Returns miners that can be installed.

Response:

[
  {
    "name": "xmrig",
    "description": "XMRig CPU/GPU miner"
  },
  {
    "name": "tt-miner",
    "description": "TT-Miner NVIDIA GPU miner"
  }
]

Stop a Miner

DELETE /api/v1/mining/miners/{miner_name}

Stops a running miner instance.

Parameters:

  • miner_name (path) - Name of the miner instance (e.g., "xmrig-123")

Response:

{"message": "Miner stopped"}

Get Miner Stats

GET /api/v1/mining/miners/{miner_name}/stats

Returns performance metrics for a specific miner.

Response:

{
  "hashrate": 1234,
  "shares": 42,
  "rejected": 1,
  "uptime": 3600,
  "algorithm": "rx/0",
  "avgDifficulty": 100000,
  "diffCurrent": 100000
}

Get Miner Logs

GET /api/v1/mining/miners/{miner_name}/logs

Returns base64-encoded log lines.

Response:

[
  "W1hNUmlnXSBzcGVlZCAxMHMvNjBzLzE1bQ==",
  "W1hNUmlnXSBhY2NlcHRlZA=="
]

Send Stdin Command

POST /api/v1/mining/miners/{miner_name}/stdin

Sends input to the miner's stdin.

Request:

{"input": "h"}

Response:

{"status": "sent", "input": "h"}

Get Hashrate History

GET /api/v1/mining/miners/{miner_name}/hashrate-history

Returns in-memory hashrate history (last 5 minutes).

Response:

[
  {"timestamp": "2024-01-15T10:30:00Z", "hashrate": 1234},
  {"timestamp": "2024-01-15T10:30:10Z", "hashrate": 1256}
]

Installation

Install Miner

POST /api/v1/mining/miners/{miner_type}/install

Downloads and installs a miner.

Parameters:

  • miner_type (path) - Type of miner ("xmrig" or "tt-miner")

Response:

{"message": "Miner installed successfully"}

Uninstall Miner

DELETE /api/v1/mining/miners/{miner_type}/uninstall

Removes an installed miner.

Response:

{"message": "Miner uninstalled"}

Profiles

List Profiles

GET /api/v1/mining/profiles

Returns all saved mining profiles.

Response:

[
  {
    "id": "abc123",
    "name": "My Profile",
    "minerType": "xmrig",
    "config": {
      "pool": "pool.example.com:3333",
      "wallet": "4xxx..."
    }
  }
]

Create Profile

POST /api/v1/mining/profiles

Creates a new mining profile.

Request:

{
  "name": "My Profile",
  "minerType": "xmrig",
  "config": {
    "pool": "pool.example.com:3333",
    "wallet": "4xxx...",
    "tls": true
  }
}

Response:

{
  "id": "abc123",
  "name": "My Profile",
  ...
}

Update Profile

PUT /api/v1/mining/profiles/{id}

Updates an existing profile.

Delete Profile

DELETE /api/v1/mining/profiles/{id}

Removes a profile.

Start Miner from Profile

POST /api/v1/mining/profiles/{id}/start

Starts a miner using the profile configuration.

Response:

{
  "name": "xmrig-456",
  "message": "Miner started"
}

Historical Data

Get All Miners History

GET /api/v1/mining/history/miners?since={timestamp}&until={timestamp}

Parameters:

  • since (query) - Start time (ISO 8601)
  • until (query) - End time (ISO 8601)

Get Miner Historical Stats

GET /api/v1/mining/history/miners/{miner_name}?since={timestamp}

Get Miner Historical Hashrate

GET /api/v1/mining/history/miners/{miner_name}/hashrate?since={timestamp}&until={timestamp}

Response:

[
  {"timestamp": "2024-01-15T10:30:00Z", "hashrate": 1234},
  {"timestamp": "2024-01-15T10:31:00Z", "hashrate": 1256}
]

P2P / Nodes

Get Node Info

GET /api/v1/mining/node/info

Returns local node identity.

List Peers

GET /api/v1/mining/peers

Add Peer

POST /api/v1/mining/peers

Request:

{
  "name": "rig-alpha",
  "address": "192.168.1.100:9091"
}

Remove Peer

DELETE /api/v1/mining/peers/{id}

Ping Peer

POST /api/v1/mining/peers/{id}/ping

Remote Operations

Get All Remote Stats

GET /api/v1/mining/remote/stats

Get Peer Stats

GET /api/v1/mining/remote/{peerId}/stats

Start Remote Miner

POST /api/v1/mining/remote/{peerId}/start

Request:

{"profileId": "abc123"}

Stop Remote Miner

POST /api/v1/mining/remote/{peerId}/stop

Request:

{"minerName": "xmrig-123"}

Get Remote Logs

GET /api/v1/mining/remote/{peerId}/logs/{minerName}