global: snapshot

This commit is contained in:
nym21
2026-03-31 22:53:25 +02:00
parent d038141a8a
commit ae26db6df2
83 changed files with 3398 additions and 710 deletions
+457 -15
View File
@@ -107,6 +107,37 @@
* @typedef {Object} BlockCountParam
* @property {number} blockCount - Number of recent blocks to include
*/
/**
* Extended block data matching mempool.space /api/v1/blocks extras
*
* @typedef {Object} BlockExtras
* @property {Sats} totalFees - Total fees in satoshis
* @property {FeeRate} medianFee - Median fee rate in sat/vB
* @property {FeeRate[]} feeRange - Fee rate range: [min, 10%, 25%, 50%, 75%, 90%, max]
* @property {Sats} reward - Total block reward (subsidy + fees) in satoshis
* @property {BlockPool} pool - Mining pool that mined this block
* @property {Sats} avgFee - Average fee per transaction in satoshis
* @property {FeeRate} avgFeeRate - Average fee rate in sat/vB
* @property {string} coinbaseRaw - Raw coinbase transaction scriptsig as hex
* @property {?string=} coinbaseAddress - Primary coinbase output address
* @property {string[]} coinbaseAddresses - All coinbase output addresses
* @property {string} coinbaseSignature - Coinbase output script in ASM format
* @property {string} coinbaseSignatureAscii - Coinbase scriptsig decoded as ASCII
* @property {number} avgTxSize - Average transaction size in bytes
* @property {number} totalInputs - Total number of inputs (excluding coinbase)
* @property {number} totalOutputs - Total number of outputs
* @property {Sats} totalOutputAmt - Total output amount in satoshis
* @property {Sats} medianFeeAmt - Median fee amount in satoshis
* @property {Sats[]} feePercentiles - Fee amount percentiles in satoshis: [min, 10%, 25%, 50%, 75%, 90%, max]
* @property {number} segwitTotalTxs - Number of segwit transactions
* @property {number} segwitTotalSize - Total size of segwit transactions in bytes
* @property {Weight} segwitTotalWeight - Total weight of segwit transactions
* @property {string} header - Raw 80-byte block header as hex
* @property {number} utxoSetChange - UTXO set change (outputs created minus inputs spent)
* @property {number} utxoSetSize - Total UTXO set size at this height
* @property {Sats} totalInputAmt - Total input amount in satoshis
* @property {number} virtualSize - Virtual size in vbytes
*/
/**
* A single block fees data point.
*
@@ -135,16 +166,51 @@
* @property {TxIndex} index - Transaction index within the block (0-based)
*/
/**
* Block information returned by the API
* Block information matching mempool.space /api/block/{hash}
*
* @typedef {Object} BlockInfo
* @property {BlockHash} id - Block hash
* @property {Height} height - Block height
* @property {number} version - Block version, used for soft fork signaling
* @property {BlockHash} previousblockhash - Previous block hash
* @property {string} merkleRoot - Merkle root of the transaction tree
* @property {number} time - Block timestamp as claimed by the miner (Unix time)
* @property {number} bits - Compact target (bits)
* @property {number} nonce - Nonce used to produce a valid block hash
* @property {Timestamp} timestamp - Block timestamp (Unix time)
* @property {number} txCount - Number of transactions in the block
* @property {number} size - Block size in bytes
* @property {Weight} weight - Block weight in weight units
* @property {Timestamp} mediantime - Median time of the last 11 blocks
* @property {number} difficulty - Block difficulty
*/
/**
* Block information with extras, matching mempool.space /api/v1/blocks
*
* @typedef {Object} BlockInfoV1
* @property {BlockHash} id - Block hash
* @property {Height} height - Block height
* @property {number} version - Block version, used for soft fork signaling
* @property {BlockHash} previousblockhash - Previous block hash
* @property {string} merkleRoot - Merkle root of the transaction tree
* @property {number} time - Block timestamp as claimed by the miner (Unix time)
* @property {number} bits - Compact target (bits)
* @property {number} nonce - Nonce used to produce a valid block hash
* @property {Timestamp} timestamp - Block timestamp (Unix time)
* @property {number} difficulty - Block difficulty as a floating point number
* @property {number} txCount - Number of transactions in the block
* @property {number} size - Block size in bytes
* @property {Weight} weight - Block weight in weight units
* @property {Timestamp} mediantime - Median time of the last 11 blocks
* @property {number} difficulty - Block difficulty
* @property {BlockExtras} extras - Extended block data
*/
/**
* Mining pool identification for a block
*
* @typedef {Object} BlockPool
* @property {number} id - Unique pool identifier
* @property {string} name - Pool name
* @property {PoolSlug} slug - URL-friendly pool identifier
*/
/**
* A single block rewards data point.
@@ -228,6 +294,17 @@
*
* @typedef {string} Cohort
*/
/**
* Coinbase scriptSig tag for pool identification.
*
* Stored as a fixed 101-byte record (1 byte length + 100 bytes data).
* Uses `[u8; 101]` internally so that `size_of::<CoinbaseTag>()` matches
* the serialized `Bytes::Array` size (vecdb requires this for alignment).
*
* Bitcoin consensus limits coinbase scriptSig to 2-100 bytes.
*
* @typedef {string} CoinbaseTag
*/
/**
* Bucket type for cost basis aggregation.
* Options: raw (no aggregation), lin200/lin500/lin1000 (linear $200/$500/$1000),
@@ -261,6 +338,22 @@
*
* @typedef {("supply"|"realized"|"unrealized")} CostBasisValue
*/
/**
* A transaction in a CPFP relationship
*
* @typedef {Object} CpfpEntry
* @property {Txid} txid
* @property {Weight} weight
* @property {Sats} fee
*/
/**
* CPFP (Child Pays For Parent) information for a transaction
*
* @typedef {Object} CpfpInfo
* @property {CpfpEntry[]} ancestors
* @property {CpfpEntry[]} descendants
* @property {FeeRate} effectiveFeePerVsize
*/
/**
* Data range with output format for API query parameters
*
@@ -357,6 +450,11 @@
* @property {string} message - Human-readable description
* @property {string} docUrl - Link to API documentation
*/
/**
* Exchange rates (USD base, on-chain only no fiat pairs available)
*
* @typedef {Object} ExchangeRates
*/
/**
* Fee rate in sats/vB
*
@@ -433,6 +531,20 @@
*
* @typedef {Dollars} High
*/
/**
* Historical price response
*
* @typedef {Object} HistoricalPrice
* @property {HistoricalPriceEntry[]} prices
* @property {ExchangeRates} exchangeRates
*/
/**
* A single price data point
*
* @typedef {Object} HistoricalPriceEntry
* @property {number} time
* @property {Dollars} uSD
*/
/** @typedef {number} Hour1 */
/** @typedef {number} Hour12 */
/** @typedef {number} Hour4 */
@@ -484,12 +596,30 @@
* @property {FeeRate[]} feeRange - Fee rate range: [min, 10%, 25%, 50%, 75%, 90%, max]
*/
/**
* Mempool statistics
* Mempool statistics with incrementally maintained fee histogram.
*
* @typedef {Object} MempoolInfo
* @property {number} count - Number of transactions in the mempool
* @property {VSize} vsize - Total virtual size of all transactions in the mempool (vbytes)
* @property {Sats} totalFee - Total fees of all transactions in the mempool (satoshis)
* @property {{ [key: string]: VSize }} feeHistogram - Fee histogram: `[[fee_rate, vsize], ...]` sorted by descending fee rate
*/
/**
* Simplified mempool transaction for the recent transactions endpoint
*
* @typedef {Object} MempoolRecentTx
* @property {Txid} txid
* @property {Sats} fee
* @property {VSize} vsize
* @property {Sats} value
*/
/**
* Merkle inclusion proof for a transaction
*
* @typedef {Object} MerkleProof
* @property {Height} blockHeight
* @property {string[]} merkle
* @property {number} pos
*/
/** @typedef {number} Minute10 */
/** @typedef {number} Minute30 */
@@ -529,6 +659,10 @@
*
* @typedef {Dollars} Open
*/
/**
* @typedef {Object} OptionalTimestampParam
* @property {(Timestamp|null)=} timestamp
*/
/** @typedef {number} OutPoint */
/**
* Type (P2PKH, P2WPKH, P2SH, P2TR, etc.)
@@ -607,6 +741,15 @@
* @property {string[]} regexes - Coinbase tag patterns (regexes)
* @property {PoolSlug} slug - URL-friendly pool identifier
*/
/**
* A single pool hashrate data point.
*
* @typedef {Object} PoolHashrateEntry
* @property {Timestamp} timestamp - Unix timestamp.
* @property {number} avgHashrate - Average hashrate (H/s).
* @property {number} share - Pool's share of total network hashrate.
* @property {string} poolName - Pool name.
*/
/**
* Basic pool information for listing all pools
*
@@ -616,6 +759,11 @@
* @property {number} uniqueId - Unique numeric pool identifier
*/
/** @typedef {("unknown"|"blockfills"|"ultimuspool"|"terrapool"|"luxor"|"onethash"|"btccom"|"bitfarms"|"huobipool"|"wayicn"|"canoepool"|"btctop"|"bitcoincom"|"pool175btc"|"gbminers"|"axbt"|"asicminer"|"bitminter"|"bitcoinrussia"|"btcserv"|"simplecoinus"|"btcguild"|"eligius"|"ozcoin"|"eclipsemc"|"maxbtc"|"triplemining"|"coinlab"|"pool50btc"|"ghashio"|"stminingcorp"|"bitparking"|"mmpool"|"polmine"|"kncminer"|"bitalo"|"f2pool"|"hhtt"|"megabigpower"|"mtred"|"nmcbit"|"yourbtcnet"|"givemecoins"|"braiinspool"|"antpool"|"multicoinco"|"bcpoolio"|"cointerra"|"kanopool"|"solock"|"ckpool"|"nicehash"|"bitclub"|"bitcoinaffiliatenetwork"|"btcc"|"bwpool"|"exxbw"|"bitsolo"|"bitfury"|"twentyoneinc"|"digitalbtc"|"eightbaochi"|"mybtccoinpool"|"tbdice"|"hashpool"|"nexious"|"bravomining"|"hotpool"|"okexpool"|"bcmonster"|"onehash"|"bixin"|"tatmaspool"|"viabtc"|"connectbtc"|"batpool"|"waterhole"|"dcexploration"|"dcex"|"btpool"|"fiftyeightcoin"|"bitcoinindia"|"shawnp0wers"|"phashio"|"rigpool"|"haozhuzhu"|"sevenpool"|"miningkings"|"hashbx"|"dpool"|"rawpool"|"haominer"|"helix"|"bitcoinukraine"|"poolin"|"secretsuperstar"|"tigerpoolnet"|"sigmapoolcom"|"okpooltop"|"hummerpool"|"tangpool"|"bytepool"|"spiderpool"|"novablock"|"miningcity"|"binancepool"|"minerium"|"lubiancom"|"okkong"|"aaopool"|"emcdpool"|"foundryusa"|"sbicrypto"|"arkpool"|"purebtccom"|"marapool"|"kucoinpool"|"entrustcharitypool"|"okminer"|"titan"|"pegapool"|"btcnuggets"|"cloudhashing"|"digitalxmintsy"|"telco214"|"btcpoolparty"|"multipool"|"transactioncoinmining"|"btcdig"|"trickysbtcpool"|"btcmp"|"eobot"|"unomp"|"patels"|"gogreenlight"|"bitcoinindiapool"|"ekanembtc"|"canoe"|"tiger"|"onem1x"|"zulupool"|"secpool"|"ocean"|"whitepool"|"wiz"|"wk057"|"futurebitapollosolo"|"carbonnegative"|"portlandhodl"|"phoenix"|"neopool"|"maxipool"|"bitfufupool"|"gdpool"|"miningdutch"|"publicpool"|"miningsquared"|"innopolistech"|"btclab"|"parasite"|"redrockpool"|"est3lar")} PoolSlug */
/**
* @typedef {Object} PoolSlugAndHeightParam
* @property {PoolSlug} slug
* @property {Height} height
*/
/**
* @typedef {Object} PoolSlugParam
* @property {PoolSlug} slug
@@ -915,6 +1063,10 @@
* @property {Txid} txid - Transaction ID
* @property {Vout} vout - Output index
*/
/**
* @typedef {Object} TxidsParam
* @property {Txid[]} txId[]
*/
/**
* Index within its type (e.g., 0 for first P2WPKH address)
*
@@ -4159,7 +4311,6 @@ function createTransferPattern(client, acc) {
* @property {SeriesTree_Addrs} addrs
* @property {SeriesTree_Scripts} scripts
* @property {SeriesTree_Mining} mining
* @property {SeriesTree_Positions} positions
* @property {SeriesTree_Cointime} cointime
* @property {SeriesTree_Constants} constants
* @property {SeriesTree_Indexes} indexes
@@ -4175,10 +4326,14 @@ function createTransferPattern(client, acc) {
/**
* @typedef {Object} SeriesTree_Blocks
* @property {SeriesPattern18<BlockHash>} blockhash
* @property {SeriesPattern18<CoinbaseTag>} coinbaseTag
* @property {SeriesTree_Blocks_Difficulty} difficulty
* @property {SeriesTree_Blocks_Time} time
* @property {SeriesTree_Blocks_Size} size
* @property {AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern<Weight>} weight
* @property {SeriesPattern18<StoredU32>} segwitTxs
* @property {SeriesPattern18<StoredU64>} segwitSize
* @property {SeriesPattern18<Weight>} segwitWeight
* @property {SeriesTree_Blocks_Count} count
* @property {SeriesTree_Blocks_Lookback} lookback
* @property {SeriesTree_Blocks_Interval} interval
@@ -4342,6 +4497,7 @@ function createTransferPattern(client, acc) {
* @property {SeriesPattern19<Sats>} outputValue
* @property {_6bBlockTxPattern<Sats>} fee
* @property {_6bBlockTxPattern<FeeRate>} feeRate
* @property {_6bBlockTxPattern<FeeRate>} effectiveFeeRate
*/
/**
@@ -4611,6 +4767,7 @@ function createTransferPattern(client, acc) {
* @property {AverageBlockCumulativeSumPattern3} coinbase
* @property {SeriesTree_Mining_Rewards_Subsidy} subsidy
* @property {SeriesTree_Mining_Rewards_Fees} fees
* @property {SeriesPattern18<Sats>} outputVolume
* @property {BlockCumulativePattern} unclaimed
*/
@@ -4671,10 +4828,6 @@ function createTransferPattern(client, acc) {
* @property {SeriesPattern1<StoredF64>} _1y
*/
/**
* @typedef {Object} SeriesTree_Positions
*/
/**
* @typedef {Object} SeriesTree_Cointime
* @property {SeriesTree_Cointime_Activity} activity
@@ -7586,6 +7739,7 @@ class BrkClient extends BrkClientBase {
return {
blocks: {
blockhash: createSeriesPattern18(this, 'blockhash'),
coinbaseTag: createSeriesPattern18(this, 'coinbase_tag'),
difficulty: {
value: createSeriesPattern1(this, 'difficulty'),
hashrate: createSeriesPattern1(this, 'difficulty_hashrate'),
@@ -7611,6 +7765,9 @@ class BrkClient extends BrkClientBase {
pct90: create_1m1w1y24hPattern(this, 'block_size_pct90'),
},
weight: createAverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern(this, 'block_weight'),
segwitTxs: createSeriesPattern18(this, 'segwit_txs'),
segwitSize: createSeriesPattern18(this, 'segwit_size'),
segwitWeight: createSeriesPattern18(this, 'segwit_weight'),
count: {
target: create_1m1w1y24hPattern(this, 'block_count_target'),
total: createAverageBlockCumulativeSumPattern2(this, 'block_count'),
@@ -7709,6 +7866,7 @@ class BrkClient extends BrkClientBase {
outputValue: createSeriesPattern19(this, 'output_value'),
fee: create_6bBlockTxPattern(this, 'fee'),
feeRate: create_6bBlockTxPattern(this, 'fee_rate'),
effectiveFeeRate: create_6bBlockTxPattern(this, 'effective_fee_rate'),
},
versions: {
v1: createAverageBlockCumulativeSumPattern(this, 'tx_v1'),
@@ -7907,6 +8065,7 @@ class BrkClient extends BrkClientBase {
_1y: createBpsRatioPattern2(this, 'fee_to_subsidy_ratio_1y'),
},
},
outputVolume: createSeriesPattern18(this, 'output_volume'),
unclaimed: createBlockCumulativePattern(this, 'unclaimed_rewards'),
},
hashrate: {
@@ -7925,8 +8084,6 @@ class BrkClient extends BrkClientBase {
value: createPhsReboundThsPattern(this, 'hash_value'),
},
},
positions: {
},
cointime: {
activity: {
coinblocksCreated: createAverageBlockCumulativeSumPattern(this, 'coinblocks_created'),
@@ -9352,16 +9509,16 @@ class BrkClient extends BrkClientBase {
}
/**
* Block by height
* Block hash by height
*
* Retrieve block information by block height. Returns block metadata including hash, timestamp, difficulty, size, weight, and transaction count.
* Retrieve the block hash at a given height. Returns the hash as plain text.
*
* *[Mempool.space docs](https://mempool.space/docs/api/rest#get-block-height)*
*
* Endpoint: `GET /api/block-height/{height}`
*
* @param {Height} height
* @returns {Promise<BlockInfo>}
* @returns {Promise<BlockHash>}
*/
async getBlockByHeight(height) {
return this.getJson(`/api/block-height/${height}`);
@@ -9383,6 +9540,22 @@ class BrkClient extends BrkClientBase {
return this.getJson(`/api/block/${hash}`);
}
/**
* Block header
*
* Returns the hex-encoded block header.
*
* *[Mempool.space docs](https://mempool.space/docs/api/rest#get-block-header)*
*
* Endpoint: `GET /api/block/{hash}/header`
*
* @param {BlockHash} hash
* @returns {Promise<Hex>}
*/
async getBlockHeader(hash) {
return this.getJson(`/api/block/${hash}/header`);
}
/**
* Raw block
*
@@ -9479,6 +9652,34 @@ class BrkClient extends BrkClientBase {
return this.getJson(`/api/blocks`);
}
/**
* Block tip hash
*
* Returns the hash of the last block.
*
* *[Mempool.space docs](https://mempool.space/docs/api/rest#get-block-tip-hash)*
*
* Endpoint: `GET /api/blocks/tip/hash`
* @returns {Promise<BlockHash>}
*/
async getBlockTipHash() {
return this.getJson(`/api/blocks/tip/hash`);
}
/**
* Block tip height
*
* Returns the height of the last block.
*
* *[Mempool.space docs](https://mempool.space/docs/api/rest#get-block-tip-height)*
*
* Endpoint: `GET /api/blocks/tip/height`
* @returns {Promise<Height>}
*/
async getBlockTipHeight() {
return this.getJson(`/api/blocks/tip/height`);
}
/**
* Blocks from height
*
@@ -9502,11 +9703,11 @@ class BrkClient extends BrkClientBase {
*
* *[Mempool.space docs](https://mempool.space/docs/api/rest#get-mempool)*
*
* Endpoint: `GET /api/mempool/info`
* Endpoint: `GET /api/mempool`
* @returns {Promise<MempoolInfo>}
*/
async getMempool() {
return this.getJson(`/api/mempool/info`);
return this.getJson(`/api/mempool`);
}
/**
@@ -9521,6 +9722,20 @@ class BrkClient extends BrkClientBase {
return this.getJson(`/api/mempool/price`);
}
/**
* Recent mempool transactions
*
* Get the last 10 transactions to enter the mempool.
*
* *[Mempool.space docs](https://mempool.space/docs/api/rest#get-mempool-recent)*
*
* Endpoint: `GET /api/mempool/recent`
* @returns {Promise<MempoolRecentTx[]>}
*/
async getMempoolRecent() {
return this.getJson(`/api/mempool/recent`);
}
/**
* Mempool transaction IDs
*
@@ -9867,6 +10082,22 @@ class BrkClient extends BrkClientBase {
return this.getJson(`/api/tx/${txid}/hex`);
}
/**
* Transaction merkle proof
*
* Get the merkle inclusion proof for a transaction.
*
* *[Mempool.space docs](https://mempool.space/docs/api/rest#get-transaction-merkle-proof)*
*
* Endpoint: `GET /api/tx/{txid}/merkle-proof`
*
* @param {Txid} txid
* @returns {Promise<MerkleProof>}
*/
async getTxMerkleProof(txid) {
return this.getJson(`/api/tx/${txid}/merkle-proof`);
}
/**
* Output spend status
*
@@ -9900,6 +10131,22 @@ class BrkClient extends BrkClientBase {
return this.getJson(`/api/tx/${txid}/outspends`);
}
/**
* Transaction raw
*
* Returns a transaction as binary data.
*
* *[Mempool.space docs](https://mempool.space/docs/api/rest#get-transaction-raw)*
*
* Endpoint: `GET /api/tx/{txid}/raw`
*
* @param {Txid} txid
* @returns {Promise<number[]>}
*/
async getTxRaw(txid) {
return this.getJson(`/api/tx/${txid}/raw`);
}
/**
* Transaction status
*
@@ -9916,6 +10163,68 @@ class BrkClient extends BrkClientBase {
return this.getJson(`/api/tx/${txid}/status`);
}
/**
* Block (v1)
*
* Returns block details with extras by hash.
*
* *[Mempool.space docs](https://mempool.space/docs/api/rest#get-block-v1)*
*
* Endpoint: `GET /api/v1/block/{hash}`
*
* @param {BlockHash} hash
* @returns {Promise<BlockInfoV1>}
*/
async getBlockV1(hash) {
return this.getJson(`/api/v1/block/${hash}`);
}
/**
* Recent blocks with extras
*
* Retrieve the last 10 blocks with extended data including pool identification and fee statistics.
*
* *[Mempool.space docs](https://mempool.space/docs/api/rest#get-blocks-v1)*
*
* Endpoint: `GET /api/v1/blocks`
* @returns {Promise<BlockInfoV1[]>}
*/
async getBlocksV1() {
return this.getJson(`/api/v1/blocks`);
}
/**
* Blocks from height with extras
*
* Retrieve up to 10 blocks with extended data going backwards from the given height.
*
* *[Mempool.space docs](https://mempool.space/docs/api/rest#get-blocks-v1)*
*
* Endpoint: `GET /api/v1/blocks/{height}`
*
* @param {Height} height
* @returns {Promise<BlockInfoV1[]>}
*/
async getBlocksV1FromHeight(height) {
return this.getJson(`/api/v1/blocks/${height}`);
}
/**
* CPFP info
*
* Returns ancestors and descendants for a CPFP transaction.
*
* *[Mempool.space docs](https://mempool.space/docs/api/rest#get-children-pay-for-parent)*
*
* Endpoint: `GET /api/v1/cpfp/{txid}`
*
* @param {Txid} txid
* @returns {Promise<CpfpInfo>}
*/
async getCpfp(txid) {
return this.getJson(`/api/v1/cpfp/${txid}`);
}
/**
* Difficulty adjustment
*
@@ -9944,6 +10253,20 @@ class BrkClient extends BrkClientBase {
return this.getJson(`/api/v1/fees/mempool-blocks`);
}
/**
* Precise recommended fees
*
* Get recommended fee rates with up to 3 decimal places, including sub-sat feerates.
*
* *[Mempool.space docs](https://mempool.space/docs/api/rest#get-recommended-fees-precise)*
*
* Endpoint: `GET /api/v1/fees/precise`
* @returns {Promise<RecommendedFees>}
*/
async getPreciseFees() {
return this.getJson(`/api/v1/fees/precise`);
}
/**
* Recommended fees
*
@@ -9958,6 +10281,26 @@ class BrkClient extends BrkClientBase {
return this.getJson(`/api/v1/fees/recommended`);
}
/**
* Historical price
*
* Get historical BTC/USD price. Optionally specify a UNIX timestamp to get the price at that time.
*
* *[Mempool.space docs](https://mempool.space/docs/api/rest#get-historical-price)*
*
* Endpoint: `GET /api/v1/historical-price`
*
* @param {Timestamp=} [timestamp]
* @returns {Promise<HistoricalPrice>}
*/
async getHistoricalPrice(timestamp) {
const params = new URLSearchParams();
if (timestamp !== undefined) params.set('timestamp', String(timestamp));
const query = params.toString();
const path = `/api/v1/historical-price${query ? '?' + query : ''}`;
return this.getJson(path);
}
/**
* Block fee rates (WIP)
*
@@ -10082,6 +10425,36 @@ class BrkClient extends BrkClientBase {
return this.getJson(`/api/v1/mining/hashrate`);
}
/**
* All pools hashrate (all time)
*
* Get hashrate data for all mining pools.
*
* *[Mempool.space docs](https://mempool.space/docs/api/rest#get-mining-pool-hashrates)*
*
* Endpoint: `GET /api/v1/mining/hashrate/pools`
* @returns {Promise<PoolHashrateEntry[]>}
*/
async getPoolsHashrate() {
return this.getJson(`/api/v1/mining/hashrate/pools`);
}
/**
* 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](https://mempool.space/docs/api/rest#get-mining-pool-hashrates)*
*
* Endpoint: `GET /api/v1/mining/hashrate/pools/{time_period}`
*
* @param {TimePeriod} time_period
* @returns {Promise<PoolHashrateEntry[]>}
*/
async getPoolsHashrateByPeriod(time_period) {
return this.getJson(`/api/v1/mining/hashrate/pools/${time_period}`);
}
/**
* Network hashrate
*
@@ -10114,6 +10487,55 @@ class BrkClient extends BrkClientBase {
return this.getJson(`/api/v1/mining/pool/${slug}`);
}
/**
* Mining pool blocks
*
* Get the 10 most recent blocks mined by a specific pool.
*
* *[Mempool.space docs](https://mempool.space/docs/api/rest#get-mining-pool-blocks)*
*
* Endpoint: `GET /api/v1/mining/pool/{slug}/blocks`
*
* @param {PoolSlug} slug
* @returns {Promise<BlockInfoV1[]>}
*/
async getPoolBlocks(slug) {
return this.getJson(`/api/v1/mining/pool/${slug}/blocks`);
}
/**
* Mining pool blocks from height
*
* Get 10 blocks mined by a specific pool before (and including) the given height.
*
* *[Mempool.space docs](https://mempool.space/docs/api/rest#get-mining-pool-blocks)*
*
* Endpoint: `GET /api/v1/mining/pool/{slug}/blocks/{height}`
*
* @param {PoolSlug} slug
* @param {Height} height
* @returns {Promise<BlockInfoV1[]>}
*/
async getPoolBlocksFrom(slug, height) {
return this.getJson(`/api/v1/mining/pool/${slug}/blocks/${height}`);
}
/**
* Mining pool hashrate
*
* Get hashrate history for a specific mining pool.
*
* *[Mempool.space docs](https://mempool.space/docs/api/rest#get-mining-pool-hashrate)*
*
* Endpoint: `GET /api/v1/mining/pool/{slug}/hashrate`
*
* @param {PoolSlug} slug
* @returns {Promise<PoolHashrateEntry[]>}
*/
async getPoolHashrate(slug) {
return this.getJson(`/api/v1/mining/pool/${slug}/hashrate`);
}
/**
* List all mining pools
*
@@ -10160,6 +10582,26 @@ class BrkClient extends BrkClientBase {
return this.getJson(`/api/v1/mining/reward-stats/${block_count}`);
}
/**
* Transaction first-seen times
*
* Returns timestamps when transactions were first seen in the mempool. Returns 0 for mined or unknown transactions.
*
* *[Mempool.space docs](https://mempool.space/docs/api/rest#get-transaction-times)*
*
* Endpoint: `GET /api/v1/transaction-times`
*
* @param {Txid[]} [txId[]]
* @returns {Promise<number[]>}
*/
async getTransactionTimes(txId) {
const params = new URLSearchParams();
params.set('txId[]', String(txId));
const query = params.toString();
const path = `/api/v1/transaction-times${query ? '?' + query : ''}`;
return this.getJson(path);
}
/**
* Validate address
*