| Crates.io | brk_cohort |
| lib.rs | brk_cohort |
| version | 0.1.0-beta.0 |
| created_at | 2026-01-04 10:59:45.034336+00 |
| updated_at | 2026-01-25 13:22:18.281199+00 |
| description | Cohort definitions used throughout BRK |
| homepage | https://bitcoinresearchkit.org |
| repository | https://github.com/bitcoinresearchkit/brk |
| max_upload_size | |
| id | 2021717 |
| size | 142,761 |
UTXO and address cohort filtering for on-chain analytics.
Slice the UTXO set and address population by age, amount, output type, halving epoch, or holder classification (STH/LTH). Build complex cohorts by combining filters for metrics like "realized cap of 1+ BTC UTXOs older than 150 days."
TimeFilter::GreaterOrEqual(hours), TimeFilter::Range(hours..hours), TimeFilter::LowerThan(hours)AmountFilter::GreaterOrEqual(Sats::_1BTC), AmountFilter::Range(Sats::_100K..Sats::_1M)Term::Sth (short-term holders, <150 days), Term::Lth (long-term holders)utxos_, addrs_) based on cohort contextFilter::includes)pub enum Filter {
All,
Term(Term), // STH/LTH
Time(TimeFilter), // Age-based
Amount(AmountFilter), // Value-based
Epoch(HalvingEpoch), // Halving epoch
Year(Year), // Calendar year
Type(OutputType), // P2PKH, P2TR, etc.
}
// TimeFilter values are in hours (e.g., 3600 hours = 150 days)
let filter = Filter::Time(TimeFilter::GreaterOrEqual(3600));
// Check membership
filter.contains_time(4000); // true (4000 hours > 3600 hours)
filter.contains_amount(sats);
// Generate metric names (via CohortContext)
let ctx = CohortContext::Utxo;
ctx.full_name(&filter, "min_age_150d"); // "utxos_min_age_150d"
brk_error for error handlingbrk_types for Sats, HalvingEpoch, OutputTypebrk_traversable for data structure traversal