Files
2026-08-05 18:10:55 +02:00

92 KiB
Raw Permalink Blame History

brk-client


brk-client / BrkClient

Class: BrkClient

Defined in: Developer/brk/modules/brk-client/index.js:8343

Main BRK client with series tree and API methods

Extends

  • BrkClientBase

Constructors

Constructor

new BrkClient(options): BrkClient

Defined in: Developer/brk/modules/brk-client/index.js:9567

Parameters

options

string | BrkClientOptions

Returns

BrkClient

Overrides

BrkClientBase.constructor

Properties

_browserCache

_browserCache: Cache | null

Defined in: Developer/brk/modules/brk-client/index.js:1906

Inherited from

BrkClientBase._browserCache


_browserCachePromise

_browserCachePromise: Promise<Cache | null>

Defined in: Developer/brk/modules/brk-client/index.js:1904

Inherited from

BrkClientBase._browserCachePromise


_memCache

_memCache: Map<string, _MemEntry<unknown>>

Defined in: Developer/brk/modules/brk-client/index.js:1913

Inherited from

BrkClientBase._memCache


series

series: SeriesTree

Defined in: Developer/brk/modules/brk-client/index.js:9570

Methods

_fetchSeriesData()

_fetchSeriesData<T>(path, arg?, options?): Promise<DateSeriesData<T>>

Defined in: Developer/brk/modules/brk-client/index.js:2154

Fetch series data and wrap with helper methods (internal)

Type Parameters

T

T

Parameters

path

string

arg?

DateSeriesFetchArg<T>

options?

ClientFetchOptions<DateSeriesData<T>>

Returns

Promise<DateSeriesData<T>>

Inherited from

BrkClientBase._fetchSeriesData


_getCached()

_getCached<T>(path, parse, options?): Promise<T>

Defined in: Developer/brk/modules/brk-client/index.js:1980

Make a GET request with layered caching.

Contract:

  • The returned Promise resolves with the freshest value (post-revalidation).
  • onValue fires once with the freshest value, or twice if a stale snapshot could be shown first (stale-while-revalidate). On a 304 there is no second fire.

Layers:

  • L1 (memCache): in-memory parsed values keyed by URL+ETag. Lets 304s skip the parse entirely.
  • L2 (browserCache): Cache API, survives reload and feeds onValue fast on cold start.

Type Parameters

T

T

Parameters

path

string

parse

(res) => Promise<T>

Response body reader

options?

ClientFetchOptions<T> = {}

Returns

Promise<T>

Inherited from

BrkClientBase._getCached


_memGet()

_memGet<T>(key): _MemEntry<T> | undefined

Defined in: Developer/brk/modules/brk-client/index.js:1921

Type Parameters

T

T

Parameters

key

string

Returns

_MemEntry<T> | undefined

Inherited from

BrkClientBase._memGet


_memSet()

_memSet(key, etag, value): void

Defined in: Developer/brk/modules/brk-client/index.js:1935

Parameters

key

string

etag

string | null

value

unknown

Returns

void

Inherited from

BrkClientBase._memSet


dateToIndex()

dateToIndex(index, d): number

Defined in: Developer/brk/modules/brk-client/index.js:9559

Convert a Date to an index value for date-based indexes.

Parameters

index

Index

The index type

d

Date

The date to convert

Returns

number


get()

get(path, options?): Promise<Response>

Defined in: Developer/brk/modules/brk-client/index.js:1950

Parameters

path

string

options?
cache?

boolean = true

signal?

AbortSignal

Returns

Promise<Response>

Inherited from

BrkClientBase.get


getAddress()

getAddress(address, options?): Promise<AddrStats>

Defined in: Developer/brk/modules/brk-client/index.js:11926

Address information

Retrieve address information including current balance and transaction counts. Supports all standard Bitcoin address types (P2PKH, P2SH, P2WPKH, P2WSH, P2TR).

Mempool.space docs

Endpoint: GET /api/address/{address}

Parameters

address

string

options?
cache?

boolean

memCache?

boolean

onValue?

(value) => void

signal?

AbortSignal

Returns

Promise<AddrStats>


getAddressConfirmedTxs()

getAddressConfirmedTxs(address, options?): Promise<Transaction[]>

Defined in: Developer/brk/modules/brk-client/index.js:11962

Address confirmed transactions

Get the first 25 confirmed transactions for an address. 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

Parameters

address

string

options?
cache?

boolean

memCache?

boolean

onValue?

(value) => void

signal?

AbortSignal

Returns

Promise<Transaction[]>


getAddressConfirmedTxsAfter()

getAddressConfirmedTxsAfter(address, after_txid, options?): Promise<Transaction[]>

Defined in: Developer/brk/modules/brk-client/index.js:11981

Address confirmed transactions (paginated)

Get the next 25 confirmed transactions strictly older than after_txid (Esplora-canonical pagination form, matches mempool.space).

Mempool.space docs

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

Parameters

address

string

after_txid

string

Last txid from the previous page (return transactions strictly older than this)

options?
cache?

boolean

memCache?

boolean

onValue?

(value) => void

signal?

AbortSignal

Returns

Promise<Transaction[]>


getAddressHashPrefixMatches()

getAddressHashPrefixMatches(addr_type, prefix, options?): Promise<AddrHashPrefixMatches>

Defined in: Developer/brk/modules/brk-client/index.js:11908

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/{addr_type}/{prefix}

Parameters

addr_type

OutputType

prefix

string

First 116 hexadecimal nibbles of the RapidHash v3 hash over the raw address payload bytes.

options?
cache?

boolean

memCache?

boolean

onValue?

(value) => void

signal?

AbortSignal

Returns

Promise<AddrHashPrefixMatches>


getAddressMempoolTxs()

getAddressMempoolTxs(address, options?): Promise<Transaction[]>

Defined in: Developer/brk/modules/brk-client/index.js:11999

Address mempool transactions

Get unconfirmed transactions for an address from the mempool, newest first (up to 50).

Mempool.space docs

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

Parameters

address

string

options?
cache?

boolean

memCache?

boolean

onValue?

(value) => void

signal?

AbortSignal

Returns

Promise<Transaction[]>


getAddressPayloadHashPrefixMatches()

getAddressPayloadHashPrefixMatches(addrType, payload, nibbles, options?): Promise<AddrHashPrefixMatches>

Defined in: Developer/brk/modules/brk-client/index.js:9591

Fetch address hash-prefix matches from raw address payload bytes.

Parameters

addrType

OutputType

payload

number[] | ArrayBuffer | Uint8Array<ArrayBufferLike> | ArrayBufferView<ArrayBufferLike>

Raw payload bytes matching addrType length

nibbles

number

options?
cache?

boolean

memCache?

boolean

onValue?

(value) => void

signal?

AbortSignal

Returns

Promise<AddrHashPrefixMatches>


getAddressTxs()

getAddressTxs(address, options?): Promise<Transaction[]>

Defined in: Developer/brk/modules/brk-client/index.js:11944

Address transactions

Get transaction history for an address, newest first. Returns up to 50 mempool transactions plus a confirmed page sized to fill the response to 50 total (chain floor of 25, so 25-50 confirmed depending on mempool weight). To paginate further confirmed history, request GET /api/address/{address}/txs/chain/{after_txid} with the last returned txid.

Mempool.space docs

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

Parameters

address

string

options?
cache?

boolean

memCache?

boolean

onValue?

(value) => void

signal?

AbortSignal

Returns

Promise<Transaction[]>


getAddressUtxos()

getAddressUtxos(address, options?): Promise<Utxo[]>

Defined in: Developer/brk/modules/brk-client/index.js:12017

Address UTXOs

Get unspent transaction outputs (UTXOs) for an address. Returns txid, vout, value, and confirmation status for each UTXO.

Mempool.space docs

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

Parameters

address

string

options?
cache?

boolean

memCache?

boolean

onValue?

(value) => void

signal?

AbortSignal

Returns

Promise<Utxo[]>


getApi()

getApi(options?): Promise<any>

Defined in: Developer/brk/modules/brk-client/index.js:13160

Compact OpenAPI specification

Compact OpenAPI specification optimized for LLM consumption. Removes redundant fields while preserving essential API information. The full specification is available at GET /openapi.json.

Endpoint: GET /api.json

Parameters

options?
cache?

boolean

memCache?

boolean

onValue?

(value) => void

signal?

AbortSignal

Returns

Promise<any>


getBlock()

getBlock(hash, options?): Promise<BlockInfo>

Defined in: Developer/brk/modules/brk-client/index.js:12053

Block information

Retrieve block information by block hash. Returns block metadata including height, timestamp, difficulty, size, weight, and transaction count.

Mempool.space docs

Endpoint: GET /api/block/{hash}

Parameters

hash

string

options?
cache?

boolean

memCache?

boolean

onValue?

(value) => void

signal?

AbortSignal

Returns

Promise<BlockInfo>


getBlockByHeight()

getBlockByHeight(height, options?): Promise<string>

Defined in: Developer/brk/modules/brk-client/index.js:12107

Block hash by height

Retrieve the block hash at a given height. Returns the hash as plain text.

Mempool.space docs

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

Parameters

height

number

options?
cache?

boolean

memCache?

boolean

onValue?

(value) => void

signal?

AbortSignal

Returns

Promise<string>


getBlockByTimestamp()

getBlockByTimestamp(timestamp, options?): Promise<BlockTimestamp>

Defined in: Developer/brk/modules/brk-client/index.js:12125

Block by timestamp

Find the block closest to a given UNIX timestamp.

Mempool.space docs

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

Parameters

timestamp

number

options?
cache?

boolean

memCache?

boolean

onValue?

(value) => void

signal?

AbortSignal

Returns

Promise<BlockTimestamp>


getBlockFeeRates()

getBlockFeeRates(time_period, options?): Promise<BlockFeeRatesEntry[]>

Defined in: Developer/brk/modules/brk-client/index.js:12616

Block fee rates

Get block fee rate percentiles (min, 10th, 25th, median, 75th, 90th, max) for a time period. Valid periods: 24h, 3d, 1w, 1m, 3m, 6m, 1y, 2y, 3y.

Mempool.space docs

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

Parameters

time_period

TimePeriod

options?
cache?

boolean

memCache?

boolean

onValue?

(value) => void

signal?

AbortSignal

Returns

Promise<BlockFeeRatesEntry[]>


getBlockFees()

getBlockFees(time_period, options?): Promise<BlockFeesEntry[]>

Defined in: Developer/brk/modules/brk-client/index.js:12580

Block fees

Get average total fees per block for a time period. Valid periods: 24h, 3d, 1w, 1m, 3m, 6m, 1y, 2y, 3y.

Mempool.space docs

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

Parameters

time_period

TimePeriod

options?
cache?

boolean

memCache?

boolean

onValue?

(value) => void

signal?

AbortSignal

Returns

Promise<BlockFeesEntry[]>


getBlockHeader()

getBlockHeader(hash, options?): Promise<string>

Defined in: Developer/brk/modules/brk-client/index.js:12089

Block header

Returns the hex-encoded 80-byte block header.

Mempool.space docs

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

Parameters

hash

string

options?
cache?

boolean

memCache?

boolean

onValue?

(value) => void

signal?

AbortSignal

Returns

Promise<string>


getBlockRaw()

getBlockRaw(hash, options?): Promise<Uint8Array<ArrayBufferLike>>

Defined in: Developer/brk/modules/brk-client/index.js:12143

Raw block

Returns the raw block data in binary format.

Mempool.space docs

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

Parameters

hash

string

options?
cache?

boolean

memCache?

boolean

onValue?

(value) => void

signal?

AbortSignal

Returns

Promise<Uint8Array<ArrayBufferLike>>


getBlockRewards()

getBlockRewards(time_period, options?): Promise<BlockRewardsEntry[]>

Defined in: Developer/brk/modules/brk-client/index.js:12598

Block rewards

Get average coinbase reward (subsidy + fees) per block for a time period. Valid periods: 24h, 3d, 1w, 1m, 3m, 6m, 1y, 2y, 3y.

Mempool.space docs

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

Parameters

time_period

TimePeriod

options?
cache?

boolean

memCache?

boolean

onValue?

(value) => void

signal?

AbortSignal

Returns

Promise<BlockRewardsEntry[]>


getBlocks()

getBlocks(options?): Promise<BlockInfo[]>

Defined in: Developer/brk/modules/brk-client/index.js:12283

Recent blocks

Retrieve the last 10 blocks. Returns block metadata for each block.

Mempool.space docs

Endpoint: GET /api/blocks

Parameters

options?
cache?

boolean

memCache?

boolean

onValue?

(value) => void

signal?

AbortSignal

Returns

Promise<BlockInfo[]>


getBlocksFromHeight()

getBlocksFromHeight(height, options?): Promise<BlockInfo[]>

Defined in: Developer/brk/modules/brk-client/index.js:12301

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.

Mempool.space docs

Endpoint: GET /api/blocks/{height}

Parameters

height

number

options?
cache?

boolean

memCache?

boolean

onValue?

(value) => void

signal?

AbortSignal

Returns

Promise<BlockInfo[]>


getBlockSizesWeights()

getBlockSizesWeights(time_period, options?): Promise<BlockSizesWeights>

Defined in: Developer/brk/modules/brk-client/index.js:12634

Block sizes and weights

Get average block sizes and weights for a time period. Valid periods: 24h, 3d, 1w, 1m, 3m, 6m, 1y, 2y, 3y.

Mempool.space docs

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

Parameters

time_period

TimePeriod

options?
cache?

boolean

memCache?

boolean

onValue?

(value) => void

signal?

AbortSignal

Returns

Promise<BlockSizesWeights>


getBlockStatus()

getBlockStatus(hash, options?): Promise<BlockStatus>

Defined in: Developer/brk/modules/brk-client/index.js:12161

Block status

Retrieve the status of a block. Returns whether the block is in the best chain and, if so, its height and the hash of the next block.

Mempool.space docs

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

Parameters

hash

string

options?
cache?

boolean

memCache?

boolean

onValue?

(value) => void

signal?

AbortSignal

Returns

Promise<BlockStatus>


getBlocksV1()

getBlocksV1(options?): Promise<BlockInfoV1[]>

Defined in: Developer/brk/modules/brk-client/index.js:12317

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

Parameters

options?
cache?

boolean

memCache?

boolean

onValue?

(value) => void

signal?

AbortSignal

Returns

Promise<BlockInfoV1[]>


getBlocksV1FromHeight()

getBlocksV1FromHeight(height, options?): Promise<BlockInfoV1[]>

Defined in: Developer/brk/modules/brk-client/index.js:12335

Blocks from height with extras

Retrieve up to 15 blocks with extended data going backwards from the given height.

Mempool.space docs

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

Parameters

height

number

options?
cache?

boolean

memCache?

boolean

onValue?

(value) => void

signal?

AbortSignal

Returns

Promise<BlockInfoV1[]>


getBlockTemplate()

getBlockTemplate(options?): Promise<BlockTemplate>

Defined in: Developer/brk/modules/brk-client/index.js:12790

Projected next block template

Bitcoin Core's getblocktemplate selection: full transaction bodies in GBT order with aggregate stats. The returned hash is an opaque content token; pass it to GET /api/v1/mempool/block-template/diff/{hash} to fetch deltas instead of refetching the whole template.

Endpoint: GET /api/v1/mempool/block-template

Parameters

options?
cache?

boolean

memCache?

boolean

onValue?

(value) => void

signal?

AbortSignal

Returns

Promise<BlockTemplate>


getBlockTemplateDiff()

getBlockTemplateDiff(hash, options?): Promise<BlockTemplateDiff>

Defined in: Developer/brk/modules/brk-client/index.js:12806

Block template diff since hash

Delta of the projected next block since <hash>. order is the full new template in order: each entry is either a number (index into the prior template the client cached at <hash>) or a transaction object (new body to insert at this position). Walk order once to rebuild; removed is a convenience list of txids that left so clients can evict cached bodies. After applying, use the response hash as <hash> on the next call to keep iterating. Returns 404 when <hash> has aged out of server history; clients should fall back to GET /api/v1/mempool/block-template.

Endpoint: GET /api/v1/mempool/block-template/diff/{hash}

Parameters

hash

number

options?
cache?

boolean

memCache?

boolean

onValue?

(value) => void

signal?

AbortSignal

Returns

Promise<BlockTemplateDiff>


getBlockTipHash()

getBlockTipHash(options?): Promise<string>

Defined in: Developer/brk/modules/brk-client/index.js:12193

Block tip hash

Returns the hash of the last block.

Mempool.space docs

Endpoint: GET /api/blocks/tip/hash

Parameters

options?
cache?

boolean

memCache?

boolean

onValue?

(value) => void

signal?

AbortSignal

Returns

Promise<string>


getBlockTipHeight()

getBlockTipHeight(options?): Promise<number>

Defined in: Developer/brk/modules/brk-client/index.js:12177

Block tip height

Returns the height of the last block.

Mempool.space docs

Endpoint: GET /api/blocks/tip/height

Parameters

options?
cache?

boolean

memCache?

boolean

onValue?

(value) => void

signal?

AbortSignal

Returns

Promise<number>


getBlockTxid()

getBlockTxid(hash, index, options?): Promise<string>

Defined in: Developer/brk/modules/brk-client/index.js:12212

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}

Parameters

hash

string

Bitcoin block hash

index

number

Transaction index within the block (0-based)

options?
cache?

boolean

memCache?

boolean

onValue?

(value) => void

signal?

AbortSignal

Returns

Promise<string>


getBlockTxids()

getBlockTxids(hash, options?): Promise<string[]>

Defined in: Developer/brk/modules/brk-client/index.js:12230

Block transaction IDs

Retrieve all transaction IDs in a block. Returns an array of txids in block order.

Mempool.space docs

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

Parameters

hash

string

options?
cache?

boolean

memCache?

boolean

onValue?

(value) => void

signal?

AbortSignal

Returns

Promise<string[]>


getBlockTxs()

getBlockTxs(hash, options?): Promise<Transaction[]>

Defined in: Developer/brk/modules/brk-client/index.js:12248

Block transactions

Retrieve transactions in a block by block hash. Returns up to 25 transactions starting from index 0.

Mempool.space docs

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

Parameters

hash

string

options?
cache?

boolean

memCache?

boolean

onValue?

(value) => void

signal?

AbortSignal

Returns

Promise<Transaction[]>


getBlockTxsFromIndex()

getBlockTxsFromIndex(hash, start_index, options?): Promise<Transaction[]>

Defined in: Developer/brk/modules/brk-client/index.js:12267

Block transactions (paginated)

Retrieve transactions in a block by block hash, starting from the specified index. Returns up to 25 transactions at a time.

Mempool.space docs

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

Parameters

hash

string

Bitcoin block hash

start_index

number

Starting transaction index within the block (0-based)

options?
cache?

boolean

memCache?

boolean

onValue?

(value) => void

signal?

AbortSignal

Returns

Promise<Transaction[]>


getBlockV1()

getBlockV1(hash, options?): Promise<BlockInfoV1>

Defined in: Developer/brk/modules/brk-client/index.js:12071

Block (v1)

Returns block details with extras by hash.

Mempool.space docs

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

Parameters

hash

string

options?
cache?

boolean

memCache?

boolean

onValue?

(value) => void

signal?

AbortSignal

Returns

Promise<BlockInfoV1>


getBytes()

getBytes(path, options?): Promise<Uint8Array<ArrayBufferLike>>

Defined in: Developer/brk/modules/brk-client/index.js:2081

Make a GET request expecting binary data (application/octet-stream). Cached and supports onValue, same as getJson.

Parameters

path

string

options?

ClientFetchOptions<Uint8Array<ArrayBufferLike>>

Returns

Promise<Uint8Array<ArrayBufferLike>>

Inherited from

BrkClientBase.getBytes


getCpfp()

getCpfp(txid, options?): Promise<CpfpInfo>

Defined in: Developer/brk/modules/brk-client/index.js:12930

CPFP info

Returns ancestors and descendants for a CPFP (Child Pays For Parent) transaction, including the effective fee rate of the package.

Mempool.space docs

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

Parameters

txid

string

options?
cache?

boolean

memCache?

boolean

onValue?

(value) => void

signal?

AbortSignal

Returns

Promise<CpfpInfo>


getDifficultyAdjustment()

getDifficultyAdjustment(options?): Promise<DifficultyAdjustment>

Defined in: Developer/brk/modules/brk-client/index.js:11853

Difficulty adjustment

Get current difficulty adjustment progress and estimates.

Mempool.space docs

Endpoint: GET /api/v1/difficulty-adjustment

Parameters

options?
cache?

boolean

memCache?

boolean

onValue?

(value) => void

signal?

AbortSignal

Returns

Promise<DifficultyAdjustment>


getDifficultyAdjustments()

getDifficultyAdjustments(options?): Promise<DifficultyAdjustmentEntry[]>

Defined in: Developer/brk/modules/brk-client/index.js:12526

Difficulty adjustments (all time)

Get historical difficulty adjustments including timestamp, block height, difficulty value, and percentage change.

Mempool.space docs

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

Parameters

options?
cache?

boolean

memCache?

boolean

onValue?

(value) => void

signal?

AbortSignal

Returns

Promise<DifficultyAdjustmentEntry[]>


getDifficultyAdjustmentsByPeriod()

getDifficultyAdjustmentsByPeriod(time_period, options?): Promise<DifficultyAdjustmentEntry[]>

Defined in: Developer/brk/modules/brk-client/index.js:12544

Difficulty adjustments

Get historical difficulty adjustments for a time period. Valid periods: 24h, 3d, 1w, 1m, 3m, 6m, 1y, 2y, 3y.

Mempool.space docs

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

Parameters

time_period

TimePeriod

options?
cache?

boolean

memCache?

boolean

onValue?

(value) => void

signal?

AbortSignal

Returns

Promise<DifficultyAdjustmentEntry[]>


getDiskUsage()

getDiskUsage(options?): Promise<DiskUsage>

Defined in: Developer/brk/modules/brk-client/index.js:11521

Disk usage

Returns the disk space used by BRK and Bitcoin data.

Endpoint: GET /api/server/disk

Parameters

options?
cache?

boolean

memCache?

boolean

onValue?

(value) => void

signal?

AbortSignal

Returns

Promise<DiskUsage>


getFullrbfReplacements()

getFullrbfReplacements(options?): Promise<ReplacementNode[]>

Defined in: Developer/brk/modules/brk-client/index.js:12776

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

Parameters

options?
cache?

boolean

memCache?

boolean

onValue?

(value) => void

signal?

AbortSignal

Returns

Promise<ReplacementNode[]>


getHashrate()

getHashrate(options?): Promise<HashrateSummary>

Defined in: Developer/brk/modules/brk-client/index.js:12492

Network hashrate (all time)

Get network hashrate and difficulty data for all time.

Mempool.space docs

Endpoint: GET /api/v1/mining/hashrate

Parameters

options?
cache?

boolean

memCache?

boolean

onValue?

(value) => void

signal?

AbortSignal

Returns

Promise<HashrateSummary>


getHashrateByPeriod()

getHashrateByPeriod(time_period, options?): Promise<HashrateSummary>

Defined in: Developer/brk/modules/brk-client/index.js:12510

Network hashrate

Get network hashrate and difficulty data for a time period. Valid periods: 24h, 3d, 1w, 1m, 3m, 6m, 1y, 2y, 3y.

Mempool.space docs

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

Parameters

time_period

TimePeriod

options?
cache?

boolean

memCache?

boolean

onValue?

(value) => void

signal?

AbortSignal

Returns

Promise<HashrateSummary>


getHealth()

getHealth(options?): Promise<Health>

Defined in: Developer/brk/modules/brk-client/index.js:11479

Health check

Liveness probe. Returns server identity, uptime, and indexed/computed heights from local state only (no bitcoind round-trip). For real chain-tip catch-up, request GET /api/server/sync.

Endpoint: GET /health

Parameters

options?
cache?

boolean

memCache?

boolean

onValue?

(value) => void

signal?

AbortSignal

Returns

Promise<Health>


getHistoricalPrice()

getHistoricalPrice(timestamp?, options?): Promise<HistoricalPrice>

Defined in: Developer/brk/modules/brk-client/index.js:11887

Historical price

Get historical BTC/USD price. Optionally specify a UNIX timestamp to get the price at that time.

Mempool.space docs

Endpoint: GET /api/v1/historical-price

Parameters

timestamp?

number

options?
cache?

boolean

memCache?

boolean

onValue?

(value) => void

signal?

AbortSignal

Returns

Promise<HistoricalPrice>


getIndexes()

getIndexes(options?): Promise<IndexInfo[]>

Defined in: Developer/brk/modules/brk-client/index.js:11563

List available indexes

Returns all available indexes with their accepted query aliases. Use any alias when querying series.

Endpoint: GET /api/series/indexes

Parameters

options?
cache?

boolean

memCache?

boolean

onValue?

(value) => void

signal?

AbortSignal

Returns

Promise<IndexInfo[]>


getJson()

getJson<T>(path, options?): Promise<T>

Defined in: Developer/brk/modules/brk-client/index.js:2059

Make a GET request expecting a JSON response. Cached and supports onValue.

Type Parameters

T

T

Parameters

path

string

options?

ClientFetchOptions<T>

Returns

Promise<T>

Inherited from

BrkClientBase.getJson


getLivePrice()

getLivePrice(options?): Promise<number>

Defined in: Developer/brk/modules/brk-client/index.js:12820

Live BTC/USD price

Returns the current BTC/USD price in dollars, derived from on-chain round-dollar output patterns in the last 12 blocks plus mempool.

Endpoint: GET /api/mempool/price

Parameters

options?
cache?

boolean

memCache?

boolean

onValue?

(value) => void

signal?

AbortSignal

Returns

Promise<number>


getMempool()

getMempool(options?): Promise<MempoolInfo>

Defined in: Developer/brk/modules/brk-client/index.js:12698

Mempool statistics

Get current mempool statistics including transaction count, total vsize, total fees, and fee histogram.

Mempool.space docs

Endpoint: GET /api/mempool

Parameters

options?
cache?

boolean

memCache?

boolean

onValue?

(value) => void

signal?

AbortSignal

Returns

Promise<MempoolInfo>


getMempoolBlocks()

getMempoolBlocks(options?): Promise<MempoolBlock[]>

Defined in: Developer/brk/modules/brk-client/index.js:12650

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

Parameters

options?
cache?

boolean

memCache?

boolean

onValue?

(value) => void

signal?

AbortSignal

Returns

Promise<MempoolBlock[]>


getMempoolHash()

getMempoolHash(options?): Promise<number>

Defined in: Developer/brk/modules/brk-client/index.js:12712

Mempool content hash

Returns an opaque hash that changes whenever the projected next block changes. Same value as the mempool ETag. Useful as a freshness/liveness signal: if it stays constant for tens of seconds on a live network, the mempool sync loop has stalled.

Endpoint: GET /api/mempool/hash

Parameters

options?
cache?

boolean

memCache?

boolean

onValue?

(value) => void

signal?

AbortSignal

Returns

Promise<number>


getMempoolRecent()

getMempoolRecent(options?): Promise<MempoolRecentTx[]>

Defined in: Developer/brk/modules/brk-client/index.js:12744

Recent mempool transactions

Get the last 10 transactions to enter the mempool.

Mempool.space docs

Endpoint: GET /api/mempool/recent

Parameters

options?
cache?

boolean

memCache?

boolean

onValue?

(value) => void

signal?

AbortSignal

Returns

Promise<MempoolRecentTx[]>


getMempoolTxids()

getMempoolTxids(options?): Promise<string[]>

Defined in: Developer/brk/modules/brk-client/index.js:12728

Mempool transaction IDs

Get all transaction IDs currently in the mempool.

Mempool.space docs

Endpoint: GET /api/mempool/txids

Parameters

options?
cache?

boolean

memCache?

boolean

onValue?

(value) => void

signal?

AbortSignal

Returns

Promise<string[]>


getOpenapi()

getOpenapi(options?): Promise<any>

Defined in: Developer/brk/modules/brk-client/index.js:13146

OpenAPI specification

Full OpenAPI 3.1 specification for this API.

Endpoint: GET /openapi.json

Parameters

options?
cache?

boolean

memCache?

boolean

onValue?

(value) => void

signal?

AbortSignal

Returns

Promise<any>


getOracleHistogramOutputs()

getOracleHistogramOutputs(point, options?): Promise<number[]>

Defined in: Developer/brk/modules/brk-client/index.js:12896

Output value histogram at height or day

Unfiltered output value histogram for a confirmed point. A block height (840000) gives every output in that block, coinbase included, binned by value on the oracle log scale; a calendar date (YYYY-MM-DD) sums every block that day. A flat array of log-scale bins.

Endpoint: GET /api/oracle/histogram/outputs/{point}

Parameters

point

string

Confirmed block height as decimal digits (840000) or calendar date in YYYY-MM-DD format.

options?
cache?

boolean

memCache?

boolean

onValue?

(value) => void

signal?

AbortSignal

Returns

Promise<number[]>


getOracleHistogramOutputsLive()

getOracleHistogramOutputsLive(options?): Promise<number[]>

Defined in: Developer/brk/modules/brk-client/index.js:12879

Live output value histogram

Live unfiltered output value histogram for the forming mempool block. Every live output is binned by value on the oracle log scale; no oracle payment filters are applied. A flat array of log-scale bins, all zero when no mempool is configured.

Endpoint: GET /api/oracle/histogram/outputs/live

Parameters

options?
cache?

boolean

memCache?

boolean

onValue?

(value) => void

signal?

AbortSignal

Returns

Promise<number[]>


getOracleHistogramPayments()

getOracleHistogramPayments(point, options?): Promise<number[]>

Defined in: Developer/brk/modules/brk-client/index.js:12865

Payment output histogram at height or day

Smoothed histogram of oracle-eligible payment outputs for a confirmed point. A block height (840000) gives that block's oracle payment histogram; a calendar date (YYYY-MM-DD) gives the average of that day's per-block payment histograms. A flat array of log-scale bins.

Endpoint: GET /api/oracle/histogram/payments/{point}

Parameters

point

string

Confirmed block height as decimal digits (840000) or calendar date in YYYY-MM-DD format.

options?
cache?

boolean

memCache?

boolean

onValue?

(value) => void

signal?

AbortSignal

Returns

Promise<number[]>


getOracleHistogramPaymentsLive()

getOracleHistogramPaymentsLive(options?): Promise<number[]>

Defined in: Developer/brk/modules/brk-client/index.js:12848

Live payment output histogram

Live smoothed histogram of oracle-eligible payment outputs, binned by output value on the oracle log scale. It combines the committed oracle window with the forming mempool block. A flat array of log-scale bins.

Endpoint: GET /api/oracle/histogram/payments/live

Parameters

options?
cache?

boolean

memCache?

boolean

onValue?

(value) => void

signal?

AbortSignal

Returns

Promise<number[]>


getOraclePrice()

getOraclePrice(options?): Promise<number>

Defined in: Developer/brk/modules/brk-client/index.js:12834

Live BTC/USD price

Current BTC/USD price in dollars. Same value as GET /api/mempool/price. Confirmed per-height history is available at GET /api/series/price/height.

Endpoint: GET /api/oracle/price

Parameters

options?
cache?

boolean

memCache?

boolean

onValue?

(value) => void

signal?

AbortSignal

Returns

Promise<number>


getPool()

getPool(slug, options?): Promise<PoolDetail>

Defined in: Developer/brk/modules/brk-client/index.js:12387

Mining pool details

Get detailed information about a specific mining pool including block counts and shares for different time periods.

Mempool.space docs

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

Parameters

slug

PoolSlug

options?
cache?

boolean

memCache?

boolean

onValue?

(value) => void

signal?

AbortSignal

Returns

Promise<PoolDetail>


getPoolBlocks()

getPoolBlocks(slug, options?): Promise<BlockInfoV1[]>

Defined in: Developer/brk/modules/brk-client/index.js:12457

Mining pool blocks

Get the 10 most recent blocks mined by a specific pool.

Mempool.space docs

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

Parameters

slug

PoolSlug

options?
cache?

boolean

memCache?

boolean

onValue?

(value) => void

signal?

AbortSignal

Returns

Promise<BlockInfoV1[]>


getPoolBlocksFrom()

getPoolBlocksFrom(slug, height, options?): Promise<BlockInfoV1[]>

Defined in: Developer/brk/modules/brk-client/index.js:12476

Mining pool blocks from height

Get 10 blocks mined by a specific pool before (and including) the given height.

Mempool.space docs

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

Parameters

slug

PoolSlug

height

number

options?
cache?

boolean

memCache?

boolean

onValue?

(value) => void

signal?

AbortSignal

Returns

Promise<BlockInfoV1[]>


getPoolHashrate()

getPoolHashrate(slug, options?): Promise<PoolHashrateEntry[]>

Defined in: Developer/brk/modules/brk-client/index.js:12439

Mining pool hashrate

Get hashrate history for a specific mining pool.

Mempool.space docs

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

Parameters

slug

PoolSlug

options?
cache?

boolean

memCache?

boolean

onValue?

(value) => void

signal?

AbortSignal

Returns

Promise<PoolHashrateEntry[]>


getPools()

getPools(options?): Promise<PoolInfo[]>

Defined in: Developer/brk/modules/brk-client/index.js:12351

List all mining pools

Get list of all known mining pools with their identifiers.

Mempool.space docs

Endpoint: GET /api/v1/mining/pools

Parameters

options?
cache?

boolean

memCache?

boolean

onValue?

(value) => void

signal?

AbortSignal

Returns

Promise<PoolInfo[]>


getPoolsHashrate()

getPoolsHashrate(options?): Promise<PoolHashrateEntry[]>

Defined in: Developer/brk/modules/brk-client/index.js:12403

All pools hashrate (all time)

Get hashrate data for all mining pools.

Mempool.space docs

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

Parameters

options?
cache?

boolean

memCache?

boolean

onValue?

(value) => void

signal?

AbortSignal

Returns

Promise<PoolHashrateEntry[]>


getPoolsHashrateByPeriod()

getPoolsHashrateByPeriod(time_period, options?): Promise<PoolHashrateEntry[]>

Defined in: Developer/brk/modules/brk-client/index.js:12421

All pools hashrate

Get hashrate data for all mining pools for a time period. Valid periods: 1m, 3m, 6m, 1y, 2y, 3y.

Mempool.space docs

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

Parameters

time_period

TimePeriod

options?
cache?

boolean

memCache?

boolean

onValue?

(value) => void

signal?

AbortSignal

Returns

Promise<PoolHashrateEntry[]>


getPoolStats()

getPoolStats(time_period, options?): Promise<PoolsSummary>

Defined in: Developer/brk/modules/brk-client/index.js:12369

Mining pool statistics

Get mining pool statistics for a time period. Valid periods: 24h, 3d, 1w, 1m, 3m, 6m, 1y, 2y, 3y.

Mempool.space docs

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

Parameters

time_period

TimePeriod

options?
cache?

boolean

memCache?

boolean

onValue?

(value) => void

signal?

AbortSignal

Returns

Promise<PoolsSummary>


getPreciseFees()

getPreciseFees(options?): Promise<RecommendedFees>

Defined in: Developer/brk/modules/brk-client/index.js:12682

Precise recommended fees

Recommended fee rates with sub-integer precision.

Mempool.space docs

Endpoint: GET /api/v1/fees/precise

Parameters

options?
cache?

boolean

memCache?

boolean

onValue?

(value) => void

signal?

AbortSignal

Returns

Promise<RecommendedFees>


getPrices()

getPrices(options?): Promise<Prices>

Defined in: Developer/brk/modules/brk-client/index.js:11869

Current BTC price

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

Mempool.space docs

Endpoint: GET /api/v1/prices

Parameters

options?
cache?

boolean

memCache?

boolean

onValue?

(value) => void

signal?

AbortSignal

Returns

Promise<Prices>


getRecommendedFees()

getRecommendedFees(options?): Promise<RecommendedFees>

Defined in: Developer/brk/modules/brk-client/index.js:12666

Recommended fees

Recommended fee rates by confirmation target.

Mempool.space docs

Endpoint: GET /api/v1/fees/recommended

Parameters

options?
cache?

boolean

memCache?

boolean

onValue?

(value) => void

signal?

AbortSignal

Returns

Promise<RecommendedFees>


getReplacements()

getReplacements(options?): Promise<ReplacementNode[]>

Defined in: Developer/brk/modules/brk-client/index.js:12760

Recent RBF replacements

Returns up to 25 most-recent RBF replacement trees across the whole mempool. Each entry has the same shape as tx_rbf().replacements.

Mempool.space docs

Endpoint: GET /api/v1/replacements

Parameters

options?
cache?

boolean

memCache?

boolean

onValue?

(value) => void

signal?

AbortSignal

Returns

Promise<ReplacementNode[]>


getRewardStats()

getRewardStats(block_count, options?): Promise<RewardStats>

Defined in: Developer/brk/modules/brk-client/index.js:12562

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}

Parameters

block_count

number

Number of recent blocks to include

options?
cache?

boolean

memCache?

boolean

onValue?

(value) => void

signal?

AbortSignal

Returns

Promise<RewardStats>


getSeries()

getSeries(series, index, start?, end?, limit?, format?, options?): Promise<string | AnySeriesData>

Defined in: Developer/brk/modules/brk-client/index.js:11642

Get series data

Fetch data for a specific series at the given index. Use query parameters to filter by date range and format (json/csv).

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

Parameters

series

string

Series name

index

Index

Aggregation index

start?

number

Inclusive start: integer index, date (YYYY-MM-DD), or timestamp (ISO 8601). Negative integers count from end. Aliases: from, f, s

end?

number

Exclusive end: integer index, date (YYYY-MM-DD), or timestamp (ISO 8601). Negative integers count from end. Aliases: to, t, e

limit?

number

Maximum number of values to return (ignored if end is set). Aliases: count, c, l

format?

Format

Format of the output

options?
cache?

boolean

memCache?

boolean

onValue?

(value) => void

signal?

AbortSignal

Returns

Promise<string | AnySeriesData>


getSeriesBulk()

getSeriesBulk(series, index, start?, end?, limit?, format?, options?): Promise<string | AnySeriesData[]>

Defined in: Developer/brk/modules/brk-client/index.js:11749

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

Parameters

series

string

Requested series

index

Index

Index to query

start?

number

Inclusive start: integer index, date (YYYY-MM-DD), or timestamp (ISO 8601). Negative integers count from end. Aliases: from, f, s

end?

number

Exclusive end: integer index, date (YYYY-MM-DD), or timestamp (ISO 8601). Negative integers count from end. Aliases: to, t, e

limit?

number

Maximum number of values to return (ignored if end is set). Aliases: count, c, l

format?

Format

Format of the output

options?
cache?

boolean

memCache?

boolean

onValue?

(value) => void

signal?

AbortSignal

Returns

Promise<string | AnySeriesData[]>


getSeriesCount()

getSeriesCount(options?): Promise<SeriesCount[]>

Defined in: Developer/brk/modules/brk-client/index.js:11549

Series count

Returns the number of series available per index type.

Endpoint: GET /api/series/count

Parameters

options?
cache?

boolean

memCache?

boolean

onValue?

(value) => void

signal?

AbortSignal

Returns

Promise<SeriesCount[]>


getSeriesData()

getSeriesData(series, index, start?, end?, limit?, format?, options?): Promise<string | boolean[]>

Defined in: Developer/brk/modules/brk-client/index.js:11670

Get raw series data

Returns just 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

Parameters

series

string

Series name

index

Index

Aggregation index

start?

number

Inclusive start: integer index, date (YYYY-MM-DD), or timestamp (ISO 8601). Negative integers count from end. Aliases: from, f, s

end?

number

Exclusive end: integer index, date (YYYY-MM-DD), or timestamp (ISO 8601). Negative integers count from end. Aliases: to, t, e

limit?

number

Maximum number of values to return (ignored if end is set). Aliases: count, c, l

format?

Format

Format of the output

options?
cache?

boolean

memCache?

boolean

onValue?

(value) => void

signal?

AbortSignal

Returns

Promise<string | boolean[]>


getSeriesInfo()

getSeriesInfo(series, options?): Promise<SeriesInfo>

Defined in: Developer/brk/modules/brk-client/index.js:11621

Get series info

Returns the supported indexes and value type for the specified series.

Endpoint: GET /api/series/{series}

Parameters

series

string

options?
cache?

boolean

memCache?

boolean

onValue?

(value) => void

signal?

AbortSignal

Returns

Promise<SeriesInfo>


getSeriesLatest()

getSeriesLatest(series, index, options?): Promise<any>

Defined in: Developer/brk/modules/brk-client/index.js:11694

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

Parameters

series

string

Series name

index

Index

Aggregation index

options?
cache?

boolean

memCache?

boolean

onValue?

(value) => void

signal?

AbortSignal

Returns

Promise<any>


getSeriesLen()

getSeriesLen(series, index, options?): Promise<number>

Defined in: Developer/brk/modules/brk-client/index.js:11711

Get series data length

Returns the total number of data points for a series at the given index.

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

Parameters

series

string

Series name

index

Index

Aggregation index

options?
cache?

boolean

memCache?

boolean

onValue?

(value) => void

signal?

AbortSignal

Returns

Promise<number>


getSeriesTree()

getSeriesTree(options?): Promise<TreeNode>

Defined in: Developer/brk/modules/brk-client/index.js:11535

Series catalog

Returns the complete hierarchical catalog of available series organized as a tree structure. Series are grouped by categories and subcategories.

Endpoint: GET /api/series

Parameters

options?
cache?

boolean

memCache?

boolean

onValue?

(value) => void

signal?

AbortSignal

Returns

Promise<TreeNode>


getSeriesVersion()

getSeriesVersion(series, index, options?): Promise<number>

Defined in: Developer/brk/modules/brk-client/index.js:11728

Get series version

Returns the current version of a series. Changes when the series data is updated.

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

Parameters

series

string

Series name

index

Index

Aggregation index

options?
cache?

boolean

memCache?

boolean

onValue?

(value) => void

signal?

AbortSignal

Returns

Promise<number>


getSyncStatus()

getSyncStatus(options?): Promise<SyncStatus>

Defined in: Developer/brk/modules/brk-client/index.js:11507

Sync status

Returns the sync status of the indexer, including indexed height, tip height, blocks behind, and last indexed timestamp.

Endpoint: GET /api/server/sync

Parameters

options?
cache?

boolean

memCache?

boolean

onValue?

(value) => void

signal?

AbortSignal

Returns

Promise<SyncStatus>


getText()

getText(path, options?): Promise<string>

Defined in: Developer/brk/modules/brk-client/index.js:2070

Make a GET request expecting a text response (text/plain, text/csv, ...). Cached and supports onValue, same as getJson.

Parameters

path

string

options?

ClientFetchOptions<string>

Returns

Promise<string>

Inherited from

BrkClientBase.getText


getTransactionTimes()

getTransactionTimes(txId, options?): Promise<number[]>

Defined in: Developer/brk/modules/brk-client/index.js:13111

Transaction first-seen times

Returns timestamps when transactions were first seen in the mempool. Returns 0 for mined or unknown transactions.

Mempool.space docs

Endpoint: GET /api/v1/transaction-times

Parameters

txId

string[]

Transaction IDs to look up (max 250 per request).

options?
cache?

boolean

memCache?

boolean

onValue?

(value) => void

signal?

AbortSignal

Returns

Promise<number[]>


getTx()

getTx(txid, options?): Promise<Transaction>

Defined in: Developer/brk/modules/brk-client/index.js:12966

Transaction information

Retrieve complete transaction data by transaction ID (txid). Returns inputs, outputs, fee, size, and confirmation status.

Mempool.space docs

Endpoint: GET /api/tx/{txid}

Parameters

txid

string

options?
cache?

boolean

memCache?

boolean

onValue?

(value) => void

signal?

AbortSignal

Returns

Promise<Transaction>


getTxByIndex()

getTxByIndex(index, options?): Promise<string>

Defined in: Developer/brk/modules/brk-client/index.js:12912

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}

Parameters

index

number

options?
cache?

boolean

memCache?

boolean

onValue?

(value) => void

signal?

AbortSignal

Returns

Promise<string>


getTxHex()

getTxHex(txid, options?): Promise<string>

Defined in: Developer/brk/modules/brk-client/index.js:12984

Transaction hex

Retrieve the raw transaction as a hex-encoded string. Returns the serialized transaction in hexadecimal format.

Mempool.space docs

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

Parameters

txid

string

options?
cache?

boolean

memCache?

boolean

onValue?

(value) => void

signal?

AbortSignal

Returns

Promise<string>


getTxMerkleblockProof()

getTxMerkleblockProof(txid, options?): Promise<string>

Defined in: Developer/brk/modules/brk-client/index.js:13002

Transaction merkleblock proof

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

Mempool.space docs

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

Parameters

txid

string

options?
cache?

boolean

memCache?

boolean

onValue?

(value) => void

signal?

AbortSignal

Returns

Promise<string>


getTxMerkleProof()

getTxMerkleProof(txid, options?): Promise<MerkleProof>

Defined in: Developer/brk/modules/brk-client/index.js:13020

Transaction merkle proof

Get the merkle inclusion proof for a transaction.

Mempool.space docs

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

Parameters

txid

string

options?
cache?

boolean

memCache?

boolean

onValue?

(value) => void

signal?

AbortSignal

Returns

Promise<MerkleProof>


getTxOutspend()

getTxOutspend(txid, vout, options?): Promise<TxOutspend>

Defined in: Developer/brk/modules/brk-client/index.js:13039

Output spend status

Get the spending status of a transaction output. Returns whether the output has been spent and, if so, the spending transaction details.

Mempool.space docs

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

Parameters

txid

string

Transaction ID

vout

number

Output index

options?
cache?

boolean

memCache?

boolean

onValue?

(value) => void

signal?

AbortSignal

Returns

Promise<TxOutspend>


getTxOutspends()

getTxOutspends(txid, options?): Promise<TxOutspend[]>

Defined in: Developer/brk/modules/brk-client/index.js:13057

All output spend statuses

Get the spending status of all outputs in a transaction. Returns an array with the spend status for each output.

Mempool.space docs

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

Parameters

txid

string

options?
cache?

boolean

memCache?

boolean

onValue?

(value) => void

signal?

AbortSignal

Returns

Promise<TxOutspend[]>


getTxRaw()

getTxRaw(txid, options?): Promise<Uint8Array<ArrayBufferLike>>

Defined in: Developer/brk/modules/brk-client/index.js:13075

Transaction raw

Returns a transaction as binary data.

Mempool.space docs

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

Parameters

txid

string

options?
cache?

boolean

memCache?

boolean

onValue?

(value) => void

signal?

AbortSignal

Returns

Promise<Uint8Array<ArrayBufferLike>>


getTxRbf()

getTxRbf(txid, options?): Promise<RbfResponse>

Defined in: Developer/brk/modules/brk-client/index.js:12948

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

Parameters

txid

string

options?
cache?

boolean

memCache?

boolean

onValue?

(value) => void

signal?

AbortSignal

Returns

Promise<RbfResponse>


getTxStatus()

getTxStatus(txid, options?): Promise<TxStatus>

Defined in: Developer/brk/modules/brk-client/index.js:13093

Transaction status

Retrieve the confirmation status of a transaction. Returns whether the transaction is confirmed and, if so, the block height, hash, and timestamp.

Mempool.space docs

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

Parameters

txid

string

options?
cache?

boolean

memCache?

boolean

onValue?

(value) => void

signal?

AbortSignal

Returns

Promise<TxStatus>


getUrpd()

getUrpd(cohort, agg?, weight?, options?): Promise<Urpd>

Defined in: Developer/brk/modules/brk-client/index.js:11810

Latest URPD

URPD for the most recent available date in the cohort. The response's date field echoes which date was served. Returns { cohort, date, weight, aggregation, close, total_supply, buckets }. close and each bucket's price_floor, realized_cap, and unrealized_pnl are USD; total_supply and bucket supply are BTC. unrealized_pnl can be negative.

Endpoint: GET /api/urpd/{cohort}

Parameters

cohort

Cohort

agg?

UrpdAggregation

Aggregation strategy. Default: raw (no aggregation). Accepts bucket as alias.

weight?

UrpdWeight

Supply weighting. Default: raw (unweighted).

options?
cache?

boolean

memCache?

boolean

onValue?

(value) => void

signal?

AbortSignal

Returns

Promise<Urpd>


getUrpdAt()

getUrpdAt(cohort, date, agg?, weight?, options?): Promise<Urpd>

Defined in: Developer/brk/modules/brk-client/index.js:11833

URPD at date

URPD for a (cohort, date) pair. Returns { cohort, date, weight, aggregation, close, total_supply, buckets } where each bucket is { price_floor, supply, realized_cap, unrealized_pnl }. close, price_floor, realized_cap, and unrealized_pnl are USD; total_supply and supply are BTC. unrealized_pnl can be negative.

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

Parameters

cohort

Cohort

date

string

Calendar date of the URPD snapshot in YYYY-MM-DD format.

agg?

UrpdAggregation

Aggregation strategy. Default: raw (no aggregation). Accepts bucket as alias.

weight?

UrpdWeight

Supply weighting. Default: raw (unweighted).

options?
cache?

boolean

memCache?

boolean

onValue?

(value) => void

signal?

AbortSignal

Returns

Promise<Urpd>


getVersion()

getVersion(options?): Promise<string>

Defined in: Developer/brk/modules/brk-client/index.js:11493

API version

Returns the current version of the API server

Endpoint: GET /version

Parameters

options?
cache?

boolean

memCache?

boolean

onValue?

(value) => void

signal?

AbortSignal

Returns

Promise<string>


indexToDate()

indexToDate(index, i): Date

Defined in: Developer/brk/modules/brk-client/index.js:9549

Convert an index value to a Date for date-based indexes.

Parameters

index

Index

The index type

i

number

The index value

Returns

Date


listSeries()

listSeries(page?, per_page?, options?): Promise<PaginatedSeries>

Defined in: Developer/brk/modules/brk-client/index.js:11580

Series list

Paginated flat list of all available series names. Use page query param for pagination.

Endpoint: GET /api/series/list

Parameters

page?

number

Pagination index

per_page?

number

Results per page (default: 1000, max: 1000)

options?
cache?

boolean

memCache?

boolean

onValue?

(value) => void

signal?

AbortSignal

Returns

Promise<PaginatedSeries>


listUrpdCohorts()

listUrpdCohorts(options?): Promise<Cohort[]>

Defined in: Developer/brk/modules/brk-client/index.js:11772

Available URPD cohorts

Cohorts for which URPD data is available. Returns names like all, sth, lth, utxos_under_1h_old.

Endpoint: GET /api/urpd

Parameters

options?
cache?

boolean

memCache?

boolean

onValue?

(value) => void

signal?

AbortSignal

Returns

Promise<Cohort[]>


listUrpdDates()

listUrpdDates(cohort, weight?, options?): Promise<number[]>

Defined in: Developer/brk/modules/brk-client/index.js:11789

Available URPD dates

Dates for which a URPD snapshot is available for the cohort and selected weight. One entry per UTC day, sorted ascending.

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

Parameters

cohort

Cohort

weight?

UrpdWeight

Supply weighting. Default: raw (unweighted).

options?
cache?

boolean

memCache?

boolean

onValue?

(value) => void

signal?

AbortSignal

Returns

Promise<number[]>


post()

post(path, body, options?): Promise<Response>

Defined in: Developer/brk/modules/brk-client/index.js:2096

Make a POST request with a string body.

POST responses are uncached and never invoke onValue — every call hits the network with the same body and returns the upstream response.

Parameters

path

string

body

string

options?
signal?

AbortSignal

Returns

Promise<Response>

Inherited from

BrkClientBase.post


postBytes()

postBytes(path, body, options?): Promise<Uint8Array<ArrayBufferLike>>

Defined in: Developer/brk/modules/brk-client/index.js:2141

Make a POST request expecting binary data (application/octet-stream).

Parameters

path

string

body

string

options?
signal?

AbortSignal

Returns

Promise<Uint8Array<ArrayBufferLike>>

Inherited from

BrkClientBase.postBytes


postJson()

postJson<T>(path, body, options?): Promise<T>

Defined in: Developer/brk/modules/brk-client/index.js:2117

Make a POST request expecting a JSON response.

Type Parameters

T

T

Parameters

path

string

body

string

options?
signal?

AbortSignal

Returns

Promise<T>

Inherited from

BrkClientBase.postJson


postText()

postText(path, body, options?): Promise<string>

Defined in: Developer/brk/modules/brk-client/index.js:2129

Make a POST request expecting a text response.

Parameters

path

string

body

string

options?
signal?

AbortSignal

Returns

Promise<string>

Inherited from

BrkClientBase.postText


postTx()

postTx(body, options?): Promise<string>

Defined in: Developer/brk/modules/brk-client/index.js:13132

Broadcast transaction

Broadcast a raw transaction to the network. The transaction should be provided as hex in the request body. The txid will be returned on success.

Mempool.space docs

Endpoint: POST /api/tx

Parameters

body

string

Request body

options?
signal?

AbortSignal

Returns

Promise<string>


searchSeries()

searchSeries(q, limit?, options?): Promise<string[]>

Defined in: Developer/brk/modules/brk-client/index.js:11601

Search series

Fuzzy search for series by name. Supports partial matches and typos.

Endpoint: GET /api/series/search

Parameters

q

string

Search query string

limit?

number

Maximum number of results

options?
cache?

boolean

memCache?

boolean

onValue?

(value) => void

signal?

AbortSignal

Returns

Promise<string[]>


seriesEndpoint()

seriesEndpoint(series, index): SeriesEndpoint<unknown>

Defined in: Developer/brk/modules/brk-client/index.js:11466

Create a dynamic series endpoint builder for any series/index combination.

Use this for programmatic access when the series name is determined at runtime. For type-safe access, use the series tree instead.

Parameters

series

string

The series name

index

Index

The index name

Returns

SeriesEndpoint<unknown>


validateAddress()

validateAddress(address, options?): Promise<AddrValidation>

Defined in: Developer/brk/modules/brk-client/index.js:12035

Validate address

Validate a Bitcoin address and get information about its type and scriptPubKey. Returns isvalid: false with an error message for invalid addresses.

Mempool.space docs

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

Parameters

address

string

Bitcoin address to validate (can be any string)

options?
cache?

boolean

memCache?

boolean

onValue?

(value) => void

signal?

AbortSignal

Returns

Promise<AddrValidation>


addressPayloadHashPrefix()

static addressPayloadHashPrefix(payload, nibbles): string

Defined in: Developer/brk/modules/brk-client/index.js:9579

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

Parameters

payload

number[] | ArrayBuffer | Uint8Array<ArrayBufferLike> | ArrayBufferView<ArrayBufferLike>

nibbles

number

Returns

string