EEVM.Block.Bloom (eevm v0.1.0)

Copy Markdown View Source

Ethereum logs bloom filter โ€” 256-byte (2048-bit) probabilistic filter summarising the addresses and indexed topics of every log in a receipt or block. Each item is added via 3 hash probes derived from Keccak-256 (Yellow Paper ยง4.3.1). The data field of a log is not included.

Summary

Functions

Add an item (raw bytes) to the bloom filter.

Check if a bloom filter might contain an item (false positives possible).

Returns an empty (all-zero) 256-byte bloom filter.

Compute the bloom filter for a list of logs.

Bitwise OR of two bloom filters.

Types

log_entry()

@type log_entry() :: %{
  address: non_neg_integer(),
  data: binary(),
  topics: [non_neg_integer()]
}

t()

@type t() :: <<_::2048>>

Functions

add(bloom, item)

@spec add(t(), binary()) :: t()

Add an item (raw bytes) to the bloom filter.

The item should be a binary โ€” 20 bytes for an address, 32 bytes for a topic.

contains?(bloom, item)

@spec contains?(t(), binary()) :: boolean()

Check if a bloom filter might contain an item (false positives possible).

empty()

@spec empty() :: t()

Returns an empty (all-zero) 256-byte bloom filter.

from_logs(logs)

@spec from_logs([log_entry()]) :: t()

Compute the bloom filter for a list of logs.

Each log's address and topics are added. The data field is NOT included.

merge(left, right)

@spec merge(t(), t()) :: t()

Bitwise OR of two bloom filters.