API Documentation

RESTful API endpoints for accessing pool data

Development Notice: The API is currently in development and endpoints may change. Please check back regularly for updates.

Quick Start

Base URL
/api/
Response Format
Content-Type: application/json

Global Statistics

GET
Returns comprehensive global pool statistics including hashrate, miners, and pool performance metrics.
Response Example
{
  "pools": {
    "viceversachain": {
      "name": "Viceversachain",
      "symbol": "VIVE",
      "algorithm": "sha256",
      "hashrate": 1234567890,
      "miners": 42,
      "workers": 156,
      ...
    }
  }
}
GET
Returns detailed information about all blocks found by the pool, including pending, confirmed, and orphaned blocks.
Response Example
{
  "pending": [...],
  "confirmed": [...],
  "orphaned": [...]
}
GET
Server-Sent Events (SSE) endpoint providing real-time updates of pool statistics. Automatically pushes updates when stats change.
Usage Example
const source = new EventSource('/api/live_stats');
source.onmessage = function(event) {
    const stats = JSON.parse(event.data);
    console.log(stats);
};

Historical Data

GET
Returns historical pool statistics over time, useful for generating charts and analyzing trends.
Response Example
{
  "stats": [
    {
      "time": 1634567890,
      "hashrate": 1234567890,
      "miners": 42,
      "difficulty": 123.456
    },
    ...
  ]
}
GET
Returns complete payment history for all pools, including transaction IDs, amounts, and recipient information.
Response Example
{
  "payments": [
    {
      "time": 1634567890,
      "txid": "abc123...",
      "amount": 1.23456789,
      "miners": 42
    },
    ...
  ]
}

Worker & Miner Statistics

GET
/api/worker_stats
Returns detailed statistics for a specific worker/miner address across all pools.
addr Required - Miner's wallet address
Example Request
/api/worker_stats?addr=bs1q8dnz4q52czdusl8hy04fw3jryj2kc3earck3y2
Response Example
{
  "address": "bs1q8dnz4q52czdusl8hy04fw3jryj2kc3earck3y2",
  "stats": {
    "hashrate": 987654321,
    "shares": 1234,
    "invalidShares": 5,
    "workers": ["worker1", "worker2"],
    ...
  }
}

Integration Examples

JavaScript / Fetch API
fetch('/api/stats')
  .then(response => response.json())
  .then(data => {
    console.log('Pool stats:', data);
  })
  .catch(error => {
    console.error('Error:', error);
  });
Python / Requests
import requests

response = requests.get('/api/stats')
data = response.json()
print(f"Pool stats: {data}")
cURL
curl -X GET "/api/stats" \
  -H "Accept: application/json"
Live Stats (SSE)
const eventSource = new EventSource('/api/live_stats');

eventSource.onmessage = (event) => {
  const stats = JSON.parse(event.data);
  updateUI(stats);
};

eventSource.onerror = (error) => {
  console.error('SSE Error:', error);
  eventSource.close();
};