Skip to main content
Epochs batch receipts and anchor them on Solana. This guide shows how to verify epoch integrity.

Check Current Epoch

const current = await lucid.epochs.current();
console.log("Epoch:", current.id);
console.log("Status:", current.status); // "open", "anchoring", "anchored"
console.log("Receipts:", current.receiptCount);

List Anchored Epochs

const epochs = await lucid.epochs.list({ status: "anchored" });

for (const epoch of epochs) {
  console.log(`Epoch ${epoch.id}: ${epoch.receiptCount} receipts`);
  console.log(`  Solana TX: ${epoch.transactionHash}`);
  console.log(`  MMR Root: ${epoch.mmrRoot}`);
}

Verify an Epoch On-Chain

const verification = await lucid.epochs.verify(epochId);

console.log("On-chain:", verification.onChain);
console.log("Root matches:", verification.rootMatches);
console.log("TX confirmed:", verification.transactionConfirmed);
console.log("Solana slot:", verification.slot);

Retry Failed Anchoring

// If an epoch failed to anchor, retry it
await lucid.epochs.retryAnchor(epochId);

Epoch Statistics

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