Sequencer

The Sequencer is the beating heart of DUAL. It batches actions from the Event Bus into checkpoints, computes a Merkle root of all actions, and anchors that proof on-chain. This design enables optimistic confirmation in under 1 second while maintaining tamper-proof finality in ~15 minutes.

Key Metrics

Checkpoint Interval

15 min

Time-based batching window

Confirmation Time

<1s

Optimistic confirmation latency

Throughput

2,000+/s

Actions per sequencer per second

Batch Size

10,000

Max actions per checkpoint

What is the Sequencer?

The Sequencer receives actions from the Event Bus, assigns them a strict ordering based on timestamp and nonce, buffers them in memory, and periodically creates checkpoints. Each checkpoint is a Merkle tree whose root is anchored on-chain. This architecture delivers two critical properties:

  • Sub-Second Confirmation: Actions are confirmed optimistically as soon as the Sequencer receives them—before they're even batched. No consensus, no delay.
  • Cryptographic Finality: Every 15 minutes, the Sequencer publishes a checkpoint to the settlement layer. Once anchored on-chain, the state is immutable and tamper-proof.

How It Works

The Sequencer pipeline consists of six stages. Each action flows through all stages in deterministic order.

1

Action Ingestion

Actions arrive from the Event Bus with a timestamp, nonce, and payload.

2

Optimistic Ordering

The Sequencer immediately assigns a deterministic position based on (timestamp, nonce), and returns instant confirmation to the client.

3

Batch Accumulation

Actions buffer in memory, grouped by organization. The Sequencer tracks the cumulative size and elapsed time.

4

Checkpoint Creation

Every 15 minutes (or when the batch reaches 10,000 actions), the Sequencer seals the checkpoint. It computes a Merkle root of all action hashes and attaches metadata (timestamp, sequence number).

5

On-Chain Anchoring

The checkpoint hash (root of the Merkle tree) is submitted to the settlement layer via a ZK rollup. Gas costs are amortized across all actions in the batch.

6

Finality

Once the checkpoint is confirmed on-chain (1–2 blocks), the state is final. Anyone can verify that an action was included in a checkpoint using a Merkle proof.

Optimistic Execution Model

DUAL uses an optimistic execution model. When you submit an action, the Sequencer confirms it immediately—before final settlement on-chain. This creates a two-stage confirmation process:

Stage 1: Optimistic (<1s)

  • Action is sequenced and confirmed to the client
  • State changes are visible immediately
  • Fast UX and rapid application logic
  • Small risk of reorg if sequencer goes down

Stage 2: Final (~15min)

  • Checkpoint is anchored on-chain via ZK rollup
  • Merkle proof is immutable and cryptographically bound
  • State is tamper-proof and auditable
  • No reorg risk; settlement is final

Trade-offs & Reorg Handling

The Sequencer maintains a 15-minute dispute window after confirming an action. If the sequencer operator goes offline or acts maliciously, a new sequencer can be elected and actions can be reordered. Once a checkpoint is anchored on-chain, however, the state is final—reorgs are impossible.

For applications that require immediate on-chain finality (e.g., atomic cross-chain swaps), you can wait for checkpoint confirmation before proceeding.

Merkle Tree Design

Each checkpoint is a balanced Merkle tree over all actions in the batch. The tree structure is immutable and verifiable by anyone with the action data.

Leaf Construction

Each leaf is a SHA-256 hash of:

orgId: string
actionId: string
timestamp: uint64
nonce: uint64
payload: bytes

Proof Size

For a checkpoint with N actions:

Tree Depth: log₂(N)
Proof Size: 32 × log₂(N) bytes
For 10,000 actions:
~5.3 KB proof

Verification

To prove an action was included in a checkpoint:

  1. 1. Compute the leaf hash from action data
  2. 2. Obtain the Merkle proof (sibling nodes from root to leaf)
  3. 3. Hash upward along the proof path
  4. 4. Verify the computed root matches the on-chain checkpoint root

This computation is O(log N) and requires only the Merkle proof and the checkpoint root—no need to download the entire batch.

Checkpoint Lifecycle

Each checkpoint follows a strict lifecycle with five states. Understanding these states is key to building reliable applications.

Open

The checkpoint is accepting new actions. Start time is recorded.

0–15 min

Accumulating

Actions continue to arrive and buffer in memory. The Sequencer tracks size and elapsed time.

0–15 min

Sealing

Triggers when either (a) 15 minutes have elapsed, or (b) the batch reaches 10,000 actions. No new actions are accepted.

~100 ms

Anchoring

The checkpoint hash is submitted to the settlement layer. The Sequencer waits for block confirmation.

~30 sec

Confirmed

The checkpoint is anchored on-chain and immutable. Merkle proofs are now verifiable on-chain.

Final

Cost Amortization

The gas cost of anchoring a checkpoint is amortized across all actions in the batch. For a batch of 10,000 actions costing 500,000 gas, the per-action cost is 50 gas—far cheaper than individual on-chain transactions.

Developer Integration

The Sequencer exposes three key endpoints for querying checkpoints and verifying action inclusion.

GET/sequencer/checkpoints

List all checkpoints with pagination and filtering by state.

GET/sequencer/checkpoints/:id

Fetch a specific checkpoint by ID, including metadata and state.

GET/sequencer/proof/:actionId

Retrieve the Merkle proof for a given action ID.

Verifying Action Inclusion

Here's how to verify that an action was included in a checkpoint using the SDK:

import { DualClient } from "dual-sdk"; const client = new DualClient({ token: process.env.DUAL_API_KEY, authMode: "api_key", }); // Get the proof for an action const proof = await client.sequencer.getProof( "action-id-12345" ); // Verify the proof against the checkpoint const isValid = await client.sequencer.verifyProof({ actionId: "action-id-12345", proof: proof.proof, checkpointRoot: proof.checkpointRoot, checkpointId: proof.checkpointId, }); if (isValid) { console.log("✓ Action included in checkpoint"); } else { console.log("✗ Proof is invalid"); }

Webhook Events

Subscribe to real-time checkpoint events via webhooks:

checkpoint.created

Fired when a checkpoint enters the Sealing state. Contains checkpoint ID and action count.

checkpoint.confirmed

Fired when a checkpoint is anchored on-chain and confirmed. Contains checkpoint ID and on-chain transaction hash.

Security & Guarantees

The Sequencer provides strong cryptographic and ordering guarantees. These are the bedrock of the DUAL platform.

Deterministic Ordering

All actions are ordered deterministically by (timestamp, nonce). Within an organization, causal ordering is preserved. Across organizations, actions are globally ordered.

Tamper Resistance

Once a checkpoint is confirmed on-chain, the Merkle tree is immutable. No one—not even the sequencer operator—can modify or reorder actions without changing the checkpoint root.

Availability Guarantees

If the Sequencer goes offline during the Open state, actions are buffered. If offline during the Sealing/Anchoring state, the current checkpoint is still submitted to the settlement layer.

Dispute Window

There is a 15-minute dispute window after actions are confirmed optimistically. If the sequencer operator is detected to be malicious or offline, a new sequencer can be elected and actions can be safely reordered.

Finality Guarantee

Once a checkpoint is anchored on-chain (confirmed in 1–2 blocks), finality is absolute. There is zero reorg risk, and the state is auditable forever.

Related Topics