Bloom Filters
Bloom filters are a probabilistic data structure used by SPV (Simplified Payment Verification) clients to request relevant transactions from full nodes without revealing exactly which addresses they're interested in.
Bloom filters allow SPV clients to:
- Request transactions: Without revealing addresses
- Privacy: Partial privacy protection
- Efficiency: Compact representation
- False positives: Possible but manageable
How Bloom Filters Work
Construction
1. Add addresses to filter
2. Hash addresses multiple times
3. Set bits in filter array
4. Send filter to full node
5. Node filters transactions
6. Returns matching transactions
Querying
Full Node:
1. Receives bloom filter
2. Checks each transaction
3. If filter matches, includes transaction
4. May include false positives
5. Sends matching transactions
Privacy Trade-offs
Privacy Benefits
- Address hiding: Doesn't reveal exact addresses
- Plausible deniability: False positives provide cover
Privacy Limitations
- Pattern analysis: Multiple queries reveal patterns
- False positive rate: Can be analyzed
- Not perfect: Better than nothing, but not anonymous
Modern Alternatives
Compact Block Filters (BIP 158)
Compact block filters replace bloom filters:
Benefits:
- Better privacy
- More efficient
- Standardized format
- Used by modern SPV clients
Comparison
| Feature | Bloom Filters | Compact Block Filters |
|---|---|---|
| Privacy | Partial | Better |
| Efficiency | Good | Better |
| Standardization | BIP 37 | BIP 158 |
| Adoption | Legacy | Modern |
Code Examples
Creating a Bloom Filter
Related Topics
- SPV - Simplified payment verification
- Node Types - Different node configurations
- Privacy Techniques - Privacy improvements
