A Bitcoin wallet looking for its own transactions has an awkward choice. It could download every block and search for itself, or tell a server which activity it wants to find. Compact block filters offer another approach: download a small summary for each block and check it locally. If the summary says a block might matter, fetch the block and look for the transaction. BIP 157 client protocol · BIP 158 filter format
The word “might” makes the design work. A compact filter is not a transaction list, and its results do not have the same meaning as a full node's decision to accept a block.
What a basic filter matches
BIP 158 defines a basic filter that includes most output scripts created in a block and the previous output scripts spent by its ordinary transaction inputs. It excludes outputs that start with OP_RETURN, and the coinbase input does not spend a prior output to include. A script is the set of conditions encoded in an output. The filter isn't a collection of address strings, fees or wallet balances. Basic filter contents
Consider a wallet watching for payments to one of its scripts. If a new block creates an output with that script, the wallet can find a candidate by checking the filter. If a later block spends one of its outputs, the prior script can also produce a match. One compact representation can point the wallet toward both incoming and outgoing activity, without carrying enough information to show which transaction it found or how much bitcoin moved.
To keep the representation small, the format maps elements into a bounded range and compresses the resulting sorted values. Different elements can map to the same value, which can produce a hit even when the desired script isn't present. With a correctly constructed filter, a negative test for an included element is reliable; a positive result is a cue to download and inspect, not evidence of a payment. Test several scripts and there are more opportunities for a false match. The cost is an occasional unnecessary block download, rather than a need to fetch every block.
Filters are checked separately from blocks
BIP 157 supplies the network messages for asking peers for the filters and their headers. A filter header commits to the current filter and the preceding filter header. It is not the same object as a mined block header, and it's not an extra field in the Bitcoin block header. The client can compare responses from peers and use block data to resolve disagreements under the model in the specification. That comparison matters because a filter supplied by a peer isn't automatically correct just because it arrived with a header-like string. Filter headers and sync
The wallet still has a separate job after a filter matches: verify the downloaded data against the relevant block header and inspect the actual transactions. A light client does not thereby perform every consensus check on every block, as a full node would. Someone choosing between modes should distinguish private discovery of their own transactions from independent validation of the entire chain.
Bitcoin Core provides a practical illustration of the separation. Its getblockfilter documentation returns the encoded filter and corresponding header for a given block hash, not a list of wallet transactions. The RPC describes what a client can retrieve from a node with the relevant data; it doesn't imply that every public peer provides it. Bitcoin Core RPC reference
Less disclosure is not zero disclosure
Under the older Bloom-filter approach described by BIP 157, a wallet sent a filter representing its interests to a peer. With compact block filters, the peer supplies block-derived data and the wallet decides privately which scripts to check. That removes the need to give the filter provider the wallet's search terms. But the blocks the wallet chooses to download, the timing of those requests and the network path may still reveal patterns. BIP 157 recommends using random outbound peers for block requests when fetching them from the peer network.
This is the key trade: compact filters save much of the bandwidth of full-block scanning while changing what the wallet has to reveal to find its history. They neither prove a balance on their own nor make a lightweight wallet into a fully validating node.
