Skip to main content

DePIN Providers

Decentralized storage providers play a crucial role in ensuring data availability and anchoring within the Lucid ecosystem. This guide explains how these providers are integrated and utilized.

Overview

In Lucid, no feature interacts directly with the IDepinStorage interface. Instead, all decentralized storage uploads are managed through the Anchoring Control Plane. The process flow is as follows:

Storage Providers

The IDepinStorage interface supports multiple storage providers, which can be swapped based on the use case:

Anchoring Control Plane

The Anchoring Control Plane is responsible for managing the data anchoring process. All producers utilize the getAnchorDispatcher().dispatch() method:

Key Behaviors

  • Dispatch Method: The dispatch() method returns an AnchorResult or null. If DEPIN_UPLOAD_ENABLED=false, it returns null. All callers must handle null values.
  • Content Hash: Uses SHA-256 of canonicalJson(payload). This is always populated and never null.
  • Deduplication: Enforced by a UNIQUE constraint on (artifact_type, artifact_id, content_hash). If the same payload is uploaded twice, the existing record is returned.
  • Lineage: Uses parent_anchor_id for cross-referencing, such as when a snapshot supersedes a prior snapshot.
  • Registry: Acts as an L3 projection, rebuildable from on-chain data and DePIN.

Components

API Routes

  • GET /v1/anchors?agent_passport_id=X&artifact_type=Y: Query the registry.
  • GET /v1/anchors/:id: Retrieve a single record.
  • GET /v1/anchors/:id/lineage: Walk through the parent chain.
  • GET /v1/anchors/cid/:cid: Perform a reverse CID lookup.
  • POST /v1/anchors/:id/verify: Check if a CID still exists on the provider.

Environment Configuration

  • Permanent Provider: Set with DEPIN_PERMANENT_PROVIDER.
  • Evolving Provider: Set with DEPIN_EVOLVING_PROVIDER (default is mock).
  • Upload Enablement: Controlled by DEPIN_UPLOAD_ENABLED=false (acts as a kill switch).
  • Registry Store: Configured with ANCHOR_REGISTRY_STORE=postgres|memory.