Bitcoin public-key exposure census: method and reproducibility

The census reports that 7,164,754.12 BTC, 35.6 % of the 20,109,207.36 BTC in unspent outputs at block 975,019, sits in outputs whose public key or script is already public.

What is counted

The basis is the UTXO set at height 975,019, as exported by Bitcoin Core's dumptxoutset. Each output is classified by its scriptPubKey and counted as exposed when:

  • P2PKH or P2WPKH: its 20-byte program is in pubkey_hash_index.bin, i.e. it is the HASH160 of a public key published anywhere on chain up to the snapshot height, or the HASH160 of such a key's P2WPKH script that was funded as P2SH (the table does not record which);
  • P2SH: the redeem script has been revealed on chain, or the script hash is the nested-P2WPKH wrapper of a public key already published anywhere on chain (either suffices), i.e. its 20-byte program is in script_hash_index_20.bin or in pubkey_hash_index.bin;
  • P2WSH: its 32-byte program is in script_hash_index_32.bin, i.e. the witness script was revealed;
  • P2TR, P2PK and bare multisig: always, because the public key is part of the output script itself (structural exposure).

Outputs of any other form are counted but never exposed. Bare multisig means one to three keys of 33 or 65 bytes. A key counts as published when a block up to that height contains it as a whole 33- or 65-byte push or witness element, as a Taproot output or internal key, or as a 32-byte push directly before OP_CHECKSIG, OP_CHECKSIGVERIFY or OP_CHECKSIGADD in a tapscript of leaf version 0xc0.

A public key on chain does not let anyone take the coins today. It matters if an attacker can one day derive private keys from public keys, for example with a large quantum computer. Such an attacker would find these keys or scripts already on chain.

Results at height 975,019

ClassUTXOsBTCExposed UTXOsExposed BTC
P2PKH43,720,7524,502,293.8074087717,352,7921,162,510.90914428
P2WPKH49,586,7728,310,066.7059694221,495,6132,137,831.71720213
P2SH11,715,5053,678,167.095190005,375,6971,177,704.69056694
P2WSH2,838,6971,678,829.15190045463,944749,474.34475754
P2TR53,016,095222,545.2809096553,016,095222,545.28090965
P2PK44,9721,714,618.8115170544,9721,714,618.81151705
Bare multisig2,618,47468.364837142,618,47468.36483714
Other117,4802,618.1460074600.00000000
Total163,658,74720,109,207.36373994100,367,5877,164,754.11893473

Amounts are in BTC, exact to the satoshi. The total is 230.14 BTC below the sum of all block subsidies up to this height. The genesis output and two coinbase outputs overwritten by later duplicate transactions account for 150 BTC. The rest is unclaimed block reward and value sent to OP_RETURN outputs.

The census also reports 59,880,712 "addresses with balance": the number of distinct scriptPubKeys that hold unspent outputs at height 975,019, counted once across all script types. It is neither an address nor a key count: P2PK, bare multisig and other non-standard scripts have no address, and one key's P2PKH and P2WPKH scripts count as two.

Data and provenance

UTXO snapshot

FieldValue
SoftwareBitcoin Core v28.1.0, dumptxoutset
Taken to UTC
base_height975,019
base_hash0000000000000000000158c9898f947463d71d98c97f1dad1639e25114a1dae6
coins_written163,658,747
nchaintx1,476,123,483
txoutset_hash4331da7969c9357813729a743849f577cb056fedd87babf89d44ad0b29cc5026
File size9,337,369,206 bytes
File SHA256b990d18549342f55f0d1c5843941c20b6f7bbf078faf66ba5290891e644ddf3b

The node ran with networking disabled and had not moved past height 975,019. The snapshot file is not published.

Exposure tables

The tables come from a scan of the raw block files for heights 0 to 975,019: 975,020 blocks and 1,476,123,483 transactions, the same transaction count as nchaintx. A rebuild on , run with no shard files to resume from, matched the first build's tables byte for byte. On the scanner in the repository also reproduced them byte for byte, using only the blocks on a best-chain list exported from a node.

Each table is a header-less array of fixed-width records, sorted ascending by unsigned byte order, without duplicates. An entry is a program that, by height 975,019, was funded at least once and had its key or script published at least once.

FileRecordEntriesContent
pubkey_hash_index.bin20 bytes1,279,711,199HASH160 of the six encodings of each published key (compressed, uncompressed and hybrid, each for both y parities), funded as P2PKH or P2WPKH, and of their P2SH-P2WPKH form, funded as P2SH
script_hash_index_20.bin20 bytes384,687,335Funded P2SH programs that are the P2SH or P2SH-P2WSH form of a revealed script
script_hash_index_32.bin32 bytes39,243,253Funded P2WSH programs that are the SHA256 of a revealed script, or a TapLeaf or TapBranch hash
36821d50c7b9d1511b9aabd462cfbbdbb4369894fc62a77fb18ed742ec7df5e6  pubkey_hash_index.bin
f8aaa8c3c7d3b583753ce7b703b2aa1aea78e3b8d7ea3cc790e95777e2f6e782  script_hash_index_20.bin
6ca074f9fa4f5b1cf4b9e0a7c02b0d8be102734cc6e27f60f8c25c91f48bf54b  script_hash_index_32.bin

Downloads and lookups

The tables at height 975,019 are published as one archive, with a .sha256 file beside it and SHA256SUMS inside.

https://snapshots.ark0.si/btc-exposure-index-975019.tar.zst
33,654,024,835 bytes
SHA256 b1712d436b9811ed2261399166bafd055e11f3a48f79e351e9c14e49076d13ba

The published tables and archives and the data files in results/975019/ are dedicated to the public domain under Creative Commons Zero v1.0 Universal (SPDX identifier CC0-1.0, https://creativecommons.org/publicdomain/zero/1.0/legalcode).

https://data.ark0.si answers single lookups. GET /lookup/hash/<hex> takes a 20-byte or 32-byte program and reports membership in each table. GET /healthz reports the index state. Requests are limited to 10 per 10 seconds per IP address, after which that address gets HTTP 429 for 10 seconds. Answers describe the index at last_indexed_height, which is past 975,019, so a program first exposed after the snapshot also shows as present. Data added after 975,019 has known problems, listed under Known limitations in the repository README.

How to reproduce

The repository https://github.com/duncan0k/btc-exposure-index has the indexer source (btc-indexer/), the extraction rules (docs/extraction-rules.md), the census tool (tools/utxo-census/) and the results at block 975,019 (results/975019/).

  1. On a Bitcoin Core node whose chainstate is at height 975,019, run dumptxoutset and compare base_hash, coins_written and txoutset_hash with the snapshot table. The tool reads snapshot format version 2, as written by v28.1.0. A node already past 975,019 that still has the blocks above that height can write this snapshot by rolling back; the UTXO census section of the repository README shows how.
  2. Download the archive and its .sha256 file, verify and unpack it:

    sha256sum -c btc-exposure-index-975019.tar.zst.sha256
    mkdir tables
    tar -I zstd -xf btc-exposure-index-975019.tar.zst -C tables
    (cd tables && sha256sum -c SHA256SUMS)

    SHA256SUMS covers the three tables, two smaller cross-format tables, last_indexed_height and stats.json. Its three table lines must match the ones above. Section 9 of the extraction rules describes rebuilding the tables from raw block files, using only the blocks on a best-chain list exported from a node.

  3. Build utxo-census, which uses only the Rust standard library, with cargo build --release and cargo test in tools/utxo-census/. Then run:

    ./target/release/utxo-census --utxo <file> --tables <dir> --out <dir> --tmp <dir> [--tool-version <str>] [--limit-coins N] [--check-curve]

    --tables is the directory unpacked in step 2.

  4. Compare the output stats.json with the results table. Its amounts are in satoshis, and count_matches_header must be true.

Limitations

  • The funded filter on the tables removes nothing the census needs, because every unspent output funds its own program.
  • A 32-byte x-only key is taken only as a Taproot output or internal key, or in a tapscript of leaf version 0xc0 directly before OP_CHECKSIG, OP_CHECKSIGVERIFY or OP_CHECKSIGADD. Other x-only keys are not extracted.
  • The scan infers spend types from the shape of the scriptSig and witness, without the spent output. Random key-shaped bytes count as keys but reach a table only through a hash collision. A witness that looks like a Taproot script-path spend is read as one, losing its real witness script.
  • P2TR, P2PK and bare multisig outputs count as exposed by their form, whether or not their keys are valid curve points. Of these, 19,915 UTXOs holding 0.17 BTC fail the census curve check (--check-curve). A P2TR or P2PK output fails it when its key does not pass, a bare multisig output when fewer than m of its keys pass, where m is the number of signatures required. The check accepts only 02, 03 and 04 keys, so it also fails one P2PK output whose hybrid key is valid.
  • The P2SH row mixes nested P2WPKH outputs with all other P2SH scripts.
  • The census is pinned to one block hash, so later reorganizations do not affect it. The rebuild did not check block hashes, and the first build's scanner revision was not recorded, so either build may have read records of stale or duplicate blocks, or of blocks above 975,019. The scan took only the blocks on a best-chain list, checked each against it and reproduced the tables byte for byte, so no table entry depends on a block outside the list. The scan trusts the node that exported the list and does not check proof of work.
  • Key counters reported by /healthz, such as unique_published_x_coords, include x values that fail the curve check; the headline does not use those counters.