- Published on
BIP 158
compact block filters, Golomb-coded set filter, block filter format
The compact block filter format for Bitcoin. A small Golomb-coded set built per block that light clients can test locally to find relevant transactions.
BIP 158 defines the compact block filter. For each block, a node builds a small probabilistic filter over the scripts spent and created in that block. A light client that knows which scripts belong to its wallet can test each filter locally. If the filter says the block is irrelevant, the client skips it. If it says the block might contain a match, the client fetches the full block and checks directly.
The filter uses Golomb-coded sets, which give a compact on-disk representation at a controlled false-positive rate. The filter for a typical block is on the order of a few kilobytes, against the block's full one to two megabytes.
BIP 158 is the filter format. BIP 157 is the peer-to-peer protocol for requesting the filters. Together, they power privacy-preserving SPV in modern Bitcoin wallets like Neutrino, LDK Node, and Nakamoto.