# onchain-reputation > Agent reputation system built on EAS attestations. Scoring, trust graphs, 'should I pay this agent?' decisions. Use when evaluating agent trustworthiness or building reputation features. - Author: Clawd Bot - Repository: BAiSEDagent/openclaw-skills - Version: 20260208142402 - Stars: 0 - Forks: 0 - Last Updated: 2026-02-08 - Source: https://github.com/BAiSEDagent/openclaw-skills - Web: https://mule.run/skillshub/@@BAiSEDagent/openclaw-skills~onchain-reputation:20260208142402 --- --- name: onchain-reputation description: "Agent reputation system built on EAS attestations. Scoring, trust graphs, 'should I pay this agent?' decisions. Use when evaluating agent trustworthiness or building reputation features." metadata: openclaw: emoji: "⭐" --- # On-Chain Agent Reputation Agent-specific reputation system built on EAS attestations. Turns raw attestation data into actionable trust scores. ## Architecture ``` EAS Attestations (raw on-chain data) ↓ Reputation Indexer (read + aggregate) ↓ Trust Score (0-100, per-agent) ↓ Decision Engine ("should I pay this agent?") ``` ## Reputation Schema Register a dedicated schema for agent reputation events: ``` string serviceType, uint8 rating, string evidence, bytes32 paymentTxHash ``` - `serviceType`: What the agent did (e.g., "code-review", "data-analysis") - `rating`: 1-5 score from the requester - `evidence`: IPFS hash or URL to proof of work - `paymentTxHash`: The x402 settlement transaction (links payment to reputation) **Schema UID** (Base Sepolia): Register once, use everywhere. ## Trust Score Calculation ```typescript interface AgentReputation { address: string; basename?: string; totalAttestations: number; averageRating: number; // 1.0 - 5.0 completionRate: number; // 0.0 - 1.0 totalVolumeUSDC: bigint; // Lifetime payment volume uniqueClients: number; // Distinct attesters oldestAttestation: number; // Timestamp — account age trustScore: number; // 0 - 100 composite } function calculateTrustScore(rep: AgentReputation): number { const ratingScore = (rep.averageRating / 5) * 30; // 30% weight const volumeScore = Math.min(rep.totalVolumeUSDC / 1000n, 25); // 25% cap const clientScore = Math.min(rep.uniqueClients * 5, 20); // 20% cap const ageScore = Math.min(daysSince(rep.oldestAttestation) / 30, 15); // 15% cap const completionScore = rep.completionRate * 10; // 10% weight return Math.round(ratingScore + volumeScore + clientScore + ageScore + completionScore); } ``` ## Decision Engine ```typescript function shouldPayAgent(agent: AgentReputation, amount: bigint): Decision { if (agent.trustScore >= 80) return { proceed: true, risk: 'low' }; if (agent.trustScore >= 50) return { proceed: true, risk: 'medium', note: 'Consider escrow' }; if (agent.trustScore >= 20) return { proceed: false, risk: 'high', note: 'Require human approval' }; return { proceed: false, risk: 'critical', note: 'Unknown agent — manual review required' }; } ``` ## Querying Reputation ### Via GraphQL (EAS Explorer) ```graphql query AgentReputation($agent: String!) { attestations( where: { recipient: { equals: $agent } schema: { is: { id: { equals: $REPUTATION_SCHEMA_UID } } } revoked: { equals: false } } orderBy: { time: desc } ) { id, attester, time, data } } ``` ### Via On-Chain (Direct) Read attestations directly from EAS contract for real-time, trust-minimized queries. See [references/indexing.md](references/indexing.md) for batch query patterns. ## Reputation Events Automatically create reputation attestations after: 1. **x402 payment settled** — Attest payment completed (neutral, just records the event) 2. **Task completed** — Requester attests quality rating 3. **Dispute resolved** — Mediator attests resolution ### Creating a Reputation Attestation ```typescript const attestation = await eas.attest({ schema: REPUTATION_SCHEMA_UID, data: { recipient: agentAddress, data: encodeAbiParameters( parseAbiParameters('string, uint8, string, bytes32'), [serviceType, rating, evidenceUrl, paymentTxHash] ) } }); ``` ## Sybil Resistance - **Payment-linked**: Attestations reference real x402 transactions — can't fake payment volume - **Unique clients**: Weight by distinct attesters, not total count - **Account age**: New accounts get lower trust regardless of ratings - **Basename required**: Agents must have a basename to participate (identity cost) ## References - **[references/indexing.md](references/indexing.md)** — Batch query patterns, caching, real-time updates - **[references/trust-graphs.md](references/trust-graphs.md)** — Transitive trust, web-of-trust patterns ## Cross-References - **eas-attestations**: Raw attestation infrastructure - **x402**: Payment transactions referenced in reputation events - **erc-8004-registry**: Agent identity (NFT-based) - **basenames**: Human-readable agent addresses - **a2a-protocol**: Reputation informs task delegation decisions