Skip to main content
£0.00 0

Basket

No products in the basket.

ASIC mining articles and advice

BIP 157 and 158 Explained: Compact Block Filters for Bitcoin Clients

BIP 157 and 158 compact block filters explained: understand client-side matching, Golomb-coded sets, filter headers and privacy trade-offs.

BIP 157 158 compact block filters guide cover

BIP 157 158 compact block filters: BIP 157 and 158 compact block filters explained: understand client-side matching, Golomb-coded sets, filter headers and privacy trade-offs.

TL;DR

Earlier Bloom-filter approaches let a lightweight wallet tell a server what patterns it wanted, potentially revealing addresses and related activity. BIP 158 specifies how compact filters are constructed with Golomb-coded sets. BIP 157 defines filter types, filter hashes, filter-header chains and peer messages for requesting filters, headers and checkpoints.

The basic filter includes scripts from transaction outputs and relevant scripts spent by non-coinbase inputs, subject to specified exclusions.

BIP 157 158 compact block filters in simple English

BIP 157 158 compact block filters: BIP 158 specifies how compact filters are constructed with Golomb-coded sets. Relevant block elements are hashed using a key derived from the block hash, mapped into a bounded range, sorted and encoded as differences with Golomb-Rice coding.

Simple example

A node operator is checking BIP 157 158 compact block filters. The filter can produce false positives but not false negatives when constructed correctly for the specified elements.

Key terms in plain English

BIP:
Bitcoin Improvement Proposal: a document that suggests or explains a change to Bitcoin. A BIP number does not mean the idea is active.
Consensus:
The shared rules that Bitcoin or another network uses to decide whether blocks and transactions are valid.
Node:
A computer running network software that checks data and talks to other computers on the network.
ASIC:
A computer built to do one specialised job. A mining ASIC is designed for a particular proof-of-work algorithm.
Mining pool:
A service that combines work from many miners and shares rewards using stated rules.

Why filtering moved to the client

Earlier Bloom-filter approaches let a lightweight wallet tell a server what patterns it wanted, potentially revealing addresses and related activity. BIP 157 has servers provide the same deterministic block filter to every client. The client downloads filters and checks them locally, requesting a full block only when the filter may match its scripts. This shifts query privacy and verification responsibility toward the wallet.

Start with the validating node, because the ASIC only hashes the candidate header it receives. Record the node release and the pool component that assembled the block. If those facts are unknown, the operator cannot show which rules were actually applied before electricity was committed to the work.

What BIP 158 defines

BIP 158 specifies how compact filters are constructed with Golomb-coded sets. Relevant block elements are hashed using a key derived from the block hash, mapped into a bounded range, sorted and encoded as differences with Golomb-Rice coding. The filter can produce false positives but not false negatives when constructed correctly for the specified elements.

So matching wallets may download extra blocks but should not miss real matches.

Treat status dashboards as observations, not as the source of truth. Compare them with an independently operated node and retain the raw deployment or template response. Period boundaries, chain reorganisations and cached pool pages can otherwise make a correct-looking percentage describe the wrong state.

What BIP 157 defines

BIP 157 defines filter types, filter hashes, filter-header chains and peer messages for requesting filters, headers and checkpoints. Filter headers commit sequentially to each filter hash, allowing a client to detect inconsistent history once it has a trusted block-header chain. Checkpoints help compare peers over longer ranges.

A filter header does not make the underlying block valid. Ordinary proof-of-work and block validation remain separate.

BIP 157 158 compact block filters technical diagram
What BIP 157 defines: a practical view of the validation, signalling and mining boundary.

Build the failure response before the boundary arrives. Define which rejection messages trigger an alert, who can pause a template source and how failover is prevented from returning miners to the same faulty validation stack. A second hostname is not independent when both endpoints share one node.

Basic-filter contents

The basic filter includes scripts from transaction outputs and relevant scripts spent by non-coinbase inputs, subject to specified exclusions. Wallets query for scripts rather than raw address strings. Correct construction requires the full block and spent-output information. This makes filter serving a node feature with CPU, disk and indexing costs. Implementations must follow the exact serialisation and parameters to remain interoperable.

Separate readiness, signalling and enforcement in the operating log. Readiness is a claim about software and process, signalling is data carried by blocks, and enforcement is a validation result. Combining them into a single supported or unsupported label hides the point at which revenue is actually at risk.

Privacy and adversarial peers

Client-side matching avoids disclosing each query to a server. But peers still observe filter requests, block downloads, connection timing and network address. A malicious peer can omit, corrupt or fork filter data. Compare header and checkpoint results across independent peers and get full blocks without a trivially unique request pattern where practical. Compact filters improve one privacy boundary. They do not create network anonymity.

Map responsibility across the full path: validating node, template server, pool protocol, proxy, firmware and ASIC. For each layer, state what it can alter and what it merely relays. This prevents a version-bit setting in firmware from being mistaken for complete consensus-rule support. Relate that responsibility map to the pool and job-control boundary in our Stratum V2 guide.

Relation to mining nodes

Mining pools generally validate full transactions and blocks rather than rely on lightweight filters for template correctness. However, operator wallets, monitoring tools and treasury systems may use compact filters. Keep those roles separated from the block-template authority. A filter match is a prompt to inspect a block, not evidence that a payout arrived, matured or belongs to the expected chain.

Test the primary and failover paths with the same checks. Compare chain tip, chainwork, deployment state, required rules and template age, then save the result with a timestamp. The process should be repeatable by another operator without relying on an undocumented pool conversation.

Deployment checks

Verify the filter type, client and server versions, block-header source and checkpoint comparison policy. Test known receive and spend transactions plus controlled false-positive handling. Record filter sync height separately from block-header and wallet scan heights. If a server disagrees, fail safely and compare independent peers rather than accepting the fastest response.

Back up wallet descriptors and keys. Filters are reproducible indexes, not ownership data.

Turn the conclusion into a business decision. State which chain and settlement venues the operation intends to serve, the maximum acceptable stale-block exposure and the point at which mining pauses. This connects protocol evidence to electricity cost, pool revenue and payout finality.

Operator decision record

A concise decision record for BIP 157 158 compact block filters should name the source documents, their dates, the node release tested, the responsible pool or template provider and the exact trigger for action. Include screenshots or machine-readable output for the deployment state. But keep the raw node response as the stronger evidence.

State whether a change affects policy, block construction or consensus validity, because those layers have different failure costs.

Run the check on every production and failover path. Confirm that monitoring alerts on stale templates, unexpected chain tips, rejected proposals and a rise in stale shares. Keep rollback instructions for node and pool configuration. But do not roll back across an active consensus boundary without understanding the rules the older release enforces.

If the evidence conflicts, pause the affected path and investigate before committing more electricity to uncertain work.

For related background, read our plain-English BIP-110 guide and technical BIP-110 review. Those articles use a modern proposal to show why signalling, activation, template construction and accepted chain history must be examined separately.

Conclusion

Bip 157 158 compact block filters is best understood as a defined interaction between validating software, mining infrastructure and economic acceptance. The safest operator does not infer consensus from a dashboard percentage or a pool slogan. They verify the rule source, the activation boundary, the template fields and the chain their payouts ultimately settle on.

That discipline reduces the chance of hashing an invalid or commercially unwanted block.

Frequently asked questions

What is the main point of BIP 157 158 compact block filters?

BIP 157 158 compact block filters: BIP 158 specifies how compact filters are constructed with Golomb-coded sets.

For BIP 157 158 compact block filters, why filtering moved to the client?

Earlier Bloom-filter approaches let a lightweight wallet tell a server what patterns it wanted, potentially revealing addresses and related activity.

For BIP 157 158 compact block filters, what should a beginner know about what BIP 158 defines?

BIP 158 specifies how compact filters are constructed with Golomb-coded sets.

For BIP 157 158 compact block filters, what should a beginner know about what BIP 157 defines?

BIP 157 defines filter types, filter hashes, filter-header chains and peer messages for requesting filters, headers and checkpoints.

Primary sources

Primary specifications are living technical records. Check their current status and changelog before using this article for a production activation decision.

ASIC MINER PICKS

Recommended ASIC Mining Hardware

Compare three of our highest ranked ASIC miners currently available, with live product details and pricing.
Browse all ASIC miners
MORE MINING ADVICE

More ASIC Mining Articles

Read practical advice about choosing hardware, calculating electricity costs, setting up miners, hosting and maintenance.
MINER COMMUNITY

Join the ASIC Mining Discussion

Ask a question or share what has worked for you. Your experience may help another miner make a better decision.

Members can read and join the discussion

Log in to read comments from other miners. Create a free account if you would like to ask a question or share your experience.

Log in to read comments Register to join the discussion

Membership helps us protect the discussion from spam and keep answers useful.

ASIC MINING SUPPORT

Need Help Choosing an ASIC Miner?

Tell us what you want to mine, your electricity cost and where the machine will run. We can help you compare hardware, power requirements, hosting and repairs.
Contact our mining team
Browse ASIC miners