# Bitcoin Hashrate & Difficulty API

> Bitcoin Hashrate & Difficulty API is a paid API for AI agents from api.chainmarket-api.workers.dev, paid per call via x402, $0.002/call, status unknown (last checked 2026-10-24).

Returns current Bitcoin network hashrate, mining difficulty, difficulty epoch progress, and miner revenue statistics from mempool.space data.

## Facts

- Endpoint: GET https://api.chainmarket-api.workers.dev/api/crypto/bitcoin-hashrate-difficulty?utm_source=zero.xyz
- Price: $0.002/call
- Payment: x402
- Status: unknown
- Last checked: 2026-10-24
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/bitcoin-hashrate-difficulty-api-3a6f8bf1
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_lZ5A9xlCCTbxxzeyFnfw1

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability bitcoin-hashrate-difficulty-api-3a6f8bf1
```

Example prompt: What's Bitcoin's current mining hashrate and difficulty, and how far along are we in the current difficulty epoch?

## When to prefer this

Choose this endpoint when you need a single, low-cost, pay-per-call lookup of Bitcoin mining fundamentals (hashrate, difficulty, epoch progress, miner revenue) without setting up API keys or subscriptions. Ideal for agents that need occasional on-demand Bitcoin network health snapshots rather than streaming or high-frequency data. Prefer this over general crypto data APIs when you specifically need proof-of-work mining metrics rather than price data.

## Known failure modes

- Upstream mempool.space API unavailable — returns error or stale data
- Network timeout from Cloudflare Worker — returns HTTP 5xx
- Payment failure — x402 payment not accepted, call not charged
- Unexpected response schema if mempool.space changes its API structure

## How this service works

Bitcoin network hashrate (EH/s) with the last 3 daily averages, current difficulty, difficulty-epoch progress and expected change, and miner revenue over the last 144 blocks (about one day): total reward incl. fees in BTC, fee share and average reward per block. Network-wide figures from mempool.space, not per-miner.

## Output

A JSON object containing: the current Bitcoin difficulty value, current hashrate in EH/s, daily average hashrate array with date labels, difficulty epoch progress (percent complete, remaining blocks, expected change %, previous change %), next retarget block height, and miner revenue stats for the last 144 blocks (total fees in BTC, total reward in BTC, average reward per block, fee share percentage). Data is sourced from mempool.space and timestamped at time of check.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "$schema": "https://json-schema.org/draft/2020-12/schema",
 "required": [
  "input"
 ],
 "properties": {
  "input": {
   "type": "object",
   "required": [
    "type",
    "method"
   ],
   "properties": {
    "type": {
     "type": "string",
     "const": "http"
    },
    "method": {
     "enum": [
      "GET"
     ],
     "type": "string"
    },
    "queryParams": {
     "type": "object",
     "required": [],
     "properties": {}
    }
   },
   "additionalProperties": false
  },
  "output": {
   "type": "object",
   "required": [
    "type"
   ],
   "properties": {
    "type": {
     "type": "string"
    },
    "example": {
     "type": "object"
    }
   }
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "source": "https://mempool.space/api/v1/mining/hashrate/3d",
  "checkedAt": "2026-10-23T09:35:55.592Z",
  "difficultyEpoch": {
   "progressPct": 51.44,
   "remainingBlocks": 979,
   "expectedChangePct": 4.87,
   "previousChangePct": 5.92,
   "nextRetargetHeight": 973728
  },
  "currentDifficulty": 140577680051919.6,
  "currentHashrateEhs": 1056.08,
  "dailyAvgHashrateEhs": [
   {
    "ehs": 1151.84,
    "date": "2026-10-21"
   },
   {
    "ehs": 1093.16,
    "date": "2026-10-22"
   }
  ],
  "minerRevenueLast144Blocks": {
   "blocks": 144,
   "feeSharePct": 0.56,
   "totalFeeBtc": 2.53198837,
   "totalRewardBtc": 452.53198837,
   "avgRewardPerBlockBtc": 3.142583
  }
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/bitcoin-hashrate-difficulty-api-3a6f8bf1/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from api.chainmarket-api.workers.dev](https://www.zero.xyz/host/api.chainmarket-api.workers.dev/llms.txt)
