Layered Consensus Stack

Mathematical view of W3 consensus as a composable tower of primitives.

The consensus system is modeled as two cooperating stacks:

  1. Execution stack (E5 → E1) — converts workflow definitions into deterministic transcripts.
  2. Consensus stack (C3 → C1) — selects validators, validates attestations, and anchors evidence with ordering + finality.

Each layer owns a narrow responsibility and exposes explicit interfaces. Execution hands off transcripts; consensus feeds back membership, validation, and ordering guarantees. The separation keeps the contract tight while letting each subsystem evolve independently.

Execution Stack (E5 → E1)

Five Components

  • E5 · Workflow DSL — declarative YAML with triggers, actions, and verification policy.

  • E4 · Compiler — parses, validates references, emits bytecode + manifests.

  • E3 · VM / ISA — deterministic interpreter (WASM/eBPF) with gas metering.

  • E2 · Host Environment — explicit host calls (HTTP, storage, Smart Actions) with metered permissions.

  • E1 · Runtime State — deterministic replay, mempool ingestion, resource accounting.

Every validator runs this pipeline locally when it executes a workflow step. The output is a deterministic transcript (state diff + receipts) that the consensus stack can reference.

C3 · Workflow Orchestration

Runtime Protocol

  • Trigger consensus: deterministic validator subset decides if the workflow run begins.

  • Per-step loop: leader election → execute (using E5→E1) → attest.

  • Outputs: signed attestations referencing workflow + validator state hashes.

This protocol assumes each validator’s execution engine is deterministic. It defines who executes, how unanimous agreement is reached, and what proof artifacts must be emitted.

C2 · Protocol State

Structures Derived From Layer 1

  • Workflow registry: deployed bytecode/YAML + activation bits.
  • Validator registry: stake, participation status, slashing history.

  • Attestation log: append-only record of trigger + step attestations.

Each is a deterministic state machine driven by ordered events. Implementations can be smart contracts, rollup state, or native modules—Layer 1 just guarantees ordering + finality.

C1 · Base Consensus

Primitives

  • Total ordering: order(events) → sequence. All honest nodes agree on the same order.

  • Finality: finalize(sequence) → irreversible. Once committed, events cannot be reordered.

Examples: Bitcoin’s longest-chain rule, Ethereum’s Gasper, any BFT chain or rollup that exposes deterministic order + finality.

Information Flow

1. Register — Workflows and validators are registered on Layer 2 via events committed to Layer 1.

2. Execute — Selected validator runs the E5→E1 pipeline locally to produce deterministic results.

3. Attest — C3 orchestration reaches unanimous agreement and emits signatures referencing the execution transcript.

4. Commit — Attestations enter the C2 log, again via the ordered/finalized log of C1.