BOMBARCHIVE
Explore

A living reference collection. Written in the wiki, preserved in Git.

The archiveBitcoin

Old revision: BIP 158

archive: trace BIP 158's abandoned 2018 extended filters and basic-filter redesign

BIP 158, Compact Block Filters for Light Clients, specifies the deterministic, compressed block filters used by the BIP 157 network protocol. Its authors are Olaoluwa Osuntokun and Alex Akselrod; its assigned date is 24 May 2017. The distinction is deliberate: BIP 158 defines what a filter contains and how to encode it, while BIP 157 defines how Bitcoin peers exchange, compare and check filters. Maintained BIP 158 specification

A block's scripts in a compact search structure

The initial and specified type is basic, code 0x00. For every transaction in a block, its filter includes the scriptPubKey of each new output except outputs whose script begins with OP_RETURN. For every non-coinbase input it also includes the scriptPubKey of the previous output being spent. These are script bytes, not printed wallet addresses, transaction identifiers or arbitrary transaction bodies. Duplicate input elements are treated as a set. Basic filter contents

That spent-output requirement matters when rebuilding a filter from Bitcoin history: the previous output's script is not necessarily written in the block being filtered. A construction system needs a trustworthy way to obtain the referenced output, such as validated historical block/UTXO data. It cannot faithfully derive a basic filter merely by scanning the current block's new output scripts. Filter content rules

The filter uses a Golomb-coded set (GCS), not a traditional Bloom filter. Its construction hashes the items to integers in a bounded range, sorts the integers, and compresses successive differences with Golomb–Rice coding. The specified basic parameters are P = 19 and M = 784931. The SipHash key is derived from the first 16 bytes of the block hash in its specified byte order. Each block therefore has reproducibly derived filter bytes for this filter type when the underlying chain data is fixed. Golomb-coded set, basic construction

A GCS member is guaranteed to match its correctly constructed filter; unrelated queried items can sometimes match by chance. The probability described by the BIP is governed by M. A match therefore says this block may be relevant. The client must fetch and inspect the full block to establish that it actually contains the script or transaction it wants. A non-match is meaningful only if the served filter is complete and authentic. Golomb-coded sets · BIP 157

What the basic filter deliberately leaves out

The OP_RETURN omission is an explicit specification choice. The BIP's rationale was to keep open a future possibility of committing filter data inside an OP_RETURN output without making construction depend on itself. That rationale documents a design option, not a claim that Bitcoin adopted such a consensus commitment. Basic filter, contents and rationale

For archival indexing, the scope is consequential. A BIP 158 basic filter does not index the raw contents of a witness, an inscription envelope, an OP_RETURN payload or a Bitmap District name. It indexes the specified scripts. It may help a wallet decide which blocks involve known scripts, but it is not an Ordinals search engine, a general full-text blockchain search service or a proof of application-level rules. This is an inference from the explicitly enumerated inputs to the filter, not a tested claim about any particular inscription indexer. Enumerated filter elements

The earlier filters that did not survive 2018

The filter's present simplicity was a design choice reached through revision, not the whole 2017–2018 proposal. The first identified BIPs-repository version, committed 22 January 2018, defined two filter types. Its 0x00 basic filter included each non-coinbase input's outpoint, individual data pushes from parseable output scripts, and every transaction's txid. Its separate 0x01 extended filter included witness-stack items and scriptSig data pushes for non-coinbase transactions. The original also set P = 20 with a hash range derived from N * 2^P. These are proposed filter contents in an archived draft, not evidence that today's BIP 158 or Bitcoin Core serves witness-aware extended filters. January 2018 specification — primary Git artifact

The first adjustment came on 1 April 2018: a BIPs commit replaced the output-script data pushes with each output's whole scriptPubKey. That is a concrete encoding change: two outputs that contain the same pushed data but differ in script structure are not interchangeable as whole-script elements. April 2018 source change

A larger redesign was merged on 5 July 2018, following a pull request opened 1 June. It removed transaction IDs from the basic filter and removed the extended filter type altogether. It replaced spent outpoints with the scripts of the previous outputs being spent, excluded new outputs whose scripts begin with OP_RETURN, and separated the Golomb–Rice coding parameter P from the hash-range parameter M. The resulting basic configuration was P = 19, M = 784931. Accordingly, the earlier and later 0x00 filters encode different sets of items despite retaining the same type number; stored old-draft filter bytes cannot simply be relabelled as the later specification's basic filters. This is a comparison of the source definitions, not an independently reproduced cross-version network test. Revision PR and rationale · Merged source and test-vector changes

The pull-request author, Olaoluwa Osuntokun, argued that wallets could first match an output script and then inspect the relevant full block for an exact transaction ID, while the extended type lacked a clear use case and increased server storage. Those are contemporary first-party design reasons, not an independent benchmark proving that every application could dispense with the discarded elements. On 10 July, a follow-up commit corrected the text's description of the false-positive rate to relate it to 1/M, not 2^(-P); the current definition keeps P for Rice encoding. Subsequent source changes clarified the block-hash byte order and updated the test vectors, making reproducible filter bytes more precise than the early draft alone. Author's explanation · 10 July correction · 28 August endianness clarification · September test-vector update

For Ordinals history, this is a useful counterfactual with a clear boundary: an abandoned BIP 158 extended-filter design referred to witness-stack items, while the maintained and deployed basic-filter definition does not. Neither proposal nor deployed basic filters should be retrospectively described as a general inscription-content index. Inscription metadata and Inscription provenance require their own parsing and validation.

Filter hashes and verification

BIP 158 specifies the serialized filter. BIP 157 hashes those bytes and constructs a chain of filter headers for peers to compare. A client can compare the header chains supplied by multiple peers, find a disagreement and download the disputed full block to recompute its correct filter.

The filter-header sequence is not committed to by Bitcoin block headers under this design. Without a truthful comparison source, several colluding peers could present identical false filter chains. The BIP 157 protocol describes its stronger assurances under an assumption that at least one contacted peer is honest. A filter alone is neither a Bitcoin proof-of-work certificate nor a proof that no relevant payment was hidden by a malicious server. Filter headers, client operation and rationale

A first-party development chronology

24 May 2017
The BIP's assigned date. It identifies a proposal, not a software-release milestone. BIP header
22 January 2018
The first identified bitcoin/bips commit adds the BIP 157 and 158 texts together. The later maintained document includes further revisions, so its exact wording should not be attributed wholesale to this initial record. Repository addition
1 April 2018
The draft changed its basic filter from individual output data pushes to complete output scripts. Source commit
5 July 2018
BIPs PR #687 merged a new basic-filter definition: no txids or extended filter, spent-prevout scripts rather than input outpoints, exclusion of OP_RETURN outputs, and P = 19, M = 784931. The June proposal and July merge are distinct dates. First-party proposal and merge
26 August 2018
Bitcoin Core merged its BIP 158 filter-construction implementation. The PR explicitly stated that the code was **not yet used elsewhere in Core**; no peer service was established by this merge. Merged construction PR
28 August–7 September 2018
The source clarified block-hash endianness for SipHash keys and updated test vectors, including unusual script cases. These refinements followed the July redesign rather than establishing a separate new deployed filter type. Endianness commit · Vector changes
14 September 2018
Lightning Labs announced Neutrino light-client support in lnd 0.5-beta and an associated testnet Lightning App alpha. It documented real implementation work, with mainnet adoption beyond this announcement still a separate question. Contemporary release announcement
18 April 2019
Bitcoin Core merged the persistent BlockFilterIndex, which stores filters, their hashes and filter headers. The PR described a roughly 3.8-GiB index at its then-tested height 565500; that is a historical benchmark, not the index's current size. Merged index PR and measured size
24 November 2019
Bitcoin Core 0.19.0.1 released -blockfilterindex and the getblockfilter RPC, with release notes estimating roughly **4 GiB** for the historical index at that time. The release expressly **did not** offer filter retrieval over the P2P network. Release notes · Dated release notice
14 January 2021
Bitcoin Core 0.21.0 shipped the ability to **serve** BIP 157 filters over P2P with -blockfilterindex=1 -peerblockfilters=1. This was an explicitly configured service, not an automatic consequence of running a default node. Release notes
11 September 2025
The BIPs repository promoted BIP 158's metadata from **Draft** to **Final**, alongside BIP 157. A separate commit added mutual Requires references. The documents themselves and the implementation precede this status change by years. BIP 158 status · Cross-reference update
12 January 2026
A broad maintenance commit changed BIP metadata from **Final** or **Active** to **Deployed**. The current BIP 158 header uses that label, but the commit is not a node census or first-deployment event. Repository-wide status migration

Different indexes, different promises

The BlockFilterIndex is a compact search aid for wallet-relevant scripts. A full transaction index can locate historical transaction identifiers, while an Ordinals index parses inscription envelopes and determines application-specific identities and ordering. These structures answer different questions and may be operated together; their names and capabilities should not be exchanged.

BIP 152's compact blocks are also different. BIP 152 reduces redundant block-relay data between peers who have already seen many transactions. BIP 158 summarises scripts in confirmed blocks for light-client scanning. The similar adjective compact hides a different purpose. BIP 152 · BIP 158

Open research

Open question
Recover versioned 2018 test clients or released filter stores that followed the early two-filter specification, and determine whether any real interoperability or migration problem arose before the July 2018 redesign. A changed draft alone does not prove a production-network break.
Open question
Reproduce basic filter bytes for a small set of archived mainnet blocks using two independent implementations, including spent-prevout scripts and OP_RETURN exclusions. Record block hashes, software versions and results.
Open question
Establish measured 2026 filter-index size and coverage on a configured Bitcoin Core release; do not reuse the 2019 4-GiB estimate as a timeless storage requirement.