Ethereum under the hood- Part 8( Blocks -2 )

Ethereum under the hood- Part 8( Blocks -2 )

Welcome back, we start right where we left off with a little deeper dive into blocks, and for those who are following Ethereum 2.0 I would recommend reading this, For this section about Blocks Part 2, we cover:

  1. Quick review
  2. Bloom filters/LogsBloom Field
  3. Genesis Block
  4. Summary
  5. Next

Quick Review:

As a regular practice in this series, a quick overview of Part -7

Section [6–7] recap

BloomFilters and LogsBloom Field:

In Chapter-7, we discussed Ethereum Block header fields; one among them is Field-8: logsBloom. We will try to answer two questions and throw some light into Bloom Filters. Let us focus on two issues 1. Why is this Field needed? 2. What is a Bloom Filter?

  1. Why is this Field needed?: Ethereum is a forward-only global state machine with financial and non-financial transactions on a central database. These transactions required to be recorded with some labels to search quickly and efficiently. These events are searchable with results as soon as possible. Each Blockheader contains the logsBloom Field, which includes the complete information of the entire set of events/logs in just one Field. Below is an excellent description of the need for this Field.
Stackoverflow: Events in Ethereum quickly searched, for audit purposes

LogsBloom field[2048 bytes ] from an Ethereum Block, notice the “1” is at position:212, and “2” is at position:233, we will revisit this topic in BloomFilter.

logsBloom[2048]:"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000........0"

2. What is a Bloom Filter?: Now that we have an idea of the logsBloom Field, let us explore Bloom filters. Ethereum chose the Bloom Filter algorithm for its speed and effectiveness of the probabilistic data structure. There can be thousands of events in a Block and going by our regular theme of the need for speed for lookup speed; it seems that Bloom filters were a suitable choice. Ethereum implements a custom bloom filter as defined in the yellow paper :

Let us work through the specs with an example below.

Dig Deeper:

Is the LogsBloom in the block header the same as the Bloom filter in the Transaction Receipts Trie?
Reading the yellow paper, I’m attempting to understand the difference between the Hb and Rb values - they appear to be the same thing, unless I’ve missed something. Is the LogsBloom in the block h...

Genesis Block:

Now that we have a little bit of understanding of what Blocks are, we can now explore Genesis Block. Almost all Cryptocurrency projects have a “Genesis” synonym to the Beginning, let us recall that Ethereum is a World state+Virtual machine and state 0 is the Genesis State, which has a pre-defined set of values as agreed upon by all participants within the Ethereum ecosystem. Ethereum Yellow paper defines the preset values of the Genesis Block.

Yellow Paper( Apdx-1: Genesis Block )

A Genesis Block using Elixir with some random values, notice the name of the fields and their corresponding values(Fig:1)

Genesis Block

Take a peek at the Genesis Block to see if this matches with the yellow paper specification

Genesis Block

Summary:

  • LogsBloom is a Block Header field.
  • LogsBloom field is a global event indicator for the Block Header.
  • Bloom Filter algorithm is the mechanism for the LogsBloom field.
  • Ethereum specifies a specialized Bloom Filter algorithm.
  • A Genesis Block is the Block 0 state of the Blockchain.
  • Genesis Block has pre-defined values, agreed by the ecosystem.

References:

What exactly does the “m” function in the formal Bloom filter specifications do?
Excerpt from page 6 of the yellow white paper: I can understand the first three definitions, the fourth one is problematic. How does the m function actually work? Maybe I’m not too familiar with f...
go-ethereum/block.go at master · ethereum/go-ethereum
Official Go implementation of the Ethereum protocol - go-ethereum/block.go at master · ethereum/go-ethereum
Understanding event logs on the Ethereum blockchain
Every transaction has an event log, but those event logs can be hard to read.
Params in Ethereum Genesis Block Explained - Async Labs - Software Development & Digital Agency
Genesis block is the first block of a blockchain. Since it’s the first block, it does not reference a previous block and has to be hardcoded.