The Receipt-to-Chain Pipeline
Key Algorithms
Receipt Hashing
Every receipt is hashed using SHA-256 over RFC 8785 canonical JSON (JCS). This ensures identical receipts produce identical hashes regardless of JSON key ordering or formatting.Merkle Mountain Range (MMR)
Receipts are appended to an MMR — an append-only authenticated data structure. The root is computed via SHA-256 with right-to-left peak bagging. Properties:- Append-only (no rewriting history)
- Efficient inclusion proofs (O(log N))
- Supports batched verification
Epoch Finalization
An epoch closes when either condition is met:- 100+ receipts accumulated
- 1+ hour since epoch opened
On-Chain Commitment
Thethought_epoch Solana program stores MMR roots on-chain with three instruction variants:
| Instruction | Description |
|---|---|
commit_epoch | Single epoch root (32-byte MMR root) |
commit_epochs | Batch up to 16 roots in one transaction |
commit_epoch_v2 | Extended metadata: epoch ID, leaf count, timestamp, MMR size |
Multi-Chain Anchoring
Lucid anchors to both Solana and EVM chains simultaneously. Configure via theANCHORING_CHAINS environment variable:
EpochRegistry contract, which stores the same root hash, epoch ID, and metadata.
Gas Costs
| Operation | Cost |
|---|---|
| iGas (per inference call) | 1 LUCID |
| mGas (per epoch root commitment) | 5 LUCID |
| Batch commit (16 roots) | 7 LUCID total |
DePIN Archival
After on-chain commitment, the full epoch bundle (all receipts, MMR state, metadata) is archived to decentralized storage:| Provider | Tier | Use Case |
|---|---|---|
| Arweave | Permanent | Immutable epoch bundles, passport metadata |
| Lighthouse | Evolving | MMR checkpoints, memory snapshots |
AnchorDispatcher, which handles storage selection, CID tracking, and deduplication.
.png?fit=max&auto=format&n=VsjUqn6fLqEhBiuI&q=85&s=8b4c7e6431e9a6af1ef23b77bb4ff5fd)
.png?fit=max&auto=format&n=VsjUqn6fLqEhBiuI&q=85&s=d5651a45e4bfbabc33f74e146af3f94a)