Crate brk_client

Crate brk_client 

Source

Structs§

AaopoolPattern
Pattern struct for repeated tree structure.
ActivePriceRatioPattern
Pattern struct for repeated tree structure.
ActiveSupplyPattern
Pattern struct for repeated tree structure.
ActivityPattern2
Pattern struct for repeated tree structure.
AddrCountPattern
Pattern struct for repeated tree structure.
Address
Bitcoin address string
AddressChainStats
Address statistics on the blockchain (confirmed transactions only)
AddressGroups
AddressHash
AddressIndexOutPoint
AddressIndexTxIndex
AddressMempoolStats
Address statistics in the mempool (unconfirmed transactions only)
AddressParam
AddressStats
Address information compatible with mempool.space API format
AddressTxidsParam
AddressValidation
Address validation result
Age
Represents the age of a UTXO or address balance. Encapsulates all age-related calculations in one type-safe struct.
AmountBucket
Bucket index for amount ranges. Use for cheap comparisons and direct lookups.
AnyAddressIndex
Unified index for any address type (loaded or empty)
Bitcoin
Bitcoin amount as floating point (1 BTC = 100,000,000 satoshis)
BitcoinPattern
Pattern struct for repeated tree structure.
BitcoinPattern2
Pattern struct for repeated tree structure.
BlkMetadata
BlkPosition
Position within a .blk file, encoding file index and byte offset
Block
BlockCountParam
BlockCountPattern
Pattern struct for repeated tree structure.
BlockFeeRatesEntry
A single block fee rates data point with percentiles.
BlockFeesEntry
A single block fees data point.
BlockHash
Block hash
BlockHashParam
BlockHashPrefix
BlockHashStartIndex
BlockHashTxIndex
BlockInfo
Block information returned by the API
BlockRewardsEntry
A single block rewards data point.
BlockSizeEntry
A single block size data point.
BlockSizesWeights
Combined block sizes and weights response.
BlockStatus
Block status indicating whether block is in the best chain
BlockTimestamp
Block information returned for timestamp queries
BlockWeightEntry
A single block weight data point.
BrkClient
Main BRK client with metrics tree and API methods.
BrkClientBase
Base HTTP client for making requests.
BrkClientOptions
Options for configuring the BRK client.
BrkError
Error type for BRK client operations.
ByAddressType
ByAgeRange
ByAmountRange
ByAnyAddress
ByEpoch
ByGreatEqualAmount
ByLowerThanAmount
ByMaxAge
ByMinAge
BySpendableType
ByTerm
ByUnspendableType
ByYear
Cents
CentsCompact
Compact representation of USD cents as i32.
ClassAveragePricePattern
Pattern struct for repeated tree structure.
Close
Closing price value for a time period
CohortName
Display names for a cohort with id (for storage/API), short (for charts), and long (for tooltips/labels)
CoinbasePattern
Pattern struct for repeated tree structure.
CoinbasePattern2
Pattern struct for repeated tree structure.
ComputeIndexes
Extended indexes with time-based granularities. Used by brk_computer for time-series aggregation.
CostBasisPattern
Pattern struct for repeated tree structure.
CostBasisPattern2
Pattern struct for repeated tree structure.
CountPattern2
Pattern struct for repeated tree structure.
DataRange
Range parameters for slicing data
DataRangeFormat
Data range with output format for API query parameters
Date
Date in YYYYMMDD format stored as u32
DateIndex
DecadeIndex
DetailedMetricCount
Detailed metric count with per-database breakdown
DifficultyAdjustment
Difficulty adjustment information.
DifficultyAdjustmentEntry
A single difficulty adjustment entry. Serializes as array: [timestamp, height, difficulty, change_percent]
DifficultyEntry
A single difficulty data point.
DifficultyEpoch
DiskUsage
Disk usage of the indexed data
Dollars
US Dollar amount as floating point
DollarsPattern
Pattern struct for repeated tree structure.
EmptyAddressData
Data of an empty address
EmptyAddressIndex
EmptyOutputIndex
Exit
Graceful shutdown coordinator for ensuring data consistency during program exit.
FeeRate
Fee rate in sats/vB
FeeRatePattern
Pattern struct for repeated tree structure.
FeeRatePercentiles
Fee rate percentiles (min, 10%, 25%, 50%, 75%, 90%, max).
FullnessPattern
Pattern struct for repeated tree structure.
GroupedByType
HalvingEpoch
HashrateEntry
A single hashrate data point.
HashrateSummary
Summary of network hashrate and difficulty data.
Health
Server health status
Height
Block height
HeightParam
Hex
Hex-encoded string
High
Highest price value for a time period
IndexInfo
Information about an available index and its query aliases
Indexes
Blockchain-level indexes tracking current positions for various entity types. Used by brk_indexer during block processing.
JSONPool
Limit
Maximum number of results to return. Defaults to 100 if not specified.
LimitParam
LoadedAddressData
Data for a loaded (non-empty) address with current balance
LoadedAddressIndex
LookbackPattern
Pattern struct for repeated tree structure.
Low
Lowest price value for a time period
MempoolBlock
Block info in a mempool.space like format for fee estimation.
MempoolEntryInfo
Mempool entry info from Bitcoin Core’s getrawmempool verbose
MempoolInfo
Mempool statistics
Metric
Metric name
MetricCount
Metric count statistics - distinct metrics and total metric-index combinations
MetricData
Metric data with range information.
MetricEndpointBuilder
Initial builder for metric endpoint queries.
MetricLeaf
Leaf node containing metric metadata
MetricLeafWithSchema
MetricLeaf with JSON Schema for client generation
MetricParam
MetricPattern1
MetricPattern2
MetricPattern3
MetricPattern4
MetricPattern5
MetricPattern6
MetricPattern7
MetricPattern8
MetricPattern9
MetricPattern1By
MetricPattern2By
MetricPattern3By
MetricPattern4By
MetricPattern5By
MetricPattern6By
MetricPattern7By
MetricPattern8By
MetricPattern9By
MetricPattern10
MetricPattern11
MetricPattern12
MetricPattern13
MetricPattern14
MetricPattern15
MetricPattern16
MetricPattern17
MetricPattern18
MetricPattern19
MetricPattern20
MetricPattern21
MetricPattern22
MetricPattern23
MetricPattern24
MetricPattern25
MetricPattern26
MetricPattern27
MetricPattern28
MetricPattern29
MetricPattern30
MetricPattern31
MetricPattern32
MetricPattern10By
MetricPattern11By
MetricPattern12By
MetricPattern13By
MetricPattern14By
MetricPattern15By
MetricPattern16By
MetricPattern17By
MetricPattern18By
MetricPattern19By
MetricPattern20By
MetricPattern21By
MetricPattern22By
MetricPattern23By
MetricPattern24By
MetricPattern25By
MetricPattern26By
MetricPattern27By
MetricPattern28By
MetricPattern29By
MetricPattern30By
MetricPattern31By
MetricPattern32By
MetricSelection
Selection of metrics to query
MetricSelectionLegacy
Legacy metric selection parameters (deprecated)
MetricWithIndex
Metrics
Comma-separated list of metric names
MetricsTree
Metrics tree node.
MetricsTree_Addresses
Metrics tree node.
MetricsTree_Blocks
Metrics tree node.
MetricsTree_Blocks_Count
Metrics tree node.
MetricsTree_Blocks_Difficulty
Metrics tree node.
MetricsTree_Blocks_Halving
Metrics tree node.
MetricsTree_Blocks_Mining
Metrics tree node.
MetricsTree_Blocks_Rewards
Metrics tree node.
MetricsTree_Blocks_Rewards_24hCoinbaseSum
Metrics tree node.
MetricsTree_Blocks_Size
Metrics tree node.
MetricsTree_Blocks_Time
Metrics tree node.
MetricsTree_Cointime
Metrics tree node.
MetricsTree_Cointime_Activity
Metrics tree node.
MetricsTree_Cointime_Adjusted
Metrics tree node.
MetricsTree_Cointime_Cap
Metrics tree node.
MetricsTree_Cointime_Pricing
Metrics tree node.
MetricsTree_Cointime_Supply
Metrics tree node.
MetricsTree_Cointime_Value
Metrics tree node.
MetricsTree_Constants
Metrics tree node.
MetricsTree_Distribution
Metrics tree node.
MetricsTree_Distribution_AddressCohorts
Metrics tree node.
MetricsTree_Distribution_AddressCohorts_AmountRange
Metrics tree node.
MetricsTree_Distribution_AddressCohorts_GeAmount
Metrics tree node.
MetricsTree_Distribution_AddressCohorts_LtAmount
Metrics tree node.
MetricsTree_Distribution_AddressesData
Metrics tree node.
MetricsTree_Distribution_AnyAddressIndexes
Metrics tree node.
MetricsTree_Distribution_UtxoCohorts
Metrics tree node.
MetricsTree_Distribution_UtxoCohorts_AgeRange
Metrics tree node.
MetricsTree_Distribution_UtxoCohorts_All
Metrics tree node.
MetricsTree_Distribution_UtxoCohorts_All_CostBasis
Metrics tree node.
MetricsTree_Distribution_UtxoCohorts_All_Relative
Metrics tree node.
MetricsTree_Distribution_UtxoCohorts_AmountRange
Metrics tree node.
MetricsTree_Distribution_UtxoCohorts_Epoch
Metrics tree node.
MetricsTree_Distribution_UtxoCohorts_GeAmount
Metrics tree node.
MetricsTree_Distribution_UtxoCohorts_LtAmount
Metrics tree node.
MetricsTree_Distribution_UtxoCohorts_MaxAge
Metrics tree node.
MetricsTree_Distribution_UtxoCohorts_MinAge
Metrics tree node.
MetricsTree_Distribution_UtxoCohorts_Term
Metrics tree node.
MetricsTree_Distribution_UtxoCohorts_Term_Long
Metrics tree node.
MetricsTree_Distribution_UtxoCohorts_Term_Short
Metrics tree node.
MetricsTree_Distribution_UtxoCohorts_Type
Metrics tree node.
MetricsTree_Distribution_UtxoCohorts_Year
Metrics tree node.
MetricsTree_Indexes
Metrics tree node.
MetricsTree_Indexes_Address
Metrics tree node.
MetricsTree_Indexes_Address_Empty
Metrics tree node.
MetricsTree_Indexes_Address_Opreturn
Metrics tree node.
MetricsTree_Indexes_Address_P2a
Metrics tree node.
MetricsTree_Indexes_Address_P2ms
Metrics tree node.
MetricsTree_Indexes_Address_P2pk33
Metrics tree node.
MetricsTree_Indexes_Address_P2pk65
Metrics tree node.
MetricsTree_Indexes_Address_P2pkh
Metrics tree node.
MetricsTree_Indexes_Address_P2sh
Metrics tree node.
MetricsTree_Indexes_Address_P2tr
Metrics tree node.
MetricsTree_Indexes_Address_P2wpkh
Metrics tree node.
MetricsTree_Indexes_Address_P2wsh
Metrics tree node.
MetricsTree_Indexes_Address_Unknown
Metrics tree node.
MetricsTree_Indexes_Dateindex
Metrics tree node.
MetricsTree_Indexes_Decadeindex
Metrics tree node.
MetricsTree_Indexes_Difficultyepoch
Metrics tree node.
MetricsTree_Indexes_Halvingepoch
Metrics tree node.
MetricsTree_Indexes_Height
Metrics tree node.
MetricsTree_Indexes_Monthindex
Metrics tree node.
MetricsTree_Indexes_Quarterindex
Metrics tree node.
MetricsTree_Indexes_Semesterindex
Metrics tree node.
MetricsTree_Indexes_Txindex
Metrics tree node.
MetricsTree_Indexes_Txinindex
Metrics tree node.
MetricsTree_Indexes_Txoutindex
Metrics tree node.
MetricsTree_Indexes_Weekindex
Metrics tree node.
MetricsTree_Indexes_Yearindex
Metrics tree node.
MetricsTree_Inputs
Metrics tree node.
MetricsTree_Inputs_Spent
Metrics tree node.
MetricsTree_Market
Metrics tree node.
MetricsTree_Market_Ath
Metrics tree node.
MetricsTree_Market_Dca
Metrics tree node.
MetricsTree_Market_Dca_ClassAveragePrice
Metrics tree node.
MetricsTree_Market_Dca_ClassStack
Metrics tree node.
MetricsTree_Market_Indicators
Metrics tree node.
MetricsTree_Market_MovingAverage
Metrics tree node.
MetricsTree_Market_Range
Metrics tree node.
MetricsTree_Market_Returns
Metrics tree node.
MetricsTree_Market_Returns_PriceReturns
Metrics tree node.
MetricsTree_Market_Volatility
Metrics tree node.
MetricsTree_Outputs
Metrics tree node.
MetricsTree_Outputs_Count
Metrics tree node.
MetricsTree_Outputs_Spent
Metrics tree node.
MetricsTree_Pools
Metrics tree node.
MetricsTree_Pools_Vecs
Metrics tree node.
MetricsTree_Positions
Metrics tree node.
MetricsTree_Price
Metrics tree node.
MetricsTree_Price_Cents
Metrics tree node.
MetricsTree_Price_Cents_Split
Metrics tree node.
MetricsTree_Price_Oracle
Metrics tree node.
MetricsTree_Price_Usd
Metrics tree node.
MetricsTree_Scripts
Metrics tree node.
MetricsTree_Scripts_Count
Metrics tree node.
MetricsTree_Scripts_Value
Metrics tree node.
MetricsTree_Supply
Metrics tree node.
MetricsTree_Supply_Burned
Metrics tree node.
MetricsTree_Supply_Circulating
Metrics tree node.
MetricsTree_Supply_Velocity
Metrics tree node.
MetricsTree_Transactions
Metrics tree node.
MetricsTree_Transactions_Count
Metrics tree node.
MetricsTree_Transactions_Fees
Metrics tree node.
MetricsTree_Transactions_Fees_Fee
Metrics tree node.
MetricsTree_Transactions_Fees_Fee_Dollars
Metrics tree node.
MetricsTree_Transactions_Size
Metrics tree node.
MetricsTree_Transactions_Versions
Metrics tree node.
MetricsTree_Transactions_Volume
Metrics tree node.
MonthIndex
OHLCCents
OHLC (Open, High, Low, Close) data in cents
OHLCDollars
OHLC (Open, High, Low, Close) data in dollars
OHLCSats
OHLC (Open, High, Low, Close) data in satoshis
OpReturnIndex
Open
Opening price value for a time period
OutPoint
OutputsPattern
Pattern struct for repeated tree structure.
P2AAddressIndex
P2ABytes
P2MSOutputIndex
P2PK33AddressIndex
P2PK33Bytes
P2PK65AddressIndex
P2PK65Bytes
P2PKHAddressIndex
P2PKHBytes
P2SHAddressIndex
P2SHBytes
P2TRAddressIndex
P2TRBytes
P2WPKHAddressIndex
P2WPKHBytes
P2WSHAddressIndex
P2WSHBytes
PaginatedMetrics
A paginated list of available metric names (1000 per page)
Pagination
Pagination parameters for paginated API endpoints
PaginationIndex
Pagination parameters with an index filter
PercentilesPattern
Pattern struct for repeated tree structure.
PeriodAveragePricePattern
Pattern struct for repeated tree structure.
PeriodCagrPattern
Pattern struct for repeated tree structure.
PeriodLumpSumStackPattern
Pattern struct for repeated tree structure.
Pool
Mining pool information
PoolBlockCounts
Block counts for different time periods
PoolBlockShares
Pool’s share of total blocks for different time periods
PoolDetail
Detailed pool information with statistics across time periods
PoolDetailInfo
Pool information for detail view
PoolInfo
Basic pool information for listing all pools
PoolSlugParam
PoolStats
Mining pool with block statistics for a time period
Pools
PoolsSummary
Mining pools response for a time period
Price111dSmaPattern
Pattern struct for repeated tree structure.
QuarterIndex
RangeBuilder
Builder with range fully specified.
Ratio1ySdPattern
Pattern struct for repeated tree structure.
RawLockTime
Transaction locktime
ReadBlock
RealizedPattern
Pattern struct for repeated tree structure.
RealizedPattern2
Pattern struct for repeated tree structure.
RealizedPattern3
Pattern struct for repeated tree structure.
RealizedPattern4
Pattern struct for repeated tree structure.
RealizedPriceExtraPattern
Pattern struct for repeated tree structure.
RecommendedFees
Recommended fee rates in sat/vB
RelativePattern
Pattern struct for repeated tree structure.
RelativePattern2
Pattern struct for repeated tree structure.
RelativePattern4
Pattern struct for repeated tree structure.
RelativePattern5
Pattern struct for repeated tree structure.
RewardStats
Block reward statistics over a range of blocks
Sats
Satoshis
SatsPattern
Pattern struct for repeated tree structure.
SegwitAdoptionPattern
Pattern struct for repeated tree structure.
SemesterIndex
SingleItemBuilder
Builder for single item access.
SkippedBuilder
Builder after calling skip(n). Chain with take(n) to specify count.
SplitPattern2
Pattern struct for repeated tree structure.
StoredBool
Fixed-size boolean value optimized for on-disk storage (stored as u16)
StoredF32
Stored 32-bit floating point value
StoredF64
Fixed-size 64-bit floating point value optimized for on-disk storage
StoredI16
StoredString
StoredU8
StoredU16
StoredU32
Fixed-size 32-bit unsigned integer optimized for on-disk storage
StoredU64
Fixed-size 64-bit unsigned integer optimized for on-disk storage
SupplyPattern2
Pattern struct for repeated tree structure.
SupplyState
Current supply state tracking UTXO count and total value
SyncStatus
Sync status of the indexer
TimePeriodParam
Timestamp
UNIX timestamp in seconds
TimestampParam
Transaction
Transaction information compatible with mempool.space API format
TxIn
Transaction input
TxInIndex
TxIndex
TxOut
Transaction output
TxOutIndex
TxOutspend
Status of an output indicating whether it has been spent
TxStatus
Transaction confirmation status
TxVersion
Transaction version number
TxWithHex
A transaction with its raw hex representation
Txid
Transaction ID (hash)
TxidParam
TxidPrefix
TxidVout
Transaction output reference (txid + output index)
TypeIndex
Index within its type (e.g., 0 for first P2WPKH address)
U8x2
U8x20
U8x32
U8x33
U8x65
UTXOGroups
UnclaimedRewardsPattern
Pattern struct for repeated tree structure.
Unit
UnknownOutputIndex
UnrealizedPattern
Pattern struct for repeated tree structure.
Utxo
Unspent transaction output
VSize
Virtual size in vbytes (weight / 4, rounded up)
ValidateAddressParam
Version
Version tracking for data schema and computed values.
Vin
Input index in the spending transaction
Vout
Index of the output being spent in the previous transaction
WeekIndex
Weight
Transaction or block weight in weight units (WU)
Year
Bitcoin year (2009, 2010, …, 2025+)
YearIndex
_0satsPattern
Pattern struct for repeated tree structure.
_0satsPattern2
Pattern struct for repeated tree structure.
_1dReturns1mSdPattern
Pattern struct for repeated tree structure.
_10yPattern
Pattern struct for repeated tree structure.
_10yTo12yPattern
Pattern struct for repeated tree structure.
_100btcPattern
Pattern struct for repeated tree structure.
_2015Pattern
Pattern struct for repeated tree structure.

Enums§

AddressBytes
AmountFilter
AnyAddressDataIndexEnum
CohortContext
Context for cohort naming - determines whether a prefix is needed.
Filter
Format
Output format for API responses
FormatResponse
Response type for endpoints that support multiple formats (JSON/CSV).
Index
Aggregation dimension for querying metrics. Includes time-based (date, week, month, year), block-based (height, txindex), and address/output type indexes.
OutputType
Type (P2PKH, P2WPKH, P2SH, P2TR, etc.)
PoolSlug
StateLevel
Controls the level of state tracking for a cohort.
Term
Classification for short-term vs long-term holders. The threshold is 150 days (approximately 5 months) = 3600 hours.
TimeFilter
TimePeriod
Time period for mining statistics.
TreeNode
Hierarchical tree node for organizing metrics into categories

Constants§

AGE_BOUNDARIES
Age boundaries in hours. Defines the cohort ranges: [0, 1h), [1h, 1d), [1d, 1w), [1w, 1m), …, [15y, ∞)
AGE_RANGE_BOUNDS
Age range bounds (end = usize::MAX means unbounded)
AGE_RANGE_FILTERS
Age range filters
AGE_RANGE_NAMES
Age range names
AMOUNT_RANGE_BOUNDS
Amount range bounds
AMOUNT_RANGE_FILTERS
Amount range filters
AMOUNT_RANGE_NAMES
Amount range names
BLOCKS_PER_DIFF_EPOCHS
BLOCKS_PER_HALVING
EPOCH_FILTERS
Epoch filters
EPOCH_NAMES
Epoch names
EPOCH_VALUES
Epoch values
GE_AMOUNT_FILTERS
Greater-or-equal amount filters
GE_AMOUNT_NAMES
Greater-or-equal amount names
GE_AMOUNT_THRESHOLDS
Greater-or-equal amount thresholds
HOURS_1D
HOURS_1H
HOURS_1M
HOURS_1W
HOURS_1Y
HOURS_2M
HOURS_2Y
HOURS_3M
HOURS_3Y
HOURS_4M
HOURS_4Y
HOURS_5M
HOURS_5Y
HOURS_6M
HOURS_6Y
HOURS_7Y
HOURS_8Y
HOURS_10Y
HOURS_12Y
HOURS_15Y
LT_AMOUNT_FILTERS
Lower-than amount filters
LT_AMOUNT_NAMES
Lower-than amount names
LT_AMOUNT_THRESHOLDS
Lower-than amount thresholds
MAX_AGE_FILTERS
Max age filters (LowerThan threshold in hours)
MAX_AGE_HOURS
Max age thresholds in hours
MAX_AGE_NAMES
Max age names
MIN_AGE_FILTERS
Min age filters (GreaterOrEqual threshold in hours)
MIN_AGE_HOURS
Min age thresholds in hours
MIN_AGE_NAMES
Min age names
ONE_DAY_IN_SEC
ONE_DAY_IN_SEC_F64
ONE_HOUR_IN_SEC
P2A
P2PK33
P2PK65
P2PKH
P2SH
P2TR
P2WPKH
P2WSH
PERCENTILES
Standard percentile values used throughout BRK.
PERCENTILES_LEN
Length of the PERCENTILES array.
SPENDABLE_TYPE_FILTERS
Spendable type filters
SPENDABLE_TYPE_NAMES
Spendable type names
SPENDABLE_TYPE_VALUES
Spendable type values
TERM_FILTERS
Term filters
TERM_NAMES
Term names
TERM_VALUES
Term values
YEAR_FILTERS
Year filters
YEAR_NAMES
Year names
YEAR_VALUES
Year values

Traits§

AnyMetricPattern
Non-generic trait for metric patterns (usable in collections).
CheckedSub
Filtered
MetricPattern
Generic trait for metric patterns with endpoint access.
OptionExt
Extension trait for Option to provide shorter unwrap methods
PrintableIndex
Provides string representations of index types for display and region naming.

Functions§

amounts_in_different_buckets
Check if two amounts are in different buckets. O(1).
de_unquote_i64
de_unquote_limit
de_unquote_usize
extract_json_type
Extract JSON type from a schema, following $ref if needed.
get_percentile
Get a percentile value from a sorted slice.
pools

Type Aliases§

Result
Result type for BRK client operations.
StoredPhantom