Skip to main content
Every AI inference in Lucid produces a cryptographic receipt — an immutable, verifiable proof.

Receipt Anatomy

interface Receipt {
  id: string;              // Unique receipt ID
  runId: string;           // Inference run ID
  inputHash: string;       // SHA-256 of input
  outputHash: string;      // SHA-256 of output
  modelPassport: string;   // Model's passport ID
  signature: string;       // Ed25519 signature
  mmrPosition: number;     // Position in Merkle Mountain Range
  epochId: string;         // Epoch this receipt belongs to
  timestamp: string;       // ISO 8601 timestamp
}

Verification Flow

1. Get receipt → API returns receipt with signature + proof
2. Verify signature → Ed25519 verify with signer's public key
3. Verify MMR proof → Check inclusion in epoch's MMR root
4. Verify on-chain → Compare MMR root with Solana anchor

Full Verification Example

// Step 1: Get the receipt
const receipt = await lucid.receipts.get(receiptId);

// Step 2: Verify via API (does all checks)
const result = await lucid.receipts.verify(receiptId);
console.log("Signature OK:", result.signatureValid);
console.log("MMR proof OK:", result.proofValid);
console.log("On-chain OK:", result.onChainValid);

// Step 3: Get raw proof for independent verification
const proof = await lucid.receipts.proof(receiptId);
console.log("Leaf:", proof.leaf);
console.log("Path:", proof.path);
console.log("Root:", proof.root);

Batch Verification

const receiptIds = ["receipt_1", "receipt_2", "receipt_3"];
const results = await Promise.all(
  receiptIds.map(id => lucid.receipts.verify(id))
);

const allValid = results.every(r => r.valid);