Skip to main content

Epochs SDK

Epoch lifecycle — creation, finalization, on-chain anchoring, and retry

Operations

Generated Reference

Overview

Epoch lifecycle — creation, finalization, on-chain anchoring, and retry

Available Operations

getCurrent

Retrieve the current open epoch, optionally filtered by project_id. Returns epoch metadata including MMR root, leaf count, status, and timestamps.

Example Usage

Standalone function

The standalone function version of this method:

Parameters

Response

Promise<operations.LucidGetCurrentEpochResponse>

Errors

list

Retrieve a paginated list of epochs with optional filtering by project_id and status (open, anchoring, anchored, failed). Defaults to page 1, 20 results per page.

Example Usage

Standalone function

The standalone function version of this method:

Parameters

Response

Promise<operations.LucidListEpochsResponse>

Errors

create

Create a new epoch, optionally scoped to a project_id. The epoch starts in ‘open’ status with an empty MMR root and zero leaf count.

Example Usage

Standalone function

The standalone function version of this method:

Parameters

Response

Promise<operations.LucidCreateEpochResponse>

Errors

get

Retrieve a single epoch by its epoch_id, including the MMR root, leaf count, status, and on-chain anchoring details.

Example Usage

Standalone function

The standalone function version of this method:

Parameters

Response

Promise<operations.LucidGetEpochResponse>

Errors

retry

Retry the on-chain anchoring for an epoch that previously failed. The epoch must be in ‘failed’ status. Resets the status and re-submits the Solana transaction.

Example Usage

Standalone function

The standalone function version of this method:

Parameters

Response

Promise<operations.LucidRetryEpochResponse>

Errors

verify

Verify an epoch’s on-chain anchor by comparing the committed MMR root on Solana with the expected off-chain root. Returns the comparison result and transaction signature.

Example Usage

Standalone function

The standalone function version of this method:

Parameters

Response

Promise<operations.LucidVerifyEpochResponse>

Errors

getTransaction

Retrieve the Solana transaction details for an epoch’s on-chain anchoring, including the transaction signature, slot number, and block time.

Example Usage

Standalone function

The standalone function version of this method:

Parameters

Response

Promise<operations.LucidGetEpochTransactionResponse>

Errors

commitRoot

Finalize the current epoch and commit its MMR root to Solana via the thought_epoch program. Optionally force-commit even if the epoch threshold has not been reached.

Example Usage

Standalone function

The standalone function version of this method:

Parameters

Response

Promise<operations.LucidCommitEpochRootResponse>

Errors

commitRootsBatch

Commit multiple epoch roots to Solana in a single batch operation. Returns per-epoch success/failure results with transaction signatures. Uses the batch commit instruction for gas efficiency.

Example Usage

Standalone function

The standalone function version of this method:

Parameters

Response

Promise<operations.LucidCommitEpochRootsBatchResponse>

Errors

getAnchoringHealth

Check the health of the on-chain anchoring service, including Solana connection status, network type, authority address, and whether mock mode is active.

Example Usage

Standalone function

The standalone function version of this method:

Parameters

Response

Promise<operations.LucidGetAnchoringHealthResponse>

Errors

listReady

List all epochs that have met the finalization threshold (more than 100 receipts or older than 1 hour) and are ready to be committed on-chain.

Example Usage

Standalone function

The standalone function version of this method:

Parameters

Response

Promise<models.EpochsReadyResponse>

Errors

getStats

Retrieve aggregate epoch statistics including total count, counts by status, average receipts per epoch, and anchoring success rate.

Example Usage

Standalone function

The standalone function version of this method:

Parameters

Response

Promise<models.EpochStatsResponse>

Errors