{
  "openapi": "3.1.0",
  "info": {
    "title": "ArkPool Public Statistics",
    "version": "1.0.0",
    "description": "Read-only operator-reported aggregates for a mainnet alpha. No wallet, miner lookup, enrollment or payment operations. Rates and backend configuration are private. Numbers are not proof of solvency or guaranteed earnings."
  },
  "servers": [{"url": "https://arkpool.org"}],
  "security": [],
  "paths": {
    "/stats.json": {
      "get": {
        "operationId": "getPublicSnapshot",
        "summary": "Read timestamped pool aggregates and bounded history",
        "description": "No query parameters or credentials. Poll no faster than 300 seconds. Use measured_at as the window endpoint; null means unknown. Reject unknown schemas, timestamps over one minute in the future, and data older than fifteen minutes. Accepted upstream shares alone do not prove miner credit or payment. History points are overlapping hourly windows and must not be summed as daily totals.",
        "responses": {
          "200": {"description": "Available snapshot, Cache-Control: no-store", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Snapshot"}}}},
          "400": {"description": "Query parameters are not supported"},
          "405": {"description": "Only GET and HEAD are supported"},
          "503": {"description": "Snapshot unavailable, invalid or stale; do not interpret as zero activity"}
        }
      },
      "head": {"operationId": "checkPublicSnapshot", "summary": "Read availability headers without a body", "responses": {
        "200": {"description": "Snapshot available"}, "400": {"description": "Query parameters unsupported"}, "503": {"description": "Snapshot unavailable"}
      }}
    }
  },
  "components": {"schemas": {
    "Count": {"type": ["integer", "null"], "minimum": 0, "maximum": 9007199254740991},
    "Hashrate": {"type": ["number", "null"], "minimum": 0, "maximum": 9007199254740991, "description": "TH/s estimated from verified work, not device telemetry"},
    "Stats": {
      "type": "object", "additionalProperties": false,
      "required": ["total_paid_sats", "accepted_shares_1h", "hashrate_5m_ths", "hashrate_1h_ths", "active_workers_5m", "active_miners_1h", "upstream_accepted_1h", "upstream_rejected_1h", "last_payout_at"],
      "properties": {
        "total_paid_sats": {"$ref": "#/components/schemas/Count", "description": "All-time confirmed miner payouts in sats"},
        "unpaid_sats": {"type": ["number", "null"], "minimum": 0, "description": "Pool-wide earned sats minus confirmed payouts, including fractional balances and payments in progress. Not the amount eligible at the next settlement. Presentation precision only; not a financial transaction API."},
        "last_payment_sats": {"type": ["integer", "null"], "minimum": 1, "description": "Total confirmed sats for the latest hourly cutoff with confirmed payments. Excludes pending or failed payments."},
        "last_payment_at": {"type": ["string", "null"], "format": "date-time", "description": "Latest recorded confirmation time within that hourly payout round, not its settlement cutoff."},
        "paid_sats_24h": {"type": ["integer", "null"], "minimum": 0, "description": "Confirmed miner payments recorded in the preceding 24 hours ending at measured_at."},
        "accepted_shares_1h": {"$ref": "#/components/schemas/Count", "description": "Verified accounting purchases in the trailing hour; legacy field name, not raw upstream acceptances"},
        "hashrate_5m_ths": {"$ref": "#/components/schemas/Hashrate", "description": "Legacy five-minute estimate; use hashrate_1h_ths for the headline"},
        "hashrate_1h_ths": {"$ref": "#/components/schemas/Hashrate"},
        "active_workers_5m": {"$ref": "#/components/schemas/Count", "description": "Legacy five-minute work activity; not a connection count"},
        "active_miners_1h": {"$ref": "#/components/schemas/Count", "description": "Distinct miners with verified work in the trailing hour"},
        "upstream_accepted_1h": {"$ref": "#/components/schemas/Count"},
        "upstream_rejected_1h": {"$ref": "#/components/schemas/Count"},
        "last_payout_at": {"type": ["string", "null"], "format": "date-time", "description": "Latest confirmed settlement cutoff, not upstream revenue receipt time"}
      }
    },
    "HistoryPoint": {
      "type": "object", "additionalProperties": false,
      "required": ["measured_at", "hashrate_5m_ths", "accepted_shares_1h"],
      "properties": {
        "measured_at": {"type": "string", "format": "date-time"},
        "hashrate_5m_ths": {"type": "number", "minimum": 0, "maximum": 9007199254740991},
        "hashrate_1h_ths": {"type": "number", "minimum": 0, "maximum": 9007199254740991},
        "accepted_shares_1h": {"type": "integer", "minimum": 0, "maximum": 9007199254740991}
      }
    },
    "Snapshot": {
      "type": "object", "additionalProperties": false,
      "required": ["schema_version", "measured_at", "refresh_interval_seconds", "stats", "history"],
      "properties": {
        "schema_version": {"type": "integer", "const": 1},
        "measured_at": {"type": "string", "format": "date-time"},
        "refresh_interval_seconds": {"type": "integer", "const": 300},
        "stats": {"$ref": "#/components/schemas/Stats"},
        "status": {"type":"object","additionalProperties":false,"description":"Periodic operator observations, not availability guarantees. Unknown if check time is missing or over fifteen minutes old.","properties":{
          "checked_at":{"type":["string","null"],"format":"date-time"},
          "mining":{"enum":["active","quiet","unavailable","unknown"]},
          "tor":{"enum":["healthy","unavailable","unknown"]},
          "ark":{"enum":["connected","unavailable","unknown"]},
          "payouts":{"enum":["current","pending","delayed","unknown"]}
        }},
        "history": {"type": "array", "maxItems": 289, "items": {"$ref": "#/components/schemas/HistoryPoint"}},
        "history_source": {"type": "string", "const": "verified_work_ledger"}
      }
    }
  }}
}
