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:
Each commitment is stored in a PDA derived from the authority’s public key.
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
DePIN Archival
After on-chain commitment, the full epoch bundle (all receipts, MMR state, metadata) is archived to decentralized storage:
All DePIN uploads go through the
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)