diff --git a/crates/brk_cli/README.md b/crates/brk_cli/README.md index 102531cb8..381e3c288 100644 --- a/crates/brk_cli/README.md +++ b/crates/brk_cli/README.md @@ -12,9 +12,13 @@ Command-line interface for running a Bitcoin Research Kit instance. - Linux or macOS - Bitcoin Core with `server=1` in `bitcoin.conf` - Access to `blk*.dat` files -- [~400 GB disk space](https://bitview.space/api/server/disk) +- [~400 GB disk space](https://bitview.space/api/server/disk) (see [Disk usage](#disk-usage)) - [12+ GB RAM](https://github.com/bitcoinresearchkit/benches#benchmarks) +## Disk usage + +BRK uses [sparse files](https://en.wikipedia.org/wiki/Sparse_file). Tools like `ls -l` or Finder report the logical file size (>1 TB), not actual disk usage (~350 GB). Use `du -sh` to see real usage. + ## Install ```bash diff --git a/crates/brk_computer/src/cointime/adjusted/compute.rs b/crates/brk_computer/src/cointime/adjusted/compute.rs index 5561c26c2..3fd2088b5 100644 --- a/crates/brk_computer/src/cointime/adjusted/compute.rs +++ b/crates/brk_computer/src/cointime/adjusted/compute.rs @@ -14,30 +14,27 @@ impl Vecs { activity: &activity::Vecs, exit: &Exit, ) -> Result<()> { - self.cointime_adj_inflation_rate - .bps - .height - .compute_transform2( - starting_indexes.height, - &activity.liveliness.height, - &supply.inflation_rate.bps.height, - |(h, liveliness, inflation, ..)| { - ( - h, - BasisPointsSigned32::from(f64::from(liveliness) * f64::from(inflation)), - ) - }, - exit, - )?; + self.adj_inflation_rate.bps.height.compute_transform2( + starting_indexes.height, + &activity.liveliness.height, + &supply.inflation_rate.bps.height, + |(h, liveliness, inflation, ..)| { + ( + h, + BasisPointsSigned32::from(f64::from(liveliness) * f64::from(inflation)), + ) + }, + exit, + )?; - self.cointime_adj_tx_velocity_btc.height.compute_multiply( + self.adj_tx_velocity_btc.height.compute_multiply( starting_indexes.height, &activity.activity_to_vaultedness_ratio.height, &supply.velocity.btc.height, exit, )?; - self.cointime_adj_tx_velocity_usd.height.compute_multiply( + self.adj_tx_velocity_usd.height.compute_multiply( starting_indexes.height, &activity.activity_to_vaultedness_ratio.height, &supply.velocity.usd.height, diff --git a/crates/brk_computer/src/cointime/adjusted/import.rs b/crates/brk_computer/src/cointime/adjusted/import.rs index 1ed9da6c0..3c50eeb25 100644 --- a/crates/brk_computer/src/cointime/adjusted/import.rs +++ b/crates/brk_computer/src/cointime/adjusted/import.rs @@ -15,19 +15,19 @@ impl Vecs { indexes: &indexes::Vecs, ) -> Result { Ok(Self { - cointime_adj_inflation_rate: PercentPerBlock::forced_import( + adj_inflation_rate: PercentPerBlock::forced_import( db, "cointime_adj_inflation_rate", version, indexes, )?, - cointime_adj_tx_velocity_btc: ComputedPerBlock::forced_import( + adj_tx_velocity_btc: ComputedPerBlock::forced_import( db, "cointime_adj_tx_velocity_btc", version, indexes, )?, - cointime_adj_tx_velocity_usd: ComputedPerBlock::forced_import( + adj_tx_velocity_usd: ComputedPerBlock::forced_import( db, "cointime_adj_tx_velocity_usd", version, diff --git a/crates/brk_computer/src/cointime/adjusted/vecs.rs b/crates/brk_computer/src/cointime/adjusted/vecs.rs index beb857527..647b3d96c 100644 --- a/crates/brk_computer/src/cointime/adjusted/vecs.rs +++ b/crates/brk_computer/src/cointime/adjusted/vecs.rs @@ -6,7 +6,7 @@ use crate::internal::{ComputedPerBlock, PercentPerBlock}; #[derive(Traversable)] pub struct Vecs { - pub cointime_adj_inflation_rate: PercentPerBlock, - pub cointime_adj_tx_velocity_btc: ComputedPerBlock, - pub cointime_adj_tx_velocity_usd: ComputedPerBlock, + pub adj_inflation_rate: PercentPerBlock, + pub adj_tx_velocity_btc: ComputedPerBlock, + pub adj_tx_velocity_usd: ComputedPerBlock, } diff --git a/crates/brk_computer/src/cointime/cap/compute.rs b/crates/brk_computer/src/cointime/cap/compute.rs index 4d9659a7c..1bbaa3075 100644 --- a/crates/brk_computer/src/cointime/cap/compute.rs +++ b/crates/brk_computer/src/cointime/cap/compute.rs @@ -52,7 +52,7 @@ impl Vecs { // cointime_cap = (cointime_value_destroyed_cumulative * circulating_supply) / coinblocks_stored_cumulative self.cointime_cap.cents.height.compute_transform3( starting_indexes.height, - &value.cointime_value_destroyed.cumulative.height, + &value.value_destroyed.cumulative.height, circulating_supply, &activity.coinblocks_stored.cumulative.height, |(i, destroyed, supply, stored, ..)| { diff --git a/crates/brk_computer/src/cointime/value/compute.rs b/crates/brk_computer/src/cointime/value/compute.rs index 43c079291..4e8a00257 100644 --- a/crates/brk_computer/src/cointime/value/compute.rs +++ b/crates/brk_computer/src/cointime/value/compute.rs @@ -23,11 +23,8 @@ impl Vecs { let coindays_destroyed = &all_metrics.activity.coindays_destroyed; let circulating_supply = &all_metrics.supply.total.btc.height; - self.cointime_value_destroyed.compute( - starting_indexes.height, - &window_starts, - exit, - |vec| { + self.value_destroyed + .compute(starting_indexes.height, &window_starts, exit, |vec| { vec.compute_multiply( starting_indexes.height, &prices.price.usd.height, @@ -35,14 +32,10 @@ impl Vecs { exit, )?; Ok(()) - }, - )?; + })?; - self.cointime_value_created.compute( - starting_indexes.height, - &window_starts, - exit, - |vec| { + self.value_created + .compute(starting_indexes.height, &window_starts, exit, |vec| { vec.compute_multiply( starting_indexes.height, &prices.price.usd.height, @@ -50,14 +43,10 @@ impl Vecs { exit, )?; Ok(()) - }, - )?; + })?; - self.cointime_value_stored.compute( - starting_indexes.height, - &window_starts, - exit, - |vec| { + self.value_stored + .compute(starting_indexes.height, &window_starts, exit, |vec| { vec.compute_multiply( starting_indexes.height, &prices.price.usd.height, @@ -65,8 +54,7 @@ impl Vecs { exit, )?; Ok(()) - }, - )?; + })?; // VOCDD: Value of Coin Days Destroyed = price × (CDD / circulating_supply) // Supply-adjusted to account for growing supply over time diff --git a/crates/brk_computer/src/cointime/value/import.rs b/crates/brk_computer/src/cointime/value/import.rs index 650088992..1f7e027ab 100644 --- a/crates/brk_computer/src/cointime/value/import.rs +++ b/crates/brk_computer/src/cointime/value/import.rs @@ -12,19 +12,19 @@ impl Vecs { indexes: &indexes::Vecs, ) -> Result { Ok(Self { - cointime_value_destroyed: ComputedPerBlockCumulativeSum::forced_import( + value_destroyed: ComputedPerBlockCumulativeSum::forced_import( db, "cointime_value_destroyed", version, indexes, )?, - cointime_value_created: ComputedPerBlockCumulativeSum::forced_import( + value_created: ComputedPerBlockCumulativeSum::forced_import( db, "cointime_value_created", version, indexes, )?, - cointime_value_stored: ComputedPerBlockCumulativeSum::forced_import( + value_stored: ComputedPerBlockCumulativeSum::forced_import( db, "cointime_value_stored", version, diff --git a/crates/brk_computer/src/cointime/value/vecs.rs b/crates/brk_computer/src/cointime/value/vecs.rs index 76391b8b6..0721b048b 100644 --- a/crates/brk_computer/src/cointime/value/vecs.rs +++ b/crates/brk_computer/src/cointime/value/vecs.rs @@ -6,8 +6,8 @@ use crate::internal::ComputedPerBlockCumulativeSum; #[derive(Traversable)] pub struct Vecs { - pub cointime_value_destroyed: ComputedPerBlockCumulativeSum, - pub cointime_value_created: ComputedPerBlockCumulativeSum, - pub cointime_value_stored: ComputedPerBlockCumulativeSum, + pub value_destroyed: ComputedPerBlockCumulativeSum, + pub value_created: ComputedPerBlockCumulativeSum, + pub value_stored: ComputedPerBlockCumulativeSum, pub vocdd: ComputedPerBlockCumulativeSum, } diff --git a/crates/brk_computer/src/distribution/metrics/realized/full.rs b/crates/brk_computer/src/distribution/metrics/realized/full.rs index c70ae5216..1468d7e57 100644 --- a/crates/brk_computer/src/distribution/metrics/realized/full.rs +++ b/crates/brk_computer/src/distribution/metrics/realized/full.rs @@ -80,7 +80,7 @@ pub struct RealizedFull { pub sell_side_risk_ratio: PercentRollingWindows, pub peak_regret: ComputedPerBlockCumulative, - pub peak_regret_rel_to_realized_cap: PercentPerBlock, + pub peak_regret_rel_to_rcap: PercentPerBlock, pub cap_rel_to_own_mcap: PercentPerBlock, @@ -207,7 +207,7 @@ impl RealizedFull { investor_cap_raw, sell_side_risk_ratio, peak_regret, - peak_regret_rel_to_realized_cap, + peak_regret_rel_to_rcap: peak_regret_rel_to_realized_cap, cap_rel_to_own_mcap: cfg.import("realized_cap_rel_to_own_market_cap", v1)?, profit_sum_extended: cfg.import("realized_profit", v1)?, loss_sum_extended: cfg.import("realized_loss", v1)?, @@ -535,7 +535,7 @@ impl RealizedFull { )?; // Peak regret - self.peak_regret_rel_to_realized_cap + self.peak_regret_rel_to_rcap .compute_binary::( starting_indexes.height, &self.peak_regret.height, diff --git a/crates/brk_computer/src/internal/containers/windows.rs b/crates/brk_computer/src/internal/containers/windows.rs index 9f30ca98a..cd7204f3d 100644 --- a/crates/brk_computer/src/internal/containers/windows.rs +++ b/crates/brk_computer/src/internal/containers/windows.rs @@ -2,13 +2,9 @@ use brk_traversable::Traversable; #[derive(Clone, Traversable)] pub struct Windows { - #[traversable(rename = "24h")] pub _24h: A, - #[traversable(rename = "1w")] pub _1w: A, - #[traversable(rename = "1m")] pub _1m: A, - #[traversable(rename = "1y")] pub _1y: A, } diff --git a/crates/brk_computer/src/internal/per_block/rolling/windows.rs b/crates/brk_computer/src/internal/per_block/rolling/windows.rs index 9ccca1b96..69528cd36 100644 --- a/crates/brk_computer/src/internal/per_block/rolling/windows.rs +++ b/crates/brk_computer/src/internal/per_block/rolling/windows.rs @@ -67,7 +67,6 @@ pub struct RollingWindow24h where T: ComputedVecValue + PartialOrd + JsonSchema, { - #[traversable(rename = "24h")] pub _24h: ComputedPerBlock, } @@ -114,11 +113,8 @@ pub struct RollingWindowsFrom1w where T: ComputedVecValue + PartialOrd + JsonSchema, { - #[traversable(rename = "1w")] pub _1w: ComputedPerBlock, - #[traversable(rename = "1m")] pub _1m: ComputedPerBlock, - #[traversable(rename = "1y")] pub _1y: ComputedPerBlock, } diff --git a/crates/brk_computer/src/internal/per_tx/derived.rs b/crates/brk_computer/src/internal/per_tx/derived.rs index 0cb386d8b..194339bf4 100644 --- a/crates/brk_computer/src/internal/per_tx/derived.rs +++ b/crates/brk_computer/src/internal/per_tx/derived.rs @@ -22,7 +22,6 @@ pub struct BlockRollingDistribution where T: ComputedVecValue + PartialOrd + JsonSchema, { - #[traversable(rename = "6b")] pub _6b: Distribution, } diff --git a/crates/brk_computer/src/mining/rewards/vecs.rs b/crates/brk_computer/src/mining/rewards/vecs.rs index cd8d80f60..1b6c61049 100644 --- a/crates/brk_computer/src/mining/rewards/vecs.rs +++ b/crates/brk_computer/src/mining/rewards/vecs.rs @@ -14,8 +14,10 @@ pub struct Vecs { pub fees: AmountPerBlockFull, pub unclaimed_rewards: AmountPerBlockCumulativeSum, pub fee_dominance: PercentPerBlock, + #[traversable(rename = "fee_dominance")] pub fee_dominance_rolling: PercentRollingWindows, pub subsidy_dominance: PercentPerBlock, + #[traversable(rename = "subsidy_dominance")] pub subsidy_dominance_rolling: PercentRollingWindows, pub subsidy_sma_1y: FiatPerBlock, } diff --git a/crates/brk_computer/src/pools/major.rs b/crates/brk_computer/src/pools/major.rs index 674a68b8a..b7c79d1d9 100644 --- a/crates/brk_computer/src/pools/major.rs +++ b/crates/brk_computer/src/pools/major.rs @@ -16,7 +16,6 @@ use crate::{ use super::minor; #[derive(Deref, DerefMut, Traversable)] -#[traversable(merge)] pub struct Vecs { #[deref] #[deref_mut] @@ -26,6 +25,7 @@ pub struct Vecs { #[traversable(wrap = "blocks_mined", rename = "sum")] pub blocks_mined_sum: RollingWindows, pub rewards: AmountPerBlockCumulativeSum, + #[traversable(rename = "dominance")] pub dominance_rolling: PercentRollingWindows, } diff --git a/docker/README.md b/docker/README.md index fee28772b..aeb66d64c 100644 --- a/docker/README.md +++ b/docker/README.md @@ -61,6 +61,8 @@ docker compose -f docker/docker-compose.yml build ## Data Storage +BRK uses [sparse files](https://en.wikipedia.org/wiki/Sparse_file). Volume inspection and `docker system df` may report the logical file size (>1 TB) instead of actual disk usage (~350 GB). Use `du -sh` on the volume mount point to see real usage. + ### Named Volume (Default) Uses a Docker-managed volume called `brk-data`. diff --git a/docs/README.md b/docs/README.md index 680c119a6..9590322cb 100644 --- a/docs/README.md +++ b/docs/README.md @@ -53,6 +53,8 @@ cargo install --locked brk_cli && brk Run your own website and API. All you need is Bitcoin Core. +> **Note:** BRK uses [sparse files](https://en.wikipedia.org/wiki/Sparse_file). Tools like `ls -l` or Finder report the logical file size (>1 TB), not actual disk usage (~350 GB). Use `du -sh` to see real usage. + [Guide](https://github.com/bitcoinresearchkit/brk/blob/main/crates/brk_cli/README.md) · [Professional hosting](./PROFESSIONAL_HOSTING.md) ### Library