Program ID: 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.
The reputation score is a weighted combination of four metrics, scaled to 0–10,000:
S=10000×(Ws⋅Rs+Wr⋅Rr+Wd⋅(1−Dr)+Wf⋅(1−Fr))
Where:
| Symbol | Weight | Metric | Formula |
|---|
| Rs | Ws=0.60 | Success rate | successful / total |
| Rr | Wr=0.15 | Resolution rate | resolved_in_favor / disputed |
| Dr | Wd=0.10 | Dispute rate | disputed / total |
| Fr | Wf=0.15 | Failure rate | failed / total |
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.
record_success(response_time_ms: u32)
Updates successful_transactions, total_transactions, and the rolling average_response_time_ms.
record_failure
Records a policy rejection or transaction failure.
record_failure(error_code: u32)
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
pub struct AgentReputation {
pub version: u8,
pub agent_id: Pubkey,
pub total_transactions: u64,
pub successful_transactions: u64,
pub disputed_transactions: u64,
pub resolved_in_favor: u64,
pub failed_transactions: u64,
pub average_response_time_ms: u32,
pub cumulative_response_time_ms: u64,
pub last_updated: i64,
pub last_decay_applied: i64,
pub bump: u8,
}
PDA Seeds: ["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_decay is called, elapsed months since last_decay_applied are 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:
| Caller | Allowed Operations |
|---|
| x0-escrow | record_success, record_dispute, record_resolution_favor |
| x0-guard | record_failure |
| Anyone | apply_decay, get_reputation_score |
| Owner only | initialize_reputation, close_reputation |
This prevents reputation manipulation — only verified program outcomes can modify scores.
Reliability Threshold
An agent’s score is considered reliable only after MIN_TRANSACTIONS_FOR_REPUTATION = 10 transactions. Below this threshold, the has_reliable_score() method returns false, and consumers should treat the score with caution.
Events Emitted
| Event | When |
|---|
ReputationInitialized | New reputation account created |
ReputationUpdated | Any counter modified (success, dispute, failure, decay) |
Last modified on February 8, 2026