Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.lucid.foundation/llms.txt

Use this file to discover all available pages before exploring further.

The lucid_reputation program stores verifiable reputation data for AI assets on Solana. It tracks feedback scores, third-party validations, and supports revocation — all linked to cryptographic receipt hashes. Program ID (devnet): 4FWEH1XQb7p1pU9r8Ap8xomDYVxdSdwk6fFT8XD63G3A

Instructions

InstructionDescription
init_statsInitialize a PassportStats PDA with zeroed counters
submit_feedbackSubmit a score (1-100) linked to a receipt hash
submit_validationValidate a receipt (confirms an interaction occurred)
revoke_feedbackRevoke previously submitted feedback (original submitter only)

Account Structures

PassportStats

PDA seeds: ["stats", passport_id_bytes] Rolling aggregates maintained atomically on every feedback submission or revocation.
FieldTypeDescription
passport_idStringPassport identifier (max 64 chars)
feedback_countu32Total feedback entries ever created
validation_countu32Total validation entries
total_scoreu64Sum of non-revoked scores
avg_scoreu16Average score * 100 (2-decimal precision)
last_updatedi64Last modification timestamp

FeedbackEntry

PDA seeds: ["feedback", passport_id_bytes, index_le_bytes]
FieldTypeDescription
passport_idStringTarget passport
fromPubkeySubmitter
scoreu8Score (1-100)
categoryStringFeedback category (max 32 chars, e.g., “accuracy”)
receipt_hash[u8; 32]Receipt proving the interaction
asset_typeu80=model, 1=compute, 2=tool, 3=agent, 4=dataset
metadataStringAdditional context (max 256 chars)
timestampi64Submission time
revokedboolWhether this feedback was revoked
indexu32Sequential index (used as PDA seed)

ValidationEntry

PDA seeds: ["validation", passport_id_bytes, receipt_hash]
FieldTypeDescription
passport_idStringTarget passport
validatorPubkeyValidator
validboolWhether the receipt is confirmed valid
receipt_hash[u8; 32]Receipt being validated
asset_typeu8Asset type code
metadataStringValidation context (max 256 chars)
timestampi64Validation time

Usage

// Submit feedback for an agent
await program.methods
  .submitFeedback(
    'agent-abc123',       // passport_id
    85,                   // score (1-100)
    'accuracy',           // category
    receiptHash,          // [u8; 32]
    3,                    // asset_type (agent)
    'Fast and accurate'   // metadata
  )
  .accounts({
    feedback: feedbackPda,
    stats: statsPda,
    submitter: wallet.publicKey,
  })
  .rpc();

Revocation

Only the original submitter can revoke their feedback. On revocation:
  • feedback.revoked is set to true
  • stats.total_score is decremented by the revoked score
  • stats.avg_score is recomputed from remaining non-revoked entries
  • stats.feedback_count is not decremented (it tracks total entries for PDA derivation)

Events

EventEmitted When
FeedbackSubmittedNew feedback created (includes passport_id, score, index, receipt_hash)
ValidationSubmittedNew validation created (includes valid flag, receipt_hash)
FeedbackRevokedFeedback revoked (includes original score for off-chain reconciliation)