# Bitcoin Mempool Analytics API - Real-time Fees + Whale Txs (`gochujang/bitcoin-mempool-analytics`) Actor

Real-time Bitcoin mempool snapshot: recommended fees (sat/vB), whale transactions (≥ 10 BTC), recent block stats, hash rate (EH/s), difficulty adjustment. Powered by mempool.space. No API key required.

- **URL**: https://apify.com/gochujang/bitcoin-mempool-analytics.md
- **Developed by:** [Hojun Lee](https://apify.com/gochujang) (community)
- **Categories:** Developer tools, Automation, News
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, NaN bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per usage

This Actor is paid per platform usage. The Actor is free to use, and you only pay for the Apify platform usage, which gets cheaper the higher subscription plan you have.

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

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
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.md):

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

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.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/platform/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

## Bitcoin Mempool Analytics

> Real-time **Bitcoin mempool** snapshot: recommended fees, pending whale transactions, recent blocks, hash rate, difficulty adjustment. Powered by mempool.space. No API key required.

---

### What It Does

Captures a full snapshot of the Bitcoin network state in one call:

- **Recommended fees** at 4 tiers (fastest / 30-min / 1h / economy / minimum) in sat/vB
- **Mempool stats**: pending tx count, total vsize, total fees, "blocks to clear" estimate
- **Recent N blocks**: height, hash, tx count, size, avg fee
- **Hash rate** (current EH/s) + **difficulty adjustment** (next % change, ETA)
- **Whale transactions** in mempool (configurable BTC threshold)

Optional Telegram alert when fees spike above your threshold.

---

### Why This Matters

- **Fee timing** — know exactly when to broadcast a tx (economy 1 sat/vB? fastest 50 sat/vB?)
- **Whale activity** — large pending BTC transfers (often > 100 BTC) are leading indicators of OTC flow / CEX deposits
- **Difficulty adjustment** — anticipated hash rate / mining economics changes
- **Mining health** — hash rate trend reveals miner capitulation or expansion

This Actor turns the firehose at mempool.space into a clean dataset for your trading bot, fee optimizer, or alert pipeline.

---

### Input

| Field | Type | Default | Description |
|-------|------|---------|-------------|
| `includeWhaleTransactions` | boolean | `true` | Scan recent mempool for whale txs |
| `minWhaleBtc` | number | `10` | Min BTC for whale flag |
| `blocksLookback` | integer | `10` | Recent blocks to fetch stats for |
| `alertFeeSatVb` | integer | `0` | Alert when fastest fee ≥ this. 0 = disabled |
| `telegramBotToken` | string (secret) | — | Bot token for alerts |
| `telegramChatId` | string | — | Chat ID for alerts |

#### Example: Cheap-fee window alert
```json
{
  "includeWhaleTransactions": false,
  "alertFeeSatVb": 5,
  "telegramBotToken": "<token>",
  "telegramChatId": "<chat>"
}
````

#### Example: Whale-tx scan only

```json
{
  "includeWhaleTransactions": true,
  "minWhaleBtc": 50,
  "blocksLookback": 1
}
```

***

### Output

Two record types:

**Snapshot** (`_type: "mempool_snapshot"`):

```json
{
  "_type": "mempool_snapshot",
  "timestamp": "2026-06-03T01:35:00+00:00",
  "fastest_fee_sat_vb": 2,
  "half_hour_fee_sat_vb": 1,
  "hour_fee_sat_vb": 1,
  "economy_fee_sat_vb": 1,
  "minimum_fee_sat_vb": 1,
  "mempool_tx_count": 75069,
  "mempool_vsize_bytes": 28560123,
  "blocks_to_clear": 28.56,
  "latest_block_height": 952168,
  "latest_block_hash": "00000000000000000002a7f...",
  "current_hashrate_ehs": 720.45,
  "next_difficulty_change_pct": 1.85,
  "next_difficulty_eta_seconds": 432000
}
```

**Whale TX** (`_type: "whale_tx"`):

```json
{
  "_type": "whale_tx",
  "txid": "f2c9...",
  "value_btc": 152.4,
  "fee_sat": 4500,
  "vsize_bytes": 250,
  "fee_rate_sat_vb": 18.0,
  "mempool_url": "https://mempool.space/tx/f2c9..."
}
```

***

### Pricing

- **$0.002 per snapshot returned** (includes whale txs in the same charge)

***

### Use Cases

**Fee optimizer** — Broadcast txs only when fastest ≤ 3 sat/vB:

```bash
curl -X POST "https://api.apify.com/v2/acts/gochujang~bitcoin-mempool-analytics/runs?token=YOUR_TOKEN" \
  -d '{"includeWhaleTransactions": false}'
```

**Whale alert bot** — Notify on every > 100 BTC pending tx + fee threshold.

***

### Data Source

[mempool.space](https://mempool.space) — the canonical public Bitcoin mempool explorer. Free, no auth, no rate limits at single-actor scale.

***

### Related Actors

- **[Smart Money Wallet Tracker](https://apify.com/gochujang/smart-money-tracker)** — On-chain whale activity across EVM + Solana.
- **[Crypto ETF Flow Tracker](https://apify.com/gochujang/crypto-etf-flow-tracker)** — Institutional BTC ETF inflow/outflow.
- **[CEX Funding Rate Aggregator](https://apify.com/gochujang/cex-funding-aggregator)** — Perp funding context across exchanges.

***

### Feedback

[Leave a review on Apify Store](https://apify.com/gochujang/bitcoin-mempool-analytics#reviews)

# Actor input Schema

## `includeWhaleTransactions` (type: `boolean`):

Scan recent mempool for large transactions (>= minWhaleBtc) and emit them as separate rows.

## `minWhaleBtc` (type: `number`):

Threshold for flagging a transaction as a whale tx (in BTC). Default 10 BTC.

## `blocksLookback` (type: `integer`):

How many recent blocks to fetch stats for.

## `includeFeeHistory24h` (type: `boolean`):

Add a fee\_history\_24h field with per-block median/avg fee rates over the last 24h (~144 blocks).

## `alertFeeSatVb` (type: `integer`):

Alert when fastest fee >= this sat/vB. 0 = disabled.

## `telegramBotToken` (type: `string`):

Telegram bot token for alerts.

## `telegramChatId` (type: `string`):

Chat ID to receive alerts.

## Actor input object example

```json
{
  "includeWhaleTransactions": true,
  "minWhaleBtc": 10,
  "blocksLookback": 10,
  "includeFeeHistory24h": false,
  "alertFeeSatVb": 0,
  "telegramChatId": ""
}
```

# 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 = {};

// Run the Actor and wait for it to finish
const run = await client.actor("gochujang/bitcoin-mempool-analytics").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 = {}

# Run the Actor and wait for it to finish
run = client.actor("gochujang/bitcoin-mempool-analytics").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 '{}' |
apify call gochujang/bitcoin-mempool-analytics --silent --output-dataset

```

## MCP server setup

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

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Bitcoin Mempool Analytics API - Real-time Fees + Whale Txs",
        "description": "Real-time Bitcoin mempool snapshot: recommended fees (sat/vB), whale transactions (≥ 10 BTC), recent block stats, hash rate (EH/s), difficulty adjustment. Powered by mempool.space. No API key required.",
        "version": "0.1",
        "x-build-id": "cNr9DkcHNM3Aehplz"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/gochujang~bitcoin-mempool-analytics/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-gochujang-bitcoin-mempool-analytics",
                "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/gochujang~bitcoin-mempool-analytics/runs": {
            "post": {
                "operationId": "runs-sync-gochujang-bitcoin-mempool-analytics",
                "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/gochujang~bitcoin-mempool-analytics/run-sync": {
            "post": {
                "operationId": "run-sync-gochujang-bitcoin-mempool-analytics",
                "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",
                "properties": {
                    "includeWhaleTransactions": {
                        "title": "Include Whale Transactions",
                        "type": "boolean",
                        "description": "Scan recent mempool for large transactions (>= minWhaleBtc) and emit them as separate rows.",
                        "default": true
                    },
                    "minWhaleBtc": {
                        "title": "Min Whale BTC",
                        "minimum": 0.1,
                        "type": "number",
                        "description": "Threshold for flagging a transaction as a whale tx (in BTC). Default 10 BTC.",
                        "default": 10
                    },
                    "blocksLookback": {
                        "title": "Recent Blocks Lookback",
                        "minimum": 1,
                        "maximum": 50,
                        "type": "integer",
                        "description": "How many recent blocks to fetch stats for.",
                        "default": 10
                    },
                    "includeFeeHistory24h": {
                        "title": "Include 24h Fee History",
                        "type": "boolean",
                        "description": "Add a fee_history_24h field with per-block median/avg fee rates over the last 24h (~144 blocks).",
                        "default": false
                    },
                    "alertFeeSatVb": {
                        "title": "Telegram Alert: Fee Threshold (sat/vB)",
                        "minimum": 0,
                        "type": "integer",
                        "description": "Alert when fastest fee >= this sat/vB. 0 = disabled.",
                        "default": 0
                    },
                    "telegramBotToken": {
                        "title": "Telegram Bot Token",
                        "type": "string",
                        "description": "Telegram bot token for alerts."
                    },
                    "telegramChatId": {
                        "title": "Telegram Chat ID",
                        "type": "string",
                        "description": "Chat ID to receive alerts.",
                        "default": ""
                    }
                }
            },
            "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
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
