FfzkTWRGAJQPDePbujZdEhKHqC1UpqvDrpv4TEiWpx6y
x0-reputation provides a quantitative trust score for every agent in the protocol. Scores are computed from on-chain transaction history and decay over time to ensure recency relevance.
Scoring Formula
The reputation score is a weighted combination of four metrics, scaled to 0–10,000: Where:
A perfect agent (100% success, 0% disputes, 0% failures) scores 10,000. An agent with no transactions returns 0 (unreliable score — below
MIN_TRANSACTIONS_FOR_REPUTATION = 10).
Instructions
initialize_reputation
Creates a new reputation account for an agent.
record_success
Records a successful transaction with response time tracking.
successful_transactions, total_transactions, and the rolling average_response_time_ms.
record_failure
Records a policy rejection or transaction failure.
record_dispute
Records that a dispute was initiated against this agent.
record_resolution_favor
Records that a dispute was resolved in this agent’s favor.
apply_decay
Applies monthly temporal decay to the reputation score. Can be called by anyone (permissionless maintenance).
get_reputation_score
View instruction — returns the current computed score as a u32 (0–10,000).
close_reputation
Closes the reputation account and reclaims rent. Only the owner can call this.
State Account
AgentReputation
["reputation", agent_id]
Temporal Decay
To prevent stale scores from persisting indefinitely, reputation decays at 1% per month (REPUTATION_DECAY_RATE_BPS = 100):
- When
apply_decayis called, elapsed months sincelast_decay_appliedare computed - For each elapsed month, all counters are multiplied by
0.99 - This ensures inactive agents gradually lose their accumulated reputation
- Active agents naturally counteract decay through new transactions
Authorization Model
Reputation updates are restricted to authorized programs via CPI:
This prevents reputation manipulation — only verified program outcomes can modify scores.
Reliability Threshold
An agent’s score is considered reliable only afterMIN_TRANSACTIONS_FOR_REPUTATION = 10 transactions. Below this threshold, the has_reliable_score() method returns false, and consumers should treat the score with caution.