.. py:module:: ethereum.spurious_dragon.bloom Ethereum Logs Bloom ^^^^^^^^^^^^^^^^^^^ .. contents:: Table of Contents :backlinks: none :local: Introduction ------------ This modules defines functions for calculating bloom filters of logs. For the general theory of bloom filters see e.g. `Wikipedia `_. Bloom filters are used to allow for efficient searching of logs by address and/or topic, by rapidly eliminating blocks and reciepts from their search. .. only:: stage1 Module Contents --------------- Functions ~~~~~~~~~ .. autoapisummary:: :nosignatures: ethereum.spurious_dragon.bloom.add_to_bloom ethereum.spurious_dragon.bloom.logs_bloom Module Details --------------- add_to_bloom ~~~~~~~~~~~~ .. function:: add_to_bloom(bloom: bytearray, bloom_entry: bytes) -> None :noindexentry: Add a bloom entry to the bloom filter (`bloom`). The number of hash functions used is 3. They are calculated by taking the least significant 11 bits from the first 3 16-bit words of the `keccak_256()` hash of `bloom_entry`. :param bloom: The bloom filter. :param bloom_entry: An entry which is to be added to bloom filter. .. undocinclude:: /../src/ethereum/spurious_dragon/bloom.py :language: python :pyobject: add_to_bloom logs_bloom ~~~~~~~~~~ .. function:: logs_bloom(logs: Tuple[ethereum.spurious_dragon.eth_types.Log, Ellipsis]) -> ethereum.spurious_dragon.eth_types.Bloom :noindexentry: Obtain the logs bloom from a list of log entries. The address and each topic of a log are added to the bloom filter. :param logs: List of logs for which the logs bloom is to be obtained. :returns: **logs_bloom** -- The logs bloom obtained which is 256 bytes with some bits set as per the caller address and the log topics. :rtype: `Bloom` .. undocinclude:: /../src/ethereum/spurious_dragon/bloom.py :language: python :pyobject: logs_bloom