Verify epochs on the Solana blockchain
const current = await lucid.epochs.current(); console.log("Epoch:", current.id); console.log("Status:", current.status); // "open", "anchoring", "anchored" console.log("Receipts:", current.receiptCount);
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}`); }
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);
// If an epoch failed to anchor, retry it await lucid.epochs.retryAnchor(epochId);
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);