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§
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).