Skip to main content
An Epoch is a batch of receipts anchored to Solana as a single transaction. This is how Lucid achieves on-chain verification without per-receipt transaction costs.

Epoch Lifecycle

Open → Anchoring → Anchored

         └──→ Failed (retry available)

How It Works

  1. Receipts accumulate in the current open epoch
  2. When the epoch closes (time-based or size-based), the MMR root is computed
  3. The anchor worker commits the MMR root to Solana
  4. The epoch status becomes anchored with a transaction hash

API

// Get current epoch
const current = await lucid.epochs.current();
console.log("Epoch:", current.id, "Status:", current.status);

// List epochs
const epochs = await lucid.epochs.list();

// Verify an epoch on-chain
const verification = await lucid.epochs.verify(epochId);
console.log("On-chain:", verification.onChain);
console.log("Tx hash:", verification.transactionHash);

// Get the Solana transaction
const tx = await lucid.epochs.transaction(epochId);

Statistics

const stats = await lucid.epochs.stats();
console.log("Total epochs:", stats.total);
console.log("Anchored:", stats.anchored);
console.log("Pending:", stats.pending);