Why it exists
BIP 158 defines compact block filters: small summaries that help a wallet decide whether to download a block. A filter answers “possibly relevant” or “not present” for the included element set. It does not provide a balance, transaction history or proof that a payment is valid.
How it works
The basic filter contains output scripts, excluding OP_RETURN outputs, and the scripts of spent previous outputs for non-coinbase inputs. The construction deduplicates and hashes elements, maps them into a numerical range, sorts them, and compresses successive differences with Golomb-Rice coding.
A wallet hashes its own relevant scripts using the same block-specific parameters and tests for a match. Correctly constructed filters do not miss included elements, but unrelated scripts can occasionally match. BIP 157 supplies the network messages and filter-header structure used to retrieve these summaries.
A practical example
Suppose a wallet tests the script for a receive address against a block’s filter and finds a match. It downloads the block, then checks whether an actual transaction pays that script. If none does, the result was a false positive; the wallet simply continues without inventing a payment.
What to keep in mind
The no-false-negative property assumes an honestly constructed filter. A malicious peer can send incorrect data, so clients need a verification strategy. Filter matches are not cryptographic inclusion proofs, and privacy can still be affected by how matching blocks are fetched.
Status & implementation
BIP 158 is Deployed. Bitcoin Core’s compact-filter index and BIP 157 serving support provide an implementation route; Core 0.21.0 documents the serving option. A wallet must implement local matching and block verification to benefit from the format.
Specification status: Deployed · Sources checked 13 November 2026
