# Block Building Algorithm and Flow

1. Sub-block Construction Logic
   1. Each sub-block is built independently:
      * Sources of transactions:
        * Public mempool — sourced in real-time via Reth's local transaction pool (P2P gossip + txpool contents)
        * Private orderflow — received directly via the builder's private RPC endpoint
      * Sorting & Ranking Rules (inside each sub-block):
        1. Nonce ordering per sender — strict ascending nonce enforcement
        2. Effective gas price (priority fee + optional MEV tips / coinbase payment)
        3. Others may affect the ordering
           * Arrival timestamp (for same effective price)
2. Once a sub-block is confirmed:
   * It remains immutable — even if higher-value transactions arrive later in the same slot.
   * No retroactive replacement / reordering is allowed within already-confirmed sub-blocks.
   * This provides strong preconfirmation-like semantics for early-accepted orderflow and prevents last-moment value extraction races from destabilizing earlier commitments.
3. At the end of the slot (or when the slot deadline is reached):
   * The builder concatenates all previously confirmed sub-blocks in sequential order (respecting the exact order in which sub-blocks were sealed).
   * The complete, fully built execution payload is then submitted to one or more relays
   * Proposer then selects & signs header → Relay unblinds → Proposer publishes to network


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.ethgas.com/overview/realtime/block-building-algorithm-and-flow.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
