Block Batch Filters for Light Clients



Summary:

Aleksey Karpov has shared a draft BIP for compact probabilistic block filters, an alternative to BIP 158. While BIP 158 has a low false positive rate, it does not support filter batching due to the design of its parameters for siphash and Golomb coding. The proposed alternative uses delta coding and splits data into two bit string sequences, with one sequence containing data without prefixes and the second containing information about the bit length written to the first sequence. The second sequence is compressed using two rounds of the Huffman algorithm, resulting in an effectiveness of about 98% compared to Golomb with optimal parameters. Batching block filters reduces their size significantly, and separating filters by address type allows lite clients to avoid downloading redundant information without compromising privacy. The recommended strategy for lite client filters download is to get the biggest filter (smallest blocks/size rate) for a blocks range, then, in case of a positive test, get medium filters to reduce the blocks range, followed by getting block filters for the affected range and downloading affected blocks over TOR. An implementation of this can be found in Python at https://github.com/bitaps-com/pybtc/blob/bugfix/pybtc/functions/filters.py#L172. Aleksey Karpov plans to add exact information from mainnet about size for separated filters by address types and batch size within a few days. Feedback is welcome.


Updated on: 2023-06-13T21:26:21.888496+00:00