> For the complete documentation index, see [llms.txt](https://docs.engma.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.engma.io/ravid/epochs.md).

# Epochs

**How Synchronized Motion Works**

Several times per minute, Ethereum produces a new block with an unpredictable hash. All RAVID nodes observe the same hash at the same time. From this shared randomness, every node independently computes the same "motion plan" which routes to use, where workloads go, how storage redistributes.

No central coordinator tells anyone what to do. The math is deterministic: same input → same output. Everyone moves together because everyone computes the same answer.<br>

```
EPOCH CYCLE:

  Ethereum Block    All Nodes See      Each Node Computes    System Moves
  ─────────────     ─────────────      ──────────────────    ────────────
  Block #N ──────►  Same blockhash ──► Same motion plan ──►  Synchronized
                    (public)           (deterministic)        motion

  Block #N+B ────►  New blockhash ───► New motion plan ────► Next epoch
  
```

### Technical: DETSA Mathematical Framework

**DETSA** = Deterministic Execution with Time-Domain Security Amplification

{% code overflow="wrap" %}

```angular-ts
EPOCH INDEX
e = ⌊(blockNumber - b₀) / B⌋ where: blockNumber = current block height b₀ = genesis block for RAVID B = blocks per epoch (tunable)
```

{% endcode %}

{% code overflow="wrap" %}

```angular-ts
EPOCH ENTROPY (Critical Formula)
Rand_e = H(blockhash(boundary(e)) ‖ PolCommit_e ‖ e) where: blockhash = unpredictable until mined, immutable after PolCommit_e = commitment to current policy state H = cryptographic hash (BLAKE2B)
```

{% endcode %}

{% code overflow="wrap" %}

```angular-ts
MOTION PLAN DERIVATION
π_e = F(Σ_e, Rand_e) // Network motion ω_e = G(Ω_e, Rand_e) // Storage motion RAVID_e = (π_e, ω_e) // Complete motion plan
```

{% endcode %}

{% code overflow="wrap" %}

```angular-ts
// EPOCH TRANSITION PSEUDOCODE

function computeEpochMotion(blockNumber, currentState):
    // Calculate epoch index
    epoch = floor((blockNumber - GENESIS_BLOCK) / BLOCKS_PER_EPOCH)

    // Get entropy from blockchain
    boundaryBlock = GENESIS_BLOCK + (epoch * BLOCKS_PER_EPOCH)
    blockhash = ethereum.getBlockHash(boundaryBlock)

    // Derive epoch randomness
    policyCommit = hash(currentState.policies)
    epochEntropy = BLAKE2B(blockhash || policyCommit || epoch)

    // Compute motion plans (deterministic!)
    networkMotion = deriveNetworkRoutes(currentState.network, epochEntropy)
    storageMotion = deriveShardPlacements(currentState.storage, epochEntropy)

    return {
        epoch: epoch,
        entropy: epochEntropy,
        networkPlan: networkMotion,
        storagePlan: storageMotion
    }

// Security Property: All honest nodes compute identical plans
// because they see same blockhash and have same state
```

{% endcode %}

> **Security Amplification Theorem**\
> \
> After k epochs: Pr\[successful attack] ≤ (1/2²⁵⁶)ᵏ\
> \
> Attack difficulty grows EXPONENTIALLY because each epoch requires a new attack vector. Previous reconnaissance becomes stale.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.engma.io/ravid/epochs.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
