# Mempool Scraper (`crawlerbros/mempool-scraper`) Actor

Scrape Bitcoin blockchain data from Mempool.space - address balances, transactions, block details, mempool statistics, mining hashrate, fee estimates, and historical BTC price. No API key required.

- **URL**: https://apify.com/crawlerbros/mempool-scraper.md
- **Developed by:** [Crawler Bros](https://apify.com/crawlerbros) (community)
- **Categories:** Automation, Lead generation, Developer tools
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $3.00 / 1,000 results

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
The best way to integrate Actors is as follows.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js/docs.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python/docs.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/integrations/mcp.md).

If your project is in a different language, use the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).


# README

## Mempool.space Bitcoin Blockchain Scraper

Extract Bitcoin blockchain data from [Mempool.space](https://mempool.space) — the leading open-source Bitcoin explorer. No API key or authentication required. Retrieve address balances, full transaction histories, block details, real-time mempool statistics, mining hashrate, fee estimates, and historical BTC price data.

### What can this scraper do?

- **Address balance & stats** — confirmed balance, transaction count, funded/spent satoshis, unconfirmed mempool activity
- **Transaction history** — paginated list of all transactions for any Bitcoin address (legacy, P2SH, Bech32)
- **Transaction details** — inputs, outputs, fees, size, weight, confirmation status for any txid
- **Block details** — full metadata for any block by hash or height: timestamp, tx count, size, weight, miner pool, fees, difficulty
- **Recent blocks** — live feed of the most recently mined Bitcoin blocks
- **Mempool statistics** — current mempool size, vsize, fee histogram, and all fee tiers (fastest, half-hour, hour, economy, minimum)
- **Mining stats** — hashrate history over configurable intervals + next difficulty adjustment estimate
- **Historical BTC price** — full daily price series in USD, EUR, GBP, CAD, CHF, AUD, or JPY

### Input

| Field | Type | Description |
|---|---|---|
| `mode` | select | What to fetch. See modes below. |
| `addresses` | string[] | Bitcoin addresses (modes: `addressInfo`, `addressTransactions`) |
| `txids` | string[] | Transaction IDs — 64-char hex (mode: `transactionInfo`) |
| `blockIdentifiers` | string[] | Block hashes or heights (mode: `blockInfo`) |
| `currency` | select | Fiat currency for price history: USD, EUR, GBP, CAD, CHF, AUD, JPY |
| `hashrateInterval` | select | Hashrate history window: 1m, 3m, 6m, 1y, 2y, 3y, all |
| `maxItems` | integer | Max records to emit (1–500, default 50) |

#### Modes

| Mode | Description | Required input |
|---|---|---|
| `mempoolStats` | Mempool state + fee estimates | None |
| `addressInfo` | Address balance and chain stats | `addresses` |
| `addressTransactions` | Full transaction history for addresses | `addresses` |
| `transactionInfo` | Transaction details by txid | `txids` |
| `blockInfo` | Block metadata by hash or height | `blockIdentifiers` |
| `recentBlocks` | List of recently mined blocks | None |
| `miningStats` | Hashrate history + difficulty adjustment | None |
| `priceHistory` | Historical daily BTC price | None |

### Output

Output schema varies by mode. All records include a `scrapedAt` ISO timestamp.

#### mempoolStats

```json
{
  "count": 12453,
  "vsize": 8241563,
  "totalFeesSats": 18394210,
  "fastestFeeSatPerVbyte": 45,
  "halfHourFeeSatPerVbyte": 32,
  "hourFeeSatPerVbyte": 25,
  "economyFeeSatPerVbyte": 12,
  "minimumFeeSatPerVbyte": 1,
  "scrapedAt": "2024-11-01T12:00:00+00:00"
}
````

#### addressInfo

```json
{
  "address": "bc1qxy2kgdygjrsqtzq2n0yrf2493p83kkfjhx0wlh",
  "balanceSats": 2108034,
  "balanceBtc": 0.02108034,
  "fundedSats": 125000000,
  "spentSats": 122891966,
  "txCount": 482,
  "fundedTxoCount": 95,
  "spentTxoCount": 89,
  "scrapedAt": "2024-11-01T12:00:00+00:00"
}
```

#### transactionInfo / addressTransactions

```json
{
  "txid": "4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b",
  "confirmed": true,
  "blockHeight": 170,
  "blockTime": "2009-01-12T03:30:25+00:00",
  "inputCount": 1,
  "outputCount": 2,
  "valueOutSats": 5000000000,
  "valueOutBtc": 50.0,
  "feeSats": 0,
  "weight": 748,
  "scrapedAt": "2024-11-01T12:00:00+00:00"
}
```

#### blockInfo / recentBlocks

```json
{
  "blockHash": "000000000000000000041db24e9a4d2bfbc0b6dea7e3a4ce7a1a1e9b7c2e1f3",
  "height": 860000,
  "timestamp": "2024-10-28T14:23:11+00:00",
  "txCount": 3121,
  "size": 1523889,
  "weight": 3993572,
  "difficulty": 95672703580713.0,
  "extras": {
    "rewardBtc": 3.125,
    "totalFeesBtc": 0.08241983,
    "poolName": "Foundry USA",
    "medianFee": 8,
    "avgFeeRate": 12
  },
  "scrapedAt": "2024-11-01T12:00:00+00:00"
}
```

#### miningStats

```json
{
  "currentHashrateThPerSecond": 6.82e+20,
  "currentDifficulty": 95672703580713.0,
  "difficultyChange": 3.51,
  "estimatedRetargetDate": "2024-11-09T08:00:00+00:00",
  "remainingBlocks": 1203,
  "nextRetargetHeight": 861120,
  "scrapedAt": "2024-11-01T12:00:00+00:00"
}
```

#### priceHistory

```json
{
  "timestamp": "2024-11-01T00:00:00+00:00",
  "currency": "USD",
  "price": 69420.0,
  "scrapedAt": "2024-11-01T12:00:00+00:00"
}
```

### Frequently Asked Questions

**Does this require an API key or account?**
No. Mempool.space provides a fully public REST API with no authentication required.

**Does this work for testnet?**
This actor targets mainnet (`mempool.space`). Testnet support is not included.

**How far back does the price history go?**
The Mempool.space historical price endpoint covers Bitcoin's full history since 2010.

**What Bitcoin address formats are supported?**
Legacy (P2PKH, starting with `1`), P2SH (starting with `3`), Bech32 (native SegWit, starting with `bc1q`), and Bech32m (Taproot, starting with `bc1p`).

**How are large transaction histories handled?**
The actor paginates automatically using the `after_txid` cursor so all transactions are retrieved regardless of count (up to `maxItems`).

**What is the `mempoolStats` mode useful for?**
Real-time fee estimation for Bitcoin transactions. Useful for wallets, exchanges, and analytics dashboards.

**Is historical price data available for all currencies?**
Yes — USD, EUR, GBP, CAD, CHF, AUD, and JPY are supported.

### Data Source

Data is sourced from the public [Mempool.space API](https://mempool.space/docs/api/rest) — an open-source Bitcoin explorer and mempool visualizer maintained by the Bitcoin community.

# Actor input Schema

## `mode` (type: `string`):

What data to fetch from Mempool.space.

## `addresses` (type: `array`):

Bitcoin addresses to look up (modes: addressInfo, addressTransactions). Supports legacy (1...), P2SH (3...), and Bech32 (bc1...) formats.

## `txids` (type: `array`):

Bitcoin transaction IDs (txids) to look up (mode: transactionInfo). Each must be a 64-character hex string.

## `blockIdentifiers` (type: `array`):

Block hashes (64-character hex) or block heights (integers) to look up (mode: blockInfo). Mix of hashes and heights is supported.

## `currency` (type: `string`):

Fiat currency for historical Bitcoin price data.

## `hashrateInterval` (type: `string`):

Time window for hashrate history.

## `maxItems` (type: `integer`):

Hard cap on the number of records emitted. Applies to modes that return multiple records.

## Actor input object example

```json
{
  "mode": "mempoolStats",
  "addresses": [],
  "txids": [],
  "blockIdentifiers": [],
  "currency": "USD",
  "hashrateInterval": "1y",
  "maxItems": 50
}
```

# Actor output Schema

## `results` (type: `string`):

Dataset containing all scraped records. Schema varies by mode.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "mode": "mempoolStats",
    "addresses": [],
    "txids": [],
    "blockIdentifiers": [],
    "currency": "USD",
    "hashrateInterval": "1y",
    "maxItems": 50
};

// Run the Actor and wait for it to finish
const run = await client.actor("crawlerbros/mempool-scraper").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "mode": "mempoolStats",
    "addresses": [],
    "txids": [],
    "blockIdentifiers": [],
    "currency": "USD",
    "hashrateInterval": "1y",
    "maxItems": 50,
}

# Run the Actor and wait for it to finish
run = client.actor("crawlerbros/mempool-scraper").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "mode": "mempoolStats",
  "addresses": [],
  "txids": [],
  "blockIdentifiers": [],
  "currency": "USD",
  "hashrateInterval": "1y",
  "maxItems": 50
}' |
apify call crawlerbros/mempool-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=crawlerbros/mempool-scraper",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Mempool Scraper",
        "description": "Scrape Bitcoin blockchain data from Mempool.space - address balances, transactions, block details, mempool statistics, mining hashrate, fee estimates, and historical BTC price. No API key required.",
        "version": "1.0",
        "x-build-id": "i3htNORz3cCM6duj7"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/crawlerbros~mempool-scraper/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-crawlerbros-mempool-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/crawlerbros~mempool-scraper/runs": {
            "post": {
                "operationId": "runs-sync-crawlerbros-mempool-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/crawlerbros~mempool-scraper/run-sync": {
            "post": {
                "operationId": "run-sync-crawlerbros-mempool-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "required": [
                    "mode"
                ],
                "properties": {
                    "mode": {
                        "title": "Mode",
                        "enum": [
                            "mempoolStats",
                            "addressInfo",
                            "addressTransactions",
                            "transactionInfo",
                            "blockInfo",
                            "recentBlocks",
                            "miningStats",
                            "priceHistory"
                        ],
                        "type": "string",
                        "description": "What data to fetch from Mempool.space.",
                        "default": "mempoolStats"
                    },
                    "addresses": {
                        "title": "Bitcoin addresses",
                        "type": "array",
                        "description": "Bitcoin addresses to look up (modes: addressInfo, addressTransactions). Supports legacy (1...), P2SH (3...), and Bech32 (bc1...) formats.",
                        "default": [],
                        "items": {
                            "type": "string"
                        }
                    },
                    "txids": {
                        "title": "Transaction IDs",
                        "type": "array",
                        "description": "Bitcoin transaction IDs (txids) to look up (mode: transactionInfo). Each must be a 64-character hex string.",
                        "default": [],
                        "items": {
                            "type": "string"
                        }
                    },
                    "blockIdentifiers": {
                        "title": "Block identifiers",
                        "type": "array",
                        "description": "Block hashes (64-character hex) or block heights (integers) to look up (mode: blockInfo). Mix of hashes and heights is supported.",
                        "default": [],
                        "items": {
                            "type": "string"
                        }
                    },
                    "currency": {
                        "title": "Currency (mode: priceHistory)",
                        "enum": [
                            "USD",
                            "EUR",
                            "GBP",
                            "CAD",
                            "CHF",
                            "AUD",
                            "JPY"
                        ],
                        "type": "string",
                        "description": "Fiat currency for historical Bitcoin price data.",
                        "default": "USD"
                    },
                    "hashrateInterval": {
                        "title": "Hashrate interval (mode: miningStats)",
                        "enum": [
                            "1m",
                            "3m",
                            "6m",
                            "1y",
                            "2y",
                            "3y",
                            "all"
                        ],
                        "type": "string",
                        "description": "Time window for hashrate history.",
                        "default": "1y"
                    },
                    "maxItems": {
                        "title": "Max items",
                        "minimum": 1,
                        "maximum": 500,
                        "type": "integer",
                        "description": "Hard cap on the number of records emitted. Applies to modes that return multiple records.",
                        "default": 50
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
