Skip to main content

Crate brk_oracle

Crate brk_oracle 

Source
Expand description

Pure on-chain BTC/USD price oracle.

Detects round-dollar transaction patterns ($1, $5, $10, … $10,000) in Bitcoin block outputs to derive the current price without any exchange data.

Structs§

Config
Oracle

Constants§

BINS_PER_DECADE
NUM_BINS
PRICES
Pre-oracle dollar prices, one per line, heights 0..630_000.
START_HEIGHT
First height where the oracle computes from on-chain data.

Functions§

bin_to_cents
Converts a fractional bin to a USD price in cents. For a $D output at price P: sats = D * 1e8 / P, so P = 10^(10 - bin/200) dollars, where 10 = log10($100 reference * 1e8 sats/BTC).
cents_to_bin
Converts a USD price in cents to a fractional bin (inverse of bin_to_cents).
sats_to_bin
Maps a satoshi value to its log-scale bin index. bin = round(log10(sats) * BINS_PER_DECADE).