# Bitcoin Mining API
> Live Bitcoin mining and hashrate analytics, built on the open mempool.space dataset — the mining layer, not address or mempool data: the mining-pool dominance ranking by share of blocks mined over a period, the current network hashrate and difficulty plus their history, the history of difficulty adjustments with each retarget's percentage change, and block-reward economics over the last N blocks (total and average reward, fees and transactions).

## Authentication
All requests require your oanor API key in the `x-oanor-key` header. Get one at https://www.oanor.com/developer/keys.

```bash
curl -H "x-oanor-key: oanor_live_…" "https://api.oanor.com/mining-api/..."
```

## Pricing
- **Free** (Free) — 10,000 calls/Mo, 3 req/s
- **Basic** ($8/Mo) — 144,000 calls/Mo, 8 req/s
- **Pro** ($24/Mo) — 905,000 calls/Mo, 15 req/s
- **Scale** ($57/Mo) — 4,750,000 calls/Mo, 30 req/s

## Endpoints

### Pools

#### `GET /v1/pools` — Mining-pool dominance ranking over a period

**Parameters:**
- `period` (query, optional, string) — Period: 24h, 3d, 1w, 1m, 3m, 6m, 1y, 2y, 3y, all Example: `1w`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/mining-api/v1/pools?period=1w"
```

**Response:**
```json
{
    "data": {
        "pools": [
            {
                "name": "Foundry USA",
                "rank": 1,
                "slug": "foundryusa",
                "share_pct": 24.66,
                "blocks_mined": 218,
                "empty_blocks": 0,
                "avg_match_rate": 99.48
            },
            {
                "name": "AntPool",
                "rank": 2,
                "slug": "antpool",
                "share_pct": 17.99,
                "blocks_mined": 159,
                "empty_blocks": 0,
                "avg_match_rate": 98.64
            },
            {
                "name": "F2Pool",
                "rank": 3,
                "slug": "f2pool",
                "share_pct": 12.1,
                "blocks_mined": 107,
                "empty_blocks": 0,
                "avg_match_rate": 99.64
            },
            {
                "name": "ViaBTC",
                "rank": 4,
                "slug": "viabtc",
                "share_pct": 9.84,
                "blocks_mined": 87,
                "empty_blocks": 0,
                "avg_match_rate": 99.73
            },
            {
                "name": "SpiderPool",
                "rank": 5,
                "slug": "spiderpool",
                "share_pct": 9.5,
                "blocks_mined": 84,
                "empty_blocks": 0,
                "avg_match_rate": 99.12
            },
            {
                "name": "MARA Pool",
                "rank": 6,
              
…(truncated, see openapi.json for full schema)
```

### Hashrate

#### `GET /v1/hashrate` — Current network hashrate and difficulty plus history

**Parameters:**
- `period` (query, optional, string) — Period: 1m, 3m, 6m, 1y, 2y, 3y, all Example: `1m`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/mining-api/v1/hashrate?period=1m"
```

**Response:**
```json
{
    "data": {
        "period": "1m",
        "points": 31,
        "source": "mempool.space",
        "hashrate_history": [
            {
                "date": "2026-05-11T00:00:00.000Z",
                "hashrate_ehs": 993.9411
            },
            {
                "date": "2026-05-12T00:00:00.000Z",
                "hashrate_ehs": 1107.9023
            },
            {
                "date": "2026-05-13T00:00:00.000Z",
                "hashrate_ehs": 864.9438
            },
            {
                "date": "2026-05-14T00:00:00.000Z",
                "hashrate_ehs": 916.314
            },
            {
                "date": "2026-05-15T00:00:00.000Z",
                "hashrate_ehs": 987.446
            },
            {
                "date": "2026-05-16T00:00:00.000Z",
                "hashrate_ehs": 968.6996
            },
            {
                "date": "2026-05-17T00:00:00.000Z",
                "hashrate_ehs": 1029.7729
            },
            {
                "date": "2026-05-18T00:00:00.000Z",
                "hashrate_ehs": 960.3486
            },
            {
                "date": "2026-05-19T00:00:00.000Z",
                "hashrate_ehs": 936.4806
            },
            {
                "date": "2026-05-20T00:00:00.000Z",
                "hashrate_ehs": 962.9338
            },
            {
                "date": "2026-05-21T00:00:00.000Z",
                "hashrate_ehs": 1042.2743
            },
            {
                
…(truncated, see openapi.json for full schema)
```

### Difficulty

#### `GET /v1/difficulty` — History of difficulty adjustments with change percent

**Parameters:**
- `period` (query, optional, string) — Period: 1m, 3m, 6m, 1y, 2y, 3y, all Example: `3m`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/mining-api/v1/difficulty?period=3m"
```

**Response:**
```json
{
    "data": {
        "count": 6,
        "period": "3m",
        "source": "mempool.space",
        "adjustments": [
            {
                "date": "2026-05-29T10:29:46.000Z",
                "height": 951552,
                "change_pct": 1.719,
                "difficulty_t": 138.9554
            },
            {
                "date": "2026-05-15T16:01:24.000Z",
                "height": 949536,
                "change_pct": 3.121,
                "difficulty_t": 136.6071
            },
            {
                "date": "2026-05-02T02:06:45.000Z",
                "height": 947520,
                "change_pct": -2.3031,
                "difficulty_t": 132.472
            },
            {
                "date": "2026-04-17T17:55:37.000Z",
                "height": 945504,
                "change_pct": -2.4265,
                "difficulty_t": 135.5949
            },
            {
                "date": "2026-04-03T09:28:40.000Z",
                "height": 943488,
                "change_pct": 3.867,
                "difficulty_t": 138.9669
            },
            {
                "date": "2026-03-20T21:54:19.000Z",
                "height": 941472,
                "change_pct": -7.7557,
                "difficulty_t": 133.7931
            }
        ]
    },
    "meta": {
        "timestamp": "2026-06-10T14:01:29.355Z",
        "request_id": "845d60d4-075a-4073-bf54-4839f5cdbd2a"
    },
    "status": "ok",
    "message": "Difficulty retrieved successfully"
…(truncated, see openapi.json for full schema)
```

### Rewards

#### `GET /v1/rewards` — Block-reward economics over the last N blocks

**Parameters:**
- `blocks` (query, optional, string) — Number of recent blocks (1-1000) Example: `144`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/mining-api/v1/rewards?blocks=144"
```

**Response:**
```json
{
    "data": {
        "blocks": 144,
        "source": "mempool.space",
        "total_tx": 666658,
        "end_block": 953111,
        "avg_fee_btc": 0.02290523,
        "start_block": 952968,
        "fee_share_pct": 0.7276,
        "total_fee_btc": 3.29835244,
        "avg_reward_btc": 3.14790523,
        "total_reward_btc": 453.29835244
    },
    "meta": {
        "timestamp": "2026-06-10T14:01:29.847Z",
        "request_id": "ad616be4-b07c-40c2-b497-52dcd119a999"
    },
    "status": "ok",
    "message": "Rewards retrieved successfully",
    "success": true
}
```

### Meta

#### `GET /v1/meta` — Service metadata and endpoint catalog

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/mining-api/v1/meta"
```

**Response:**
```json
{
    "data": {
        "source": "mempool.space mining API (live)",
        "service": "mining-api",
        "endpoints": {
            "GET /v1/meta": "This document.",
            "GET /v1/pools": "Mining-pool dominance ranking over a period (period=1w).",
            "GET /v1/rewards": "Block-reward economics over the last N blocks (blocks=144).",
            "GET /v1/hashrate": "Current network hashrate and difficulty plus history (period=1m).",
            "GET /v1/difficulty": "History of difficulty adjustments with change percent (period=3m)."
        },
        "description": "Live Bitcoin mining and hashrate analytics as an API, built on the open mempool.space dataset — the mining layer (who secures Bitcoin and how hard), not address, transaction or mempool data. The pools endpoint ranks mining pools by their share of blocks mined over a period; the hashrate endpoint returns the current network hashrate and difficulty plus history; the difficulty endpoint returns the history of difficulty adjustments with each retarget's change; the rewards endpoint returns block-reward economics over the last N blocks (total and average reward, fees and transactions). Live, no key, nothing stored. Distinct from address/transaction/mempool on-chain APIs and from price feeds — this is Bitcoin's mining economics: pool dominance, hashrate, difficulty and reward stats.",
        "upstream_status": "ok",
        "current_hashrate_ehs": 858.0876
    },
    "meta": {
        "timestamp
…(truncated, see openapi.json for full schema)
```


---
Marketplace page: https://www.oanor.com/api/mining-api
OpenAPI spec: https://www.oanor.com/api/mining-api/openapi.json
