Skip to content

Latest commit

 

History

History
1848 lines (1125 loc) · 55.8 KB

DOCS.md

File metadata and controls

1848 lines (1125 loc) · 55.8 KB

Table of Contents

bitview_client

BitviewError Objects

class BitviewError(Exception)

A failed request: the HTTP status and the server's error code and message, when it sent them.

SeriesData Objects

@dataclass
class SeriesData(Generic[T])

Always int-indexed; a value is None where it is missing or undefined.

DateSeriesData Objects

@dataclass
class DateSeriesData(SeriesData[T])

SeriesEndpoint Objects

class SeriesEndpoint(Generic[T])

Builder for series endpoint queries with int-based indexing.

Examples: data = endpoint.fetch() data = endpoint[5].fetch() data = endpoint[:10].fetch() data = endpoint.head(20).fetch() data = endpoint.skip(100).take(10).fetch()

DateSeriesEndpoint Objects

class DateSeriesEndpoint(SeriesEndpoint[T])

Builder for series endpoint queries with date-based indexing.

Accepts dates in getitem and returns DateSeriesData from fetch().

Examples: data = endpoint[date(2020, 1, 1)].fetch() data = endpoint[date(2020, 1, 1):date(2023, 1, 1)].fetch()

BitviewClient Objects

class BitviewClient(BitviewClientBase)

A method per API endpoint, and the typed series tree.

VERSION

INDEXES

POOL_SLUG_TO_NAME

TERM_NAMES

HALVING_EPOCH_NAMES

VINTAGE_NAMES

ENTRY_NAMES

SPENDABLE_TYPE_NAMES

AGE_RANGE_NAMES

AMOUNT_RANGE_NAMES

PROFITABILITY_RANGE_NAMES

OP_RETURN_KIND_NAMES

__init__

def __init__(base_url: str = 'http://localhost:3110', timeout: float = 30.0)

series

@cached_property
def series() -> SeriesTree

series_endpoint

def series_endpoint(
        series: str,
        index: Index) -> Union[SeriesEndpoint[Any], DateSeriesEndpoint[Any]]

A series by a name known only at runtime; series has the typed paths.

index_to_date

def index_to_date(index: Index, i: int) -> Union[date, datetime]

The start of bucket i: a UTC datetime for sub-daily indexes, a date otherwise.

date_to_index

def date_to_index(index: Index, d: Union[date, datetime]) -> int

The floor index (latest index whose date is <= the given date).

address_payload_hash_prefix

@staticmethod
def address_payload_hash_prefix(payload: Union[bytes, bytearray, memoryview],
                                nibbles: int) -> str

Compute the RapidHash v3 hash-prefix for raw address payload bytes.

get_address_payload_hash_prefix_matches

def get_address_payload_hash_prefix_matches(
        address_type: AddressOutputType, payload: Union[bytes, bytearray,
                                                        memoryview],
        nibbles: int) -> AddressHashPrefixMatches

Fetch address hash-prefix matches from raw payload bytes matching address_type length.

get_health

def get_health() -> Health

Health check.

Local health and query-readiness check. Returns server identity, uptime, and a coherent local sync snapshot without a bitcoind round-trip. Reads the published prefix during processing; an empty index returns 503 state_updating at once. Responses are not cached. For chain-tip catch-up, request GET /api/server/sync.

Endpoint: GET /health

get_version

def get_version() -> ServerVersion

API version

Endpoint: GET /version

get_sync_status

def get_sync_status() -> SyncStatus

Sync status.

Returns a coherent local index snapshot and a separately observed Bitcoin Core tip height. The two heights can differ during indexing or a reorg. Conditional requests refresh these observations before validation.

Endpoint: GET /api/server/sync

get_logs

def get_logs(after: Optional[str] = None) -> Logs

Logs.

The server's last log lines, at most 1,000, oldest first: requests (status, path and duration; never who made them) and everything else it logs. To read on, send the answer's next back as after: the lines since, each once. A jump in seq shows lines that left memory before the next request; another started_unix_ms shows the server restarted (and its answer has every kept line). Answers are cached for a second.

Endpoint: GET /api/server/logs

get_disk_usage

def get_disk_usage() -> DiskUsage

Disk usage.

Returns allocated file bytes (file lengths on non-Unix platforms) for BRK and Bitcoin data. Each request scans both trees; these are independent observations, not an atomic filesystem snapshot. Conditional requests validate the newly observed totals. Directory-link cycles and excessive nesting fail without returning partial totals.

Endpoint: GET /api/server/disk

get_series_tree

def get_series_tree() -> TreeNode

Series catalog.

The available series as a tree of categories and subcategories.

Endpoint: GET /api/series

get_series_count

def get_series_count() -> DetailedSeriesCount

Series count.

Returns the number of series available per index type.

Endpoint: GET /api/series/count

list_indexes

def list_indexes() -> List[Index]

List available indexes.

Returns every index a series can be read at, by the name series routes take.

Endpoint: GET /api/series/indexes

list_series

def list_series(page: Optional[int] = None,
                per_page: Optional[int] = None) -> PaginatedSeries

Series list.

Paginated flat list of all available series names.

Endpoint: GET /api/series/list

search_series

def search_series(q: str, limit: Optional[int] = None) -> List[SeriesName]

Search series.

Search series by name or descriptive terms. Results prioritize whole query words in names, then descriptions, then fuzzy names, then fuzzy descriptions. Word order does not matter. Descriptions provide cohort terminology and formulas. The decoded q parameter is limited to 1024 UTF-8 bytes.

Endpoint: GET /api/series/search

get_series_info

def get_series_info(series: SeriesName) -> SeriesInfo

Get series info.

Returns the optional description, supported indexes, the indexes whose values can be null, the value type, and the optional unit (what the value type measures) for the specified series. The decoded series name is limited to 1024 UTF-8 bytes.

Endpoint: GET /api/series/{series}

get_series

def get_series(series: SeriesName,
               index: Index,
               start: Optional[RangeIndex] = None,
               end: Optional[RangeIndex] = None,
               limit: Optional[Limit] = None,
               format: Optional[Format] = None) -> Union[AnySeriesData, str]

Get series data.

Rows selected by a range of positions, dates or timestamps, as JSON or CSV.

Endpoint: GET /api/series/{series}/{index}

get_series_data

def get_series_data(series: SeriesName,
                    index: Index,
                    start: Optional[RangeIndex] = None,
                    end: Optional[RangeIndex] = None,
                    limit: Optional[Limit] = None,
                    format: Optional[Format] = None) -> Union[List[Any], str]

Get raw series data.

The data array without the SeriesData wrapper. Supports the same range and format parameters as GET /api/series/{series}/{index}.

Endpoint: GET /api/series/{series}/{index}/data

get_series_latest

def get_series_latest(series: SeriesName, index: Index) -> Any

Get latest series value.

Returns the single most recent value for a series, unwrapped (not inside a SeriesData object).

Endpoint: GET /api/series/{series}/{index}/latest

get_series_len

def get_series_len(series: SeriesName, index: Index) -> int

Get series data length

Endpoint: GET /api/series/{series}/{index}/len

get_series_version

def get_series_version(series: SeriesName, index: Index) -> Version

Get series version.

Returns the vector's schema/computation version, not its length or latest update. Appends and reorgs do not by themselves change this version.

Endpoint: GET /api/series/{series}/{index}/version

get_series_bulk

def get_series_bulk(
        series: SeriesList,
        index: Index,
        start: Optional[RangeIndex] = None,
        end: Optional[RangeIndex] = None,
        limit: Optional[Limit] = None,
        format: Optional[Format] = None) -> Union[List[AnySeriesData], str]

Bulk series data.

Fetch multiple series in a single request. Supports filtering by index and date range. Returns an array of SeriesData objects. For a single series, use get_series instead.

Endpoint: GET /api/series/bulk

list_urpd_cohorts

def list_urpd_cohorts() -> List[UrpdCohort]

Available URPD cohorts.

Every URPD cohort once a UTXO set is published (none before): the age aggregates (all, sth, lth, age_under_4m, ...), then the age bands from the youngest (age_under_1h, age_1h_to_1d, ...).

Endpoint: GET /api/urpd

get_urpd_latest

def get_urpd_latest(cohort: UrpdCohort,
                    agg: Optional[UrpdAggregation] = None,
                    weight: Optional[UrpdWeight] = None) -> Urpd

Latest URPD.

URPD for the latest published block; date echoes the date served. Fields, units, price-grid rounding and weighting as in GET /api/urpd/{cohort}/{point}.

Endpoint: GET /api/urpd/{cohort}

get_urpd

def get_urpd(cohort: UrpdCohort,
             point: HeightOrDate,
             agg: Optional[UrpdAggregation] = None,
             weight: Optional[UrpdWeight] = None) -> Urpd

URPD at block height or date.

URPD for a cohort at a block height or the last block of a UTC day. Returns { height, hash, date, cohort, weight, aggregation, close, supply, buckets } where buckets is columns, { price, supply, realized_cap, unrealized_pnl }, one entry per bucket in ascending price: the same block header and columnar layout as GET /api/utxo-set/{point}. close, price, realized_cap, and unrealized_pnl are USD; supply is BTC. unrealized_pnl can be negative. Bucket realized_cap and unrealized_pnl value each coin at its creation price on the price grid (four significant digits of the price in cents, within 0.05% of the exact price), rounded to the cent per bucket, so the buckets need not sum to the realized cap series. With a wakefulness or mobility weight, supply is the weighted supply (whole satoshis) and the bucket values follow it.

Endpoint: GET /api/urpd/{cohort}/{point}

get_difficulty_adjustment

def get_difficulty_adjustment() -> DifficultyAdjustment

Difficulty adjustment.

Get current difficulty adjustment progress and estimates.

Mempool.space docs

Endpoint: GET /api/v1/difficulty-adjustment

get_prices

def get_prices() -> PricePoint

Current BTC price.

Returns bitcoin latest price (on-chain derived, USD only).

Mempool.space docs

Endpoint: GET /api/v1/prices

get_historical_price

def get_historical_price(
        timestamp: Optional[Timestamp] = None,
        currency: Optional[Currency] = None) -> HistoricalPrice

Historical price.

Completed four-hour BTC/USD closes, newest first as mempool.space lists them, labeled by interval end, from the first priced interval (2010-08-16). With a UNIX timestamp, returns the latest nonempty completed close at or before it; before the first close returns an empty list. The current partial interval is excluded. USD only (currency accepts USD); exchangeRates is empty.

Mempool.space docs

Endpoint: GET /api/v1/historical-price

get_address_hash_prefix_matches

def get_address_hash_prefix_matches(address_type: AddressOutputType,
                                    prefix: str) -> AddressHashPrefixMatches

Address hash-prefix matches.

Find addresses by address type and by the first 1-16 hex nibbles of RapidHash v3 over the raw address payload bytes. Intended for privacy-preserving client-side wallet discovery without sending raw addresses or xpubs. Fetch metadata with GET /api/address/{address}.

Endpoint: GET /api/address/hash-prefix/{address_type}/{prefix}

get_address

def get_address(address: Address) -> AddressStats

Address information.

Balance and transaction counts. Supports P2PKH, P2SH, P2WPKH, P2WSH, P2TR and P2A addresses, and P2PK public keys in hex (33 or 65 bytes).

Mempool.space docs

Endpoint: GET /api/address/{address}

get_address_txs

def get_address_txs(address: Address,
                    after_txid: Optional[Txid] = None,
                    max_txs: Optional[int] = None) -> List[Transaction]

Address transactions.

Get transaction history for an address, newest first: up to max_txs (50 by default and at most), mempool transactions first and confirmed ones filling the rest. To continue, pass the last returned txid as after_txid, or request GET /api/address/{address}/txs/chain/{after_txid} for confirmed history.

Mempool.space docs

Endpoint: GET /api/address/{address}/txs

get_address_confirmed_txs

def get_address_confirmed_txs(address: Address,
                              max_txs: Optional[int] = None
                              ) -> List[Transaction]

Address confirmed transactions.

Get the newest confirmed transactions for an address, up to max_txs (25 by default and at most). For pagination, request GET /api/address/{address}/txs/chain/{after_txid} with the last returned txid.

Mempool.space docs

Endpoint: GET /api/address/{address}/txs/chain

get_address_confirmed_txs_after

def get_address_confirmed_txs_after(
        address: Address,
        after_txid: Txid,
        max_txs: Optional[int] = None) -> List[Transaction]

Address confirmed transactions (paginated).

Get the next confirmed transactions strictly older than after_txid, up to max_txs (25 by default and at most); a txid outside the address's history answers [] (Esplora-canonical pagination form, matches mempool.space).

Mempool.space docs

Endpoint: GET /api/address/{address}/txs/chain/{after_txid}

get_address_mempool_txs

def get_address_mempool_txs(address: Address,
                            max_txs: Optional[int] = None
                            ) -> List[Transaction]

Address mempool transactions.

Get unconfirmed transactions for an address from the mempool, newest first, up to max_txs (50 by default and at most).

Mempool.space docs

Endpoint: GET /api/address/{address}/txs/mempool

get_address_utxos

def get_address_utxos(address: Address) -> List[Utxo]

Address UTXOs.

Get unspent transaction outputs (UTXOs) for an address, including unconfirmed ones; outputs that mempool transactions spend are left out.

Mempool.space docs

Endpoint: GET /api/address/{address}/utxo

validate_address

def validate_address(address: str) -> AddressValidation

Validate address.

Validate a Bitcoin address and get information about its type and scriptPubKey. Returns isvalid: false with an error message for invalid addresses; a string that isn't 2 to 130 letters and digits answers 400.

Mempool.space docs

Endpoint: GET /api/v1/validate-address/{address}

get_block

def get_block(hash: BlockHash) -> BlockInfo

Block information.

Mempool.space docs

Endpoint: GET /api/block/{hash}

get_block_v1

def get_block_v1(hash: BlockHash) -> BlockInfoV1

Block (v1).

Returns block details with extras by hash.

Mempool.space docs

Endpoint: GET /api/v1/block/{hash}

get_block_header

def get_block_header(hash: BlockHash) -> Hex

Block header.

Returns the hex-encoded 80-byte block header.

Mempool.space docs

Endpoint: GET /api/block/{hash}/header

get_block_hash_by_height

def get_block_hash_by_height(height: Height) -> BlockHash

Block hash by height.

Block hash as plain text.

Mempool.space docs

Endpoint: GET /api/block-height/{height}

get_block_by_timestamp

def get_block_by_timestamp(timestamp: Timestamp) -> BlockTimestamp

Block by timestamp.

Find the block with the greatest header timestamp at or before the given UNIX timestamp, choosing the earliest height on ties.

Mempool.space docs

Endpoint: GET /api/v1/mining/blocks/timestamp/{timestamp}

get_block_raw

def get_block_raw(hash: BlockHash) -> bytes

Raw block.

Returns the raw block data in binary format.

Mempool.space docs

Endpoint: GET /api/block/{hash}/raw

get_block_status

def get_block_status(hash: BlockHash) -> BlockStatus

Block status.

Whether the block is in the best chain and, if so, its height and the hash of the next block. A block outside the best chain (orphaned or unknown) reports in_best_chain: false.

Mempool.space docs

Endpoint: GET /api/block/{hash}/status

get_block_tip_height

def get_block_tip_height() -> Height

Block tip height.

Mempool.space docs

Endpoint: GET /api/blocks/tip/height

get_block_tip_hash

def get_block_tip_hash() -> BlockHash

Block tip hash.

Mempool.space docs

Endpoint: GET /api/blocks/tip/hash

get_block_txid

def get_block_txid(hash: BlockHash, index: BlockTxIndex) -> Txid

Transaction ID at index.

Retrieve a single transaction ID at a specific index within a block. Returns plain text txid.

Mempool.space docs

Endpoint: GET /api/block/{hash}/txid/{index}

get_block_txids

def get_block_txids(hash: BlockHash) -> List[Txid]

Block transaction IDs.

Transaction IDs in block order.

Mempool.space docs

Endpoint: GET /api/block/{hash}/txids

get_block_txs

def get_block_txs(hash: BlockHash) -> List[Transaction]

Block transactions.

Up to 25 transactions starting at index 0.

Mempool.space docs

Endpoint: GET /api/block/{hash}/txs

get_block_txs_from_index

def get_block_txs_from_index(hash: BlockHash,
                             start_index: BlockTxIndex) -> List[Transaction]

Block transactions (paginated).

Up to 25 transactions starting at start_index, a multiple of 25.

Mempool.space docs

Endpoint: GET /api/block/{hash}/txs/{start_index}

get_blocks

def get_blocks() -> List[BlockInfo]

Recent blocks.

The last 10 blocks.

Mempool.space docs

Endpoint: GET /api/blocks

get_blocks_from_height

def get_blocks_from_height(height: Height) -> List[BlockInfo]

Blocks from height.

Retrieve up to 10 blocks going backwards from the given height. For example, height=100 returns blocks 100, 99, 98, ..., 91. Height=0 returns only block 0. A height past the tip is not found.

Mempool.space docs

Endpoint: GET /api/blocks/{height}

get_blocks_v1

def get_blocks_v1() -> List[BlockInfoV1]

Recent blocks with extras.

Retrieve the last 15 blocks with extended data including pool identification and fee statistics.

Mempool.space docs

Endpoint: GET /api/v1/blocks

get_blocks_v1_from_height

def get_blocks_v1_from_height(height: Height) -> List[BlockInfoV1]

Blocks from height with extras.

Retrieve up to 15 blocks with extended data going backwards from the given height: the published blocks among the 15 heights ending at it, so fewer (or none) past the tip.

Mempool.space docs

Endpoint: GET /api/v1/blocks/{height}

get_pools

def get_pools() -> List[PoolInfo]

List all mining pools.

Mempool.space docs

Endpoint: GET /api/v1/mining/pools

get_pool_ranking

def get_pool_ranking(time_period: TimePeriod) -> PoolsSummary

Mining pool statistics.

Get mining pool statistics for a time period.

Mempool.space docs

Endpoint: GET /api/v1/mining/pools/{time_period}

get_pool

def get_pool(slug: PoolSlug) -> PoolDetail

Mining pool details.

Block counts and mining shares by time period for one pool.

Mempool.space docs

Endpoint: GET /api/v1/mining/pool/{slug}

get_pools_hashrate

def get_pools_hashrate() -> List[PoolHashrateEntry]

All pools hashrate (all time).

Get weekly hashrate data, over the whole chain, of the mining pools that mined in the last week, by time and then their weekly rank.

Mempool.space docs

Endpoint: GET /api/v1/mining/hashrate/pools

get_pools_hashrate_by_period

def get_pools_hashrate_by_period(
        time_period: TimePeriod) -> List[PoolHashrateEntry]

All pools hashrate.

Get weekly hashrate data, for a time period, of the mining pools that mined in the last week, by time and then their weekly rank.

Mempool.space docs

Endpoint: GET /api/v1/mining/hashrate/pools/{time_period}

get_pool_hashrate

def get_pool_hashrate(slug: PoolSlug) -> List[PoolHashrateEntry]

Mining pool hashrate.

Get hashrate history for a specific mining pool.

Mempool.space docs

Endpoint: GET /api/v1/mining/pool/{slug}/hashrate

get_pool_blocks

def get_pool_blocks(slug: PoolSlug) -> List[BlockInfoV1]

Mining pool blocks.

Get up to 100 recent blocks mined by a specific pool.

Mempool.space docs

Endpoint: GET /api/v1/mining/pool/{slug}/blocks

get_pool_blocks_from_height

def get_pool_blocks_from_height(slug: PoolSlug,
                                height: Height) -> List[BlockInfoV1]

Mining pool blocks before height.

Get up to 100 blocks mined by a specific pool strictly below the given height (pass the last height of a page to get the next one).

Mempool.space docs

Endpoint: GET /api/v1/mining/pool/{slug}/blocks/{height}

get_hashrate

def get_hashrate() -> HashrateSummary

Network hashrate (all time).

Get network hashrate and difficulty data for all time.

Mempool.space docs

Endpoint: GET /api/v1/mining/hashrate

get_hashrate_by_period

def get_hashrate_by_period(time_period: TimePeriod) -> HashrateSummary

Network hashrate.

Get network hashrate and difficulty data for a time period.

Mempool.space docs

Endpoint: GET /api/v1/mining/hashrate/{time_period}

get_difficulty_adjustments

def get_difficulty_adjustments() -> List[DifficultyAdjustmentEntry]

Difficulty adjustments (all time).

Mempool.space docs

Endpoint: GET /api/v1/mining/difficulty-adjustments

get_difficulty_adjustments_by_period

def get_difficulty_adjustments_by_period(
        time_period: TimePeriod) -> List[DifficultyAdjustmentEntry]

Difficulty adjustments.

Get historical difficulty adjustments for a time period.

Mempool.space docs

Endpoint: GET /api/v1/mining/difficulty-adjustments/{time_period}

get_reward_stats

def get_reward_stats(block_count: int) -> RewardStats

Mining reward statistics.

Get mining reward statistics for the last N blocks including total rewards, fees, and transaction count.

Mempool.space docs

Endpoint: GET /api/v1/mining/reward-stats/{block_count}

get_block_fees

def get_block_fees(time_period: TimePeriod) -> List[BlockFeesEntry]

Block fees.

Get average total fees per block for a time period.

Mempool.space docs

Endpoint: GET /api/v1/mining/blocks/fees/{time_period}

get_block_rewards

def get_block_rewards(time_period: TimePeriod) -> List[BlockRewardsEntry]

Block rewards.

Get average coinbase reward (subsidy + fees) per block for a time period.

Mempool.space docs

Endpoint: GET /api/v1/mining/blocks/rewards/{time_period}

get_block_fee_rates

def get_block_fee_rates(time_period: TimePeriod) -> List[BlockFeeRatesEntry]

Block fee rates.

Get block fee rate percentiles (min, 10th, 25th, median, 75th, 90th, max) for a time period, each a whole sat/vB (/precise for 3 decimals).

Mempool.space docs

Endpoint: GET /api/v1/mining/blocks/fee-rates/{time_period}

get_block_fee_rates_precise

def get_block_fee_rates_precise(
        time_period: TimePeriod) -> List[BlockFeeRatesPreciseEntry]

Block fee rates (precise).

Get block fee rate percentiles (min, 10th, 25th, median, 75th, 90th, max) for a time period, each in sat/vB to 3 decimals.

Mempool.space docs

Endpoint: GET /api/v1/mining/blocks/fee-rates/{time_period}/precise

get_block_sizes_weights

def get_block_sizes_weights(time_period: TimePeriod) -> BlockSizesWeights

Block sizes and weights.

Get average block sizes and weights for a time period.

Mempool.space docs

Endpoint: GET /api/v1/mining/blocks/sizes-weights/{time_period}

get_mempool_blocks

def get_mempool_blocks() -> List[MempoolBlock]

Projected mempool blocks.

Projected blocks for fee estimation. Block 0 reflects Bitcoin Core's actual next-block selection; blocks 1+ are a fee-tier approximation.

Mempool.space docs

Endpoint: GET /api/v1/fees/mempool-blocks

get_recommended_fees

def get_recommended_fees() -> RecommendedFees

Recommended fees.

Recommended fee rates by confirmation target, in whole sat/vB.

Mempool.space docs

Endpoint: GET /api/v1/fees/recommended

get_precise_fees

def get_precise_fees() -> PreciseRecommendedFees

Recommended fee rates (precise).

Recommended fee rates by confirmation target, with up to three decimal places and support for sub-sat/vB rates.

Mempool.space docs

Endpoint: GET /api/v1/fees/precise

get_mempool

def get_mempool() -> MempoolInfo

Mempool statistics.

Mempool.space docs

Endpoint: GET /api/mempool

get_mempool_txids

def get_mempool_txids() -> List[Txid]

Mempool transaction IDs.

Get all transaction IDs currently in the mempool.

Mempool.space docs

Endpoint: GET /api/mempool/txids

get_mempool_recent

def get_mempool_recent() -> List[MempoolRecentTx]

Recent mempool transactions.

Get the last 10 transactions to enter the mempool.

Mempool.space docs

Endpoint: GET /api/mempool/recent

get_replacements

def get_replacements() -> List[ReplacementNode]

Recent RBF replacements.

Returns up to 25 most-recent RBF replacement trees across the whole mempool. Each entry has the shape of replacements in GET /api/v1/tx/{txid}/rbf.

Mempool.space docs

Endpoint: GET /api/v1/replacements

get_fullrbf_replacements

def get_fullrbf_replacements() -> List[ReplacementNode]

Recent full-RBF replacements.

Same response shape as GET /api/v1/replacements, but limited to trees where at least one predecessor was non-signaling (full-RBF).

Mempool.space docs

Endpoint: GET /api/v1/fullrbf/replacements

get_mempool_block

def get_mempool_block(index: MempoolBlockIndex) -> MempoolBlockContent

Projected mempool block.

A projected mempool block with its transactions in order and its stats, by position as GET /api/v1/fees/mempool-blocks lists them: 0 is the next block, Bitcoin Core's getblocktemplate selection, and the only one served for now (others answer 404). The returned hash is an opaque content token: poll GET /api/mempool-blocks/{index}/diff/{hash} to follow changes instead of refetching the block.

Endpoint: GET /api/mempool-blocks/{index}

get_mempool_block_diff

def get_mempool_block_diff(index: MempoolBlockIndex,
                           since: MempoolBlockHash) -> MempoolBlockDiff

Projected mempool block changes.

The projected mempool block's changes since the client's copy at since. order is the new block in order: each entry is either [start, count], the client's transactions start..start + count kept in order, or a transaction object, a body to place there. Walk order once to rebuild, and replace the cached stats with the response's; removed lists the txids that left, so clients can evict cached bodies. Use the response hash as the next since; with If-None-Match an unchanged block answers 304. Returns 404 when since has aged out of server history: fetch GET /api/mempool-blocks/{index} again.

Endpoint: GET /api/mempool-blocks/{index}/diff/{since}

get_txid_by_index

def get_txid_by_index(index: TxIndex) -> Txid

Txid by index.

Retrieve the transaction ID (txid) at a given global transaction index. Returns the txid as plain text.

Endpoint: GET /api/tx-index/{index}

get_cpfp

def get_cpfp(txid: Txid) -> Cpfp

CPFP info.

Returns ancestors and descendants for a CPFP (Child Pays For Parent) transaction, including the effective fee rate of the package. A mempool transaction answers its live package; a confirmed one its package among its block's transactions; an unknown transaction, or a confirmed one without relatives in its block, {"ancestors":[]}.

Mempool.space docs

Endpoint: GET /api/v1/cpfp/{txid}

get_tx_rbf

def get_tx_rbf(txid: Txid) -> RbfResponse

RBF replacement history.

Returns the RBF replacement tree for a transaction, if any. Both replacements and replaces are null when the tx has no known RBF history within the mempool monitor's retention window.

Mempool.space docs

Endpoint: GET /api/v1/tx/{txid}/rbf

get_tx

def get_tx(txid: Txid) -> Transaction

Transaction information.

Mempool.space docs

Endpoint: GET /api/tx/{txid}

get_tx_hex

def get_tx_hex(txid: Txid) -> Hex

Transaction hex.

Hex-encoded serialized transaction.

Mempool.space docs

Endpoint: GET /api/tx/{txid}/hex

get_tx_merkleblock_proof

def get_tx_merkleblock_proof(txid: Txid) -> Hex

Transaction merkleblock proof.

Get the merkleblock proof for a transaction (BIP37 format, hex encoded).

Mempool.space docs

Endpoint: GET /api/tx/{txid}/merkleblock-proof

get_tx_merkle_proof

def get_tx_merkle_proof(txid: Txid) -> MerkleProof

Transaction merkle proof.

Mempool.space docs

Endpoint: GET /api/tx/{txid}/merkle-proof

get_tx_outspend

def get_tx_outspend(txid: Txid, vout: Vout) -> TxOutspend

Output spend status.

Whether the output has been spent and, if so, the spending transaction details. An output no known transaction holds is unspent.

Mempool.space docs

Endpoint: GET /api/tx/{txid}/outspend/{vout}

get_tx_outspends

def get_tx_outspends(txid: Txid) -> List[TxOutspend]

All output spend statuses.

Spend statuses in output-index order.

Mempool.space docs

Endpoint: GET /api/tx/{txid}/outspends

get_tx_raw

def get_tx_raw(txid: Txid) -> bytes

Transaction raw.

Returns a transaction as binary data.

Mempool.space docs

Endpoint: GET /api/tx/{txid}/raw

get_tx_status

def get_tx_status(txid: Txid) -> TxStatus

Transaction status.

Retrieve the confirmation status of a transaction. Returns whether the transaction is confirmed and, if so, the block height, hash, and timestamp. A transaction not in the chain, pending or unknown, is {"confirmed":false}.

Mempool.space docs

Endpoint: GET /api/tx/{txid}/status

get_transaction_times

def get_transaction_times(txids: List[Txid]) -> List[Timestamp]

Transaction first-seen times.

First-seen UNIX timestamps in seconds, in request order, of transactions in the mempool or that recently left it other than by replacement (mined ones included); 0 otherwise.

Mempool.space docs

Endpoint: GET /api/v1/transaction-times

post_tx

def post_tx(body: str) -> Txid

Broadcast transaction.

Submit a raw transaction as hexadecimal text (at most 8,000,000 request bytes, including whitespace). Returns its txid as plain text. No responses are cached. Cancellation or a transport error after dispatch may leave the submission outcome unknown; do not automatically retry.

Mempool.space docs

Endpoint: POST /api/tx

get_utxo_set_latest

def get_utxo_set_latest() -> UtxoSet

Latest UTXO set.

The UTXO set after the latest published block, in the layout of GET /api/utxo-set/{point}.

Endpoint: GET /api/utxo-set

get_utxo_set

def get_utxo_set(point: HeightOrDate) -> UtxoSet

UTXO set at block height or date.

The UTXO set after a block (840000) or after the last published block of a UTC day (YYYY-MM-DD), by creation height. Returns { height, hash, date, count, supply, origins }; entry i of origins.count and origins.supply (BTC) is what remains unspent of block i's outputs.

Endpoint: GET /api/utxo-set/{point}

get_utxo_set_diff

def get_utxo_set_diff(point: HeightOrDate) -> UtxoSetDiff

UTXO set changes of a block or date.

What a block (840000) or a UTC day's published blocks (YYYY-MM-DD) changed in the UTXO set. Returns { first, last, hash, date, created, spent }: created has one row per block, spent one row per creation height, each as columnar height, count and supply (BTC). The set after block first - 1 plus created minus spent is the set after block last.

Endpoint: GET /api/utxo-set/{point}/diff

get_live_price

def get_live_price() -> Dollars

Live BTC/USD price.

Current BTC/USD price in dollars, derived from on-chain round-dollar output patterns in the oracle's recent-block window, with the mempool's outputs blended in when available, to the cent: price of GET /api/oracle/live. Confirmed per-height history is available at GET /api/series/price/height. Not found before the oracle's first prices.

Endpoint: GET /api/oracle/price

get_oracle_live

def get_oracle_live() -> OracleBlock

The oracle now.

The oracle's reading now, as GET /api/oracle/blocks/{height} reads a block: with the mempool's outputs blended in as the next block (mempool true, height the next block's, outputs the mempool's), its search from the tip's answer, price the live price; without a mempool at the tip, the tip block's own. One snapshot: its parts never from two moments, hash the confirmed tip it was read at. Not found before the oracle's first prices, nor before height 508,000.

Endpoint: GET /api/oracle/live

get_oracle_block

def get_oracle_block(height: Height) -> OracleBlock

The oracle at a block.

How the oracle read a confirmed block, after height 508,000: what it counted (the smoothed histogram of the payments of the block and the 11 before it, by amount on its log scale; the block's outputs as its filter judged them, each skipped one under the first rule that skips it), where it looked (every candidate bin in its window, 12 below the block before's answer to 11 above, with its score) and what it found (the bin it picked and its price). Bins: 200 a decade, a bin round(log10(sats) * 200); as where $100 lands, a bin is the price 10^(10 - bin / 200) dollars. A settled block's never changes.

Endpoint: GET /api/oracle/blocks/{height}

get_oracle_payments

def get_oracle_payments(start: Height) -> OraclePayments

The oracle's payments, 144 blocks at a time.

For each of the 144 blocks from start (a multiple of 144, else a bad request; from 508,032, earlier ones out of range): its payments as the oracle filters them, each read as each of its 19 round-dollar amounts ($1 to $10,000) at its exact amount in sats, counted by the price each reading implies, in buckets a tenth of a bin wide (0.115% of price) over the block's search window: finer than the oracle's bins, the evidence behind its prices. The chunk at the tip holds its blocks so far, hash its last block's; a whole, settled chunk never changes.

Endpoint: GET /api/oracle/payments/{start}

get_openapi

def get_openapi() -> Any

OpenAPI specification.

Full OpenAPI 3.1 specification for this API. Build tools from this document.

Endpoint: GET /openapi.json

get_api

def get_api() -> Any

Compact API summary.

Compact custom summary of the OpenAPI specification for LLM reading: types instead of schemas, returns instead of responses, no examples; parameters keep their enum, default and bounds. Not valid OpenAPI: build tools from GET /openapi.json.

Endpoint: GET /api.json