4.90 Open Bitcoin Metrics: Reproducible On-Chain Series From Your Own Node

Bitcoin on-chain series from a full node: coin-days destroyed equal spent BTC times fractional age, and the miner fee share is fees divided by issuance plus fees.

4.90 Open Bitcoin Metrics: Reproducible On-Chain Series From Your Own Node

A Bitcoin book that sizes off coin-days destroyed inherits the vendor's age rule, floor included. Diego R. Llanos rebuilds the daily series from a local Bitcoin Core node, and the age he stores is elapsed seconds divided by 86,400. A backward timestamp, which Bitcoin blocks do produce, is floored at zero. Coin Metrics, the closest named public series, keeps full days only, and he quotes the consequence: 2.5 days count as 2. On one bitcoin the two rules print 2.50 BTC-days and 2.00 BTC-days.

Fewer blocks shrink the daily totals even when every block is full

120 blocks packed to the cap total 480,000,000 weight units, and 144 blocks packed to the same cap total 576,000,000. Both days are full. Bitcoin aims at a block about every ten minutes, so the long-run count is about 144 blocks in a day dated in Coordinated Universal Time (UTC). Realized production wanders around that, because discovery is a lottery and difficulty only steps every 2,016 blocks. A light fee total can be a short day.

Llanos assigns each block to the UTC calendar date of the timestamp Bitcoin Core returns for that block. Call that date d(b). The daily block count is the number of main-chain blocks with that date. The dataset is Open Bitcoin Metrics (OBM).

$$ \text{BlockCount}_d = \sum_{b:\, d(b) = d} 1 $$

You count blocks, one per block whose timestamp falls on that UTC date. Worked target: 144 blocks is the ten-minute pace held for a full day. A day that comes in at 120 blocks settled a sixth fewer batches. Fees, issuance, and weight summed over that day are smaller before any user changed behavior. The series id is obm_block_count_daily. A date with no block is written as 0, because a flow of blocks can be zero.

Block timestamps can step backward relative to height, so a binary search on time can miss a block that sits a little outside the height window and still carries today's date. The export scans a margin of 288 blocks on each side of the approximate window. At 144 blocks a day that margin is two days of production. It changes which blocks get inspected. It does not change the date written on a block that fails the timestamp test.

Daily block weight sums consensus weight units. The cap Llanos cites is 4,000,000 weight units per block, the capacity unit in force since SegWit (segregated witness), which counts witness bytes more cheaply than the rest of the transaction. Fullness is the day's weight divided by the day's block count.

$$ \text{AvgBlockWeight}_d = \frac{\text{BlockWeightWU}_d}{\text{BlockCount}_d}, \quad \text{BlockCount}_d > 0 $$

The ratio is the average weight of the blocks that landed that UTC day. Worked pair, both days packed to the cap. 144 blocks carry 144 times 4,000,000, which is 576,000,000 weight units. 120 blocks carry 120 times 4,000,000, which is 480,000,000. Both averages equal 4,000,000. The 96,000,000 unit gap is the 24 missing blocks, and reading it as emptier blocks will send you looking for a demand crash that did not happen. Transaction count is the same kind of sum: add the transaction field on each block, coinbase included, and normalize by block count before you call it busier.

The coinbase is issuance plus fees

A coinbase of 3.200 BTC in a block with 0.075 BTC of fees issued 3.125 BTC. The coinbase pays the miner the new coins and the fees in one lump. Fees move BTC that already existed. For each non-coinbase transaction, the fee is inputs minus outputs, in BTC. Realized issuance for the block is the coinbase total minus those fees. Miner revenue in BTC is the coinbase total, which is the same thing as issuance plus fees.

$$ I_b = C_b - F_b, \qquad \text{MinerRevenue}_b = C_b = I_b + F_b $$

C_b is the sum of the coinbase outputs. F_b is the sum of fees on the non-coinbase transactions in the block. I_b is the BTC that did not exist before this block. Worked block. Users' inputs sum to 1.500 BTC and their outputs sum to 1.425 BTC, so the fee is 0.075 BTC. The coinbase pays 3.200 BTC. Issuance is 3.200 minus 0.075, which equals 3.125 BTC, the full subsidy on that block, and miner revenue is the 3.200 BTC coinbase. The 1.425 BTC of outputs still contains change. Raw output value, the series obm_raw_output_value_btc_daily, will count that change. It is gross creation, and it is a poor stand-in for payments.

The same three numbers are an identity you can run on the daily files. Spent output value is the sum of the inputs. Raw output value plus fees recovers it: 1.425 plus 0.075 equals 1.500. If your spent-value file and your fee file do not add back to the input side, one of the exports is from a different pass.

Underclaim is why he refuses the theoretical schedule. A miner who writes a coinbase of 3.150 BTC in a block with 0.075 BTC of fees issued 3.150 minus 0.075, which equals 3.075 BTC. The schedule still says 3.125. The shortfall is 0.050 BTC, and a supply series built by multiplying block count by the subsidy will be 0.050 BTC high on that block alone. Daily issuance, obm_issuance_btc_daily, sums I_b over the UTC day. A missing day in the indexer is exported as 0.

The fee share is the day's fees divided by the day's revenue. Revenue is issuance plus fees. Llanos reports a ratio, so 0.10 means ten percent, and a vendor chart scaled in percent will print 10 where this file prints 0.10.

$$ \text{FeeShare}_d = \frac{\text{FeesBTC}_d}{\text{Issuance}_d + \text{FeesBTC}_d} $$

Numerator and denominator are both BTC, so the ratio is dimensionless. You sum first, then divide. Worked day under the current 3.125 BTC subsidy: 144 blocks, each claiming the subsidy in full, issue 144 times 3.125, which equals 450 BTC. Fees of 50 BTC put miner revenue at 500 BTC and the fee share at 50 divided by 500, which equals 0.10.

He computes the share from the summed day. Two blocks, each with issuance 3.125 BTC, show why the order matters. The first collects 3.125 BTC of fees, so its own share is 3.125 divided by 6.250, which equals 0.50. The second collects no fee, so its share is 0. The average of those two shares is 0.25. The day's sums are fees of 3.125 BTC and issuance of 6.250 BTC, revenue 9.375 BTC, and 3.125 divided by 9.375 equals one third, which prints 0.3333. The gap is one twelfth, 0.0833. OBM's obm_fee_share_revenue_ratio_daily is the 0.3333. A UTC day with no coinbase and no fees has a zero denominator, and the export writes that day as missing. A zero would read as a fee share of nothing on a day that had no revenue to share.

Fractional age is the product, and flooring it builds a different series

For each spent output the indexer recovers the value and the creation timestamp, then the age in days.

$$ a_i = \max\left(0,\ \frac{t_i^{\text{spent}} - t_i^{\text{created}}}{86400}\right), \qquad \text{CDD}_d = \sum_{i \in S_d} v_i a_i $$

The timestamp t is a Bitcoin block time in seconds. Dividing by 86,400 converts the gap into days and keeps the fraction. v_i is the spent output in BTC. S_d is every non-coinbase input in blocks assigned to that UTC date. The product of v_i and a_i is BTC-days. "Destroyed" means the age is reset when the output is consumed. The coins are still there.

Worked output, the case he uses against Coin Metrics. One bitcoin, age 2.50 days, contributes 1 times 2.50, which equals 2.50 BTC-days. Full days only: 2.5 counts as 2, so the same coin contributes 2.00 BTC-days. The gap is 0.50 BTC-days. Internally the indexer stores satoshi-days and the export divides by 100,000,000. Do that once.

A backward stamp is real. Spent at second 1,000, created at second 1,500: the raw gap is minus 500 divided by 86,400, which equals -0.005787 days. The max with zero sets the age to 0, so that output adds nothing and subtracts nothing. He counts how often the floor fires and stores the count in the indexer metadata.

Early duplicate coinbase identifiers get overwritten in the live outpoint table and are not treated as spent, so they generate neither spent value nor coin-days. That is a genesis-era edge, and it is in the metadata if you need to see whether it fired.

Dormancy is the average age of the coins that moved

His own two-coin day prints a dormancy of 17.50 days. Dormancy divides the day's coin-days destroyed by the day's spent BTC. The unit is days. It is the value-weighted age of what got spent, and a day with nothing spent is undefined.

$$ \text{Dormancy}_d = \frac{\text{CDD}_d}{\text{SpentValueBTC}_d}, \quad \text{SpentValueBTC}_d > 0 $$

BTC-days over BTC leaves days. Because both the numerator and the denominator are stored in satoshis inside the indexer, the 100,000,000 conversion cancels and you do not apply it. Worked day, using his own coins. Spend 1 BTC aged 10 days and 3 BTC aged 20 days. Coin-days destroyed are 1 times 10 plus 3 times 20, which equals 70. Spent value is 4 BTC. Dormancy is 70 divided by 4, which equals 17.50 days. The 3 BTC coin pulls the average above 10 because the weights are the BTC amounts.

A zero spent-value day is exported as missing, including a date the indexer never wrote a row for. Filling that missing with 0 calls a day with no spends a day of brand-new coins. I am against that fill. The series id is obm_dormancy_days_daily, and the denominator is obm_spent_value_btc_daily, gross of change, self-transfers, and exchange reshuffling. Nothing in the division identifies a seller.

Supply-adjusted coin-days destroyed is the other normalization, coin-days divided by the outstanding supply that day, and the unit is again days. On a toy day with 20 BTC-days destroyed and 100 BTC outstanding, the ratio is 20 divided by 100, which equals 0.20 days per bitcoin outstanding. Llanos's own unit reading is the same shape: a print of 0.015 means 0.015 days of destroyed age for each bitcoin outstanding. That 0.015 is a unit reading in the text, with no date attached.

Liveliness divides cumulative destruction by the sum of every day's supply

Supply, obm_supply_btc_daily, is realized issuance added up from 2009-01-01. Dates before any block contribute zero issuance, so the sum can start on a calendar that includes them.

$$ \text{Supply}_d = \sum_{k=2009\text{-}01\text{-}01}^{d} \text{Issuance}_k $$

Each term is BTC created that UTC day, after fees have been removed from the coinbase. The first difference has to give issuance back: supply today minus supply yesterday equals today's issuance, for every day after the start. Worked path. Day 1 issues 50 BTC, supply is 50. Day 2 issues 50, supply is 100, and 100 minus 50 equals 50. Day 3 issues 0, supply stays 100, and the difference is 0. A theoretical-subsidy supply will fail this check on any block that underclaimed.

Cumulative destruction of 30 BTC-days over a summed supply of 250 prints a liveliness of 0.12. The same 30 divided by the day-3 supply stock of 100 prints 0.30. Liveliness asks how much of the coin-age ever created has later been destroyed. The numerator is cumulative coin-days destroyed. The denominator is the sum of the daily supply prints, which treats each outstanding bitcoin as creating one coin-day per UTC day on the file.

$$ \text{Liveliness}_d = \frac{\sum_{\tau \leq d} \text{CDD}_{\tau}}{\sum_{\tau \leq d} \text{Supply}_{\tau}} $$

Both sums are BTC-days, so the ratio is dimensionless. He is explicit that this denominator is a daily approximation. A coin mined at 23:00 UTC still contributes a full coin-day that calendar day. A version that accrued age inside the day would need each output's creation timestamp against the exact second of the spend. He documents the daily sum and leaves that intraday accrual uncomputed. Keep his sum. Missing coin-days-destroyed dates count as zero flow. A missing supply date aborts, because the denominator has to be complete. A zero cumulative denominator is written as missing.

Same three days, with coin-days destroyed of 0, then 20, then 10. After day 3 the numerator is 0 plus 20 plus 10, which equals 30. The denominator is 50 plus 100 plus 100, which equals 250. Liveliness is 30 divided by 250, which equals 0.12. After day 2 it was 20 divided by 150, which equals 0.1333. Divide the same 30 by the day-3 supply stock of 100 and you get 0.30. That 0.30 uses the stock. The series obm_liveliness_ratio_daily uses 0.12.

A coin aged 155 days is entirely in or entirely out

In the worked spend, coins older than 155 days are 0.20 of the BTC that moved and 0.8333 of the coin-days destroyed. Age is a switch on this series. Outputs at least 155 days old contribute their BTC; younger outputs contribute nothing. The unit is BTC. The appendix heading calls this a coin-days threshold, and the unit line says BTC. Use the unit line. Multiplying by 155 again would count coin-days the switch already refused to weight.

$$ \text{SpentGE155}_d = \sum_{i \in S_d} v_i \mathbf{1}\{a_i \geq 155\} $$

The indicator is 1 when the fractional age is at least 155 days and 0 otherwise. Worked spend: 2 BTC aged 200 days and 8 BTC aged 10 days. The 155-day sum is 2 BTC. Total spent value is 10 BTC, so the old coins are 2 divided by 10, which equals 0.20 of the BTC that moved. Their coin-days are 2 times 200, which equals 400, against 8 times 10, which equals 80, from the young coins, 480 BTC-days in total. The old coins are 400 divided by 480, which equals 0.8333 of the coin-days destroyed. A coin-days spike and an old-coin spike are different events, and this pair is how you tell them apart.

The complement is total spent value minus the 155-day sum: 10 minus 2 equals 8 BTC, which is obm_spent_value_lt155d_btc_daily. The one-year sum uses the same switch at 365 days. Every coin that clears 365 also clears 155, so on files from one release the 365-day spent value sits at or below the 155-day spent value, which sits at or below total spent value. On this day the 200-day coin fails the one-year test, so the 365-day sum is 0, and the chain 0, then 2, then 10 holds. The 2 BTC sitting between the cutoffs is the medium-old flow.

Glassnode's long-term holder spent volume, which is the public series people reach for here, is an entity label with a logistic centered at 155 days and a transition width of 10 days. Llanos describes that logistic and does not print it. At 155.00 days his own indicator is already 1, and that same age is the center of the transition he attributes to them. Swapping the two series into one regression changes the object. Self-transfers stay in the sum. A wallet consolidation of a 200-day output prints as old coins spent.

The hashrate estimate bills every block in the window to the span from first timestamp to last

On a toy retarget, end-of-day difficulty is 55 trillion and the average of the two blocks that day is 52.5 trillion. Difficulty is the protocol field on the block. Hashrate is inferred from those difficulties and from how long the blocks took to arrive. End-of-day difficulty is the difficulty on the highest-height block assigned to that UTC date, and a date with no block is missing.

$$ \text{DifficultyEOD}_d = D_{b^*}, \qquad b^* = \arg\max_{b \in B_d} h_b $$

D is the difficulty field Bitcoin Core returns, h_b is height, and B_d is the set of blocks on that date. You keep one number, the last height, because difficulty is a state that sits still inside a 2,016-block epoch and jumps at the retarget. Worked retarget, labeled as a toy. Two blocks share a UTC date: height 799,999 at difficulty 50 trillion, height 800,000 at difficulty 55 trillion. End-of-day difficulty is 55 trillion. The average of the two prints is 52.5 trillion, and that average is a different series. Coin Metrics DiffLast is the last block in the interval, which is the same convention if the day boundary matches. A mean difficulty will diverge on the retarget day and agree on the quiet days, which is exactly when a merge looks safe.

The 7-day hashrate estimate sums, over every block whose timestamp falls in the trailing seven UTC days, that block's difficulty times 2 to the 32, then divides by the seconds between the earliest and latest timestamp in the window. 2 to the 32 is 4,294,967,296. Difficulty is defined so the expected hashes to find a block equal difficulty times that constant. Divide by 10 to the 18 to land in exahashes per second. The window length is part of the name: obm_est7d_hashrate_ehs_daily. A 14-day run writes a different id.

$$ \hat{H}_d^{\text{EH/s}} = \frac{\sum_{b \in W_d} D_b \, 2^{32}}{\left(\max_{b \in W_d} t_b - \min_{b \in W_d} t_b\right) \, 10^{18}} $$

W_d is the set of blocks with timestamps from 00:00:00 UTC on day d minus 6 through 23:59:59 UTC on day d. The denominator is the span from the first block in that set to the last. Seven exact midnights would be 604,800 seconds, and the first and last blocks in the window rarely sit on those two edges, so the spans differ. Fewer than two blocks, or a span that is not positive, writes missing.

Worked toy, so the powers of ten stay on the page. Three blocks, each at difficulty 1,000,000,000,000, timestamps 1,000,000, 1,000,600, and 1,001,200. The span is 1,200 seconds. The numerator is 3 times 1,000,000,000,000 times 4,294,967,296, which equals 12,884,901,888,000,000,000,000. Dividing by 1,200 gives 10,737,418,240,000,000,000 hashes per second, and dividing by 10 to the 18 gives 10.73741824 exahashes per second, 10.74 to two decimals. A real window uses the same ratio with the difficulties on the blocks in that window. The formula scales in a straight line with difficulty, and this toy's difficulty is far below the live network, on purpose.

He includes every block in the numerator and starts the clock at the first of those blocks. The search that found the first block happened before that timestamp, so the numerator has one more difficulty term than the denominator has gaps. On a week that contains the expected 7 times 144, which equals 1,008 blocks, that extra term is 1,008 divided by 1,007, which equals 1.000993, an overstatement of 0.0993 percent, 0.10 percent to two decimals, against a version that dropped the first block. Keep his formula. That 0.10 percent is what it implies at the target pace, and a three-block toy makes the same choice look enormous because the extra term is one of three. A production week stays on the printed ratio. If the span is not positive he already writes missing, which is the right failure when two blocks share a timestamp.

The young coin is where the full-day floor shows up

The tall bar is the young coin. Flooring its age removes 20.00% of the fractional coin-days.

Full-day age floor as a percent of fractional coin-days destroyed, for a 2.50-day coin, a 10.75-day coin, and a 100.20-day coin

The bars are three constructed coins under the floor rule he quotes, chosen so the products land on exact hundredths. The 2.50-day coin, 1.00 BTC, is 2.50 against 2.00. The 10.75-day coin, 4.00 BTC, is 43.00 against 40.00, a 6.98% gap. The 100.20-day coin, 0.50 BTC, is 50.10 against 50.00, a 0.20% gap. Glassnode, CryptoQuant, Bitbo, and Newhedge publish a coins-times-days product and leave the fractional-day rule undocumented. He says the early chain is where the disagreement is widest, and he suggests you repeat any vendor comparison after dropping the first 30 days and again after dropping the first 90. Those windows are his advice. He does not publish the paired series.

Check the identities on the CSV before it enters the book

You need a non-pruned Bitcoin Core node, version 30.2 in his writeup, mainnet, with the transaction index on. Block-count, weight, difficulty, and the hashrate estimate read block metadata. Fees, issuance, coin-days, dormancy, spent value, and the 155-day cut need the spent-output indexer, which walks the chain once into SQLite and then exports. The paper does not quote the disk that node will occupy. Budget for the full chain plus the index. The scripts and the v0.1.0 archive sit in the repository he names, github.com/diegorllanos/open-bitcoin-metrics. The indexer commits on a height stride, so a long build can resume, and if the stored block hash at the last height no longer matches the node it aborts instead of rewinding through a reorg on its own.

Before the file touches a regression, recompute the identities on a sample of dates. Issuance plus fees equals miner revenue. The sum of the coin-days age bands equals the scalar coin-days series. Spent value at least 365 days sits at or below spent value at least 155 days, which sits at or below total spent value, and the under-155 file is the residual. Supply's first difference equals issuance. A flow with no indexer row is 0. A ratio with a zero denominator, and a state variable on a day with no block, is missing. End-of-day UTXO count, the count of unspent transaction outputs, is one of those state variables: the number of spendable outputs after the highest block of the UTC day. OP_RETURN outputs, which carry a provably unspendable script, are left out. Immature coinbase outputs stay in, because they are already in the set.

$$ U_b = U_{b-1} + N^{\text{spendable created}}_b - N^{\text{non-coinbase inputs}}_b $$

You add the outputs a node could someday spend and subtract one for each non-coinbase input. Worked block, starting from 1,000 outputs. The block creates a spendable coinbase, two ordinary outputs, and one OP_RETURN, and it spends two previous outputs. Spendable creations are 3. The count moves by 1,000 plus 3 minus 2, which equals 1,001. A UTC day with no block is missing. A 0 would say the set disappeared overnight.

The old article "An Open L4 Order Book: What Hyperliquid Data Unlocks" ran a node so a perp book could be rebuilt from the chain. This is that job for the daily on-chain file. The old article "Crypto Has Fundamentals: A Seven-Factor Model (Read Skeptically)" builds a quality score on four Coin Metrics activity series and does not print the weights, which is why the t-statistic of 9.80 cannot be rebuilt from the page. Fees and transaction counts sit in that family, and a node can recompute them under the identities above. Unique participants need an entity map, and a full node does not have one. Entity-adjusted long-term-holder selling labels clusters. obm_spent_value_ge155d_btc_daily sums raw outputs past a hard age cut. Using one in place of the other changes the regressor under a stable name.

The release ships no price. A USD miner-revenue chart multiplies this BTC series by a spot file from somewhere else. Keep the research book in BTC until that price file has a timestamp convention as explicit as the block date.

KEY POINTS

  • Assign every block by the UTC date of its own timestamp, and scan 288 blocks past the search edge. The ten-minute pace is 144 blocks; 120 full blocks and 144 full blocks both average 4,000,000 weight units, and the gap is the missing blocks.
  • Take issuance as coinbase minus fees. A coinbase of 3.200 BTC and fees of 0.075 BTC issued 3.125 BTC. An underclaim to a 3.150 BTC coinbase with the same fees issued 3.075 BTC, 0.050 BTC under the schedule.
  • Divide the day's fees by the day's issuance plus fees. Fees of 50 BTC on issuance of 450 BTC are a 0.10 share. Averaging a 0.50 block share and a 0 block share prints 0.25 against the summed share of one third.
  • Multiply spent BTC by fractional age. One bitcoin idle 2.50 days destroys 2.50 BTC-days; the full-day rule prints 2.00. His dormancy example is 70 BTC-days over 4 BTC, which is 17.50 days.
  • Treat 155 days as a hard cut on the output. In the worked spend, 2 BTC of 200-day coins are 0.20 of the BTC that moved and 0.83 of the 480 BTC-days destroyed (400 divided by 480 equals 0.8333). A logistic centered at 155 days is a different series, and he does not print that logistic.

References


A note on AI. The ideas, research, analysis, and conclusions in this article are my own. I use AI tools to help with editing and wordsmithing, because English is not my first language, and I am not shy about that. AI-generated ideas and AI-assisted writing are not the same thing: the first is empty slop from a generic prompt, the second is a tool for communicating years of real research more clearly. Judge the work by its substance, not by whether software helped polish the prose.