---
title: "Compact Block Filter Header — definition | Nuri Glossary"
description: "A hash chain over compact filters, so a light client can verify filters without downloading blocks."
lang: "en"
type: "glossary-term"
canonical: "https://nuri.com/glossary/compact-block-filter-header"
---

# Compact Block Filter Header

A hash chain over compact filters, so a light client can verify filters without downloading blocks.

## Basically

A compact block filter header commits to a chain of compact block filters. You can use it to check filter correctness without downloading full blocks.

## Key Takeaways

- Compact block filter headers form a hash chain that commits to every compact block filter in a blockchain's history. Light clients can use the chain to check that peers serve correct filters without downloading full blocks.
- Each filter header is the double-SHA256 hash of the filter hash concatenated with the previous filter header. Changing one filter invalidates its header and every later header.
- BIP 157 defines filter headers alongside the client-side block filtering protocol. They replace BIP 37's privacy-leaking Bloom filters by moving all transaction matching to the client.

## What Is a Compact Block Filter Header?

A compact block filter header is a 32-byte hash that commits to a specific block's compact block filter and the entire chain of filters before it. Light clients use filter headers to detect fake or incomplete filters from a peer. You can verify filters without downloading full blocks or trusting a single server.
Olaoluwa Osuntokun, Alex Akselrod, and Jim Posen introduced the concept in BIP 157, Client Side Block Filtering. BIP 158 defines how to construct the filters with Golomb-coded sets, while BIP 157 defines the peer-to-peer protocol for requesting and verifying them. Filter headers play their central role in BIP 157, and the two BIPs replaced the older BIP 37 Bloom filter model, which required clients to reveal their addresses to serving nodes.
Developer documentation and protocol messages sometimes shorten "compact block filter header" to "cfheader". A filter header is not a block header, which commits to a block's transactions through a Merkle root. Filter headers form a separate, parallel chain that commits to filter data rather than transaction data.

## How It Works

The compact block filter protocol has two layers. BIP 158 defines the filter as a compact, deterministic representation of a block's relevant data, primarily scriptPubKeys, encoded as a Golomb-coded set. BIP 157 defines how clients request and verify those filters through the filter header chain.

## Filter Header Construction

Each filter header uses two inputs: the hash of the current block's filter and the previous block's filter header. The header is the double-SHA256 hash of the filter hash concatenated with the previous filter header.
The recursive structure creates a hash chain like the links between block headers and their predecessors. Changing one filter at any height invalidates its filter header and every later filter header. You can therefore detect retroactive tampering immediately.

## The P2P Protocol Messages

BIP 157 defines three pairs of request and response messages for filter header exchange. These messages let clients request and verify filters, filter headers, and checkpoints.

## Multi-Peer Verification

Filter headers are not committed to by consensus, appear inside block headers, or pass validation under the Bitcoin network's consensus rules. A malicious peer could therefore serve a self-consistent but entirely fabricated filter header chain.
Multi-peer cross-checking provides the defence. BIP 157 recommends that clients connect to multiple outbound peers and compare their filter headers. If peers disagree at a block height, the client can download the full block from either peer, reconstruct the filter locally with the deterministic BIP 158 algorithm, identify the dishonest peer, and ban it.
At least one honest peer guarantees that the client can detect and reject fraudulent filters. This security model is weaker than full block validation but significantly stronger than BIP 37. A malicious BIP 37 peer could omit transactions without detection.

## Comparison with Bloom Filters (BIP 37)

SPV clients used BIP 37 Bloom filters to request relevant transactions from full nodes before compact block filters. That approach had two major problems: clients revealed their addresses to serving nodes, and malicious peers could omit transactions without detection.
Bitcoin Core disabled BIP 37 Bloom filter serving by default in version 0.19.0, released in 2019, effectively deprecating the approach for new wallet implementations. The compact block filter model in BIP 157/158 is now the standard for privacy-conscious light clients.

## Mobile Lightning Wallets

Mobile lightweight clients benefit most from compact block filter headers. Lightning Labs' Neutrino implementation, built on BIP 157/158, powers LND's light client mode and lets wallets like Blixt run a near-full Lightning node directly on a mobile device. The filter header chain lets these wallets sync the blockchain privately and download only blocks containing relevant transactions.

## Privacy-Preserving Chain Scanning

Wallets recovering from a seed phrase must scan the entire blockchain for transactions matching their derived addresses. Compact block filters make that scan local: the wallet downloads filters, matches them against its own addresses, and fetches only the few blocks that produce matches. The filter header chain lets the wallet trust the downloaded filters by cross-checking them with multiple peers.

## Efficient Initial Sync

The checkpoint mechanism, getcfcheckpt, lets new clients parallelise their initial sync. A client fetches filter header checkpoints at 1,000-block intervals from one peer, then requests detailed filter headers for each interval from different peers simultaneously. Each range is independently verifiable against its bounding checkpoints, significantly reducing sync time compared with sequential downloading.

## Adoption and Implementation Status

The Bitcoin Improvement Proposal repository lists both BIP 157 and BIP 158 as "Deployed". Adoption still varies across implementations.
Bitcoin Core does not enable filter serving by default, so fewer peers offer compact block filters than the overall size of the Bitcoin network might suggest. Peer discovery can therefore be harder for light clients using the protocol. Dedicated filter-serving nodes partially compensate for this.

## No Consensus-Level Commitment

Compact block filter headers exist outside Bitcoin's consensus rules, which is their most significant limitation. Block headers do not commit to filter data, so block headers alone cannot prove that a filter is wrong. Security relies entirely on an honest majority among connected peers, and colluding peers can serve a fabricated filter header chain without detection if they control all of a client's connections.
Proposals have discussed embedding a filter commitment in the coinbase transaction or a future soft fork, but none has been adopted. Such a commitment would make filter verification as strong as Merkle proof verification. It would also require a consensus change.

## Bandwidth Overhead

Compact block filters use significantly less bandwidth than full blocks, but clients still download a filter for every block, even when it contains no relevant transactions. A basic filter is typically a few kilobytes. Across hundreds of thousands of blocks, a full initial sync from the genesis block accumulates several gigabytes of filter data.

## False Positive Rate

Golomb-coded set filters have a tunable false positive rate, and the basic filter type uses parameters with a match probability of roughly 1 in 784,931 per item. False positives still occur despite this low rate, so a client occasionally downloads a full block and finds no relevant transactions. Lower false positive rates would require larger filters, creating a trade-off between privacy and bandwidth.

## Eclipse Attack Vulnerability

An attacker who controls all of a light client's peer connections in an eclipse attack can serve arbitrary filter headers and filters. Multi-peer verification works only when at least one peer is honest. Light clients should use diverse peer discovery methods and, where possible, connect to at least one trusted node to reduce this risk.

## Further Reading

This glossary entry provides information only, not financial or investment advice. Always do your own research before using any protocol or technology.
Part of the [Nuri glossary](https://nuri.com/glossary), which defines 1876 Bitcoin, Lightning, wallet, stablecoin and payment terms.
