Free 30-min Web3 Consultation
Book Consultation
Smart Contract Security Audits
View Audit Services
Custom DeFi Protocol Development
Explore DeFi
Full-Stack Web3 dApp Development
View App Services
Free 30-min Web3 Consultation
Book Consultation
Smart Contract Security Audits
View Audit Services
Custom DeFi Protocol Development
Explore DeFi
Full-Stack Web3 dApp Development
View App Services
Free 30-min Web3 Consultation
Book Consultation
Smart Contract Security Audits
View Audit Services
Custom DeFi Protocol Development
Explore DeFi
Full-Stack Web3 dApp Development
View App Services
Free 30-min Web3 Consultation
Book Consultation
Smart Contract Security Audits
View Audit Services
Custom DeFi Protocol Development
Explore DeFi
Full-Stack Web3 dApp Development
View App Services
LABS
Guides

Setting Up On-Chain Reputation Systems Within Social Graphs

This guide provides a technical walkthrough for developers to implement composable reputation scores derived from on-chain social interactions, including data sourcing, algorithm design, and smart contract integration.
Chainscore © 2026
introduction
DEVELOPER GUIDE

Setting Up On-Chain Reputation Systems Within Social Graphs

This guide explains how to build and integrate reputation scores using on-chain data from social graph protocols like Lens and Farcaster.

On-chain reputation quantifies a user's standing within a decentralized network using verifiable data from their blockchain activity. Unlike opaque social media algorithms, these systems are transparent and composable. Reputation is typically derived from metrics like transaction history, governance participation, content engagement, and social connections recorded on protocols such as Lens Protocol, Farcaster, and CyberConnect. This creates a portable, user-owned credential that can be used across different DeFi, DAO, and social applications without platform lock-in.

The core technical challenge is aggregating and weighting disparate on-chain signals into a meaningful score. A basic reputation contract might track: - Number of protocol interactions - Value transacted or staked - Age of the relationship graph - Endorsements from trusted entities. For example, a user's reputation in a Lens-based app could increase with each mirror (repost) of their publication or with new followers who themselves have high reputation scores. This requires querying the graph's smart contracts or indexing services like The Graph to fetch and calculate these metrics.

Here is a simplified Solidity example of a reputation registry that assigns points based on holding a Lens Profile NFT and receiving collects (tips). This contract uses a mapping to store scores and allows an authorized oracle to update them.

solidity
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;

interface ILensHub {
    function ownerOf(uint256 tokenId) external view returns (address);
}

contract SocialReputation {
    ILensHub public lensHub;
    address public oracle;
    mapping(address => uint256) public reputationScore;

    constructor(address _lensHub) {
        lensHub = ILensHub(_lensHub);
        oracle = msg.sender;
    }

    function updateReputation(address user, uint256 lensProfileId, uint256 collects) external {
        require(msg.sender == oracle, "Unauthorized");
        require(lensHub.ownerOf(lensProfileId) == user, "Not profile owner");
        // Base score for profile ownership + points for collects
        reputationScore[user] = 10 + (collects * 2);
    }
}

Integrating this reputation into an application involves listening for on-chain events and updating a user's UI state. A Next.js frontend might use wagmi and viem to read the score. More advanced systems use attestation standards like EAS (Ethereum Attestation Service) to create verifiable, timestamped reputation statements that can be revoked. When designing your system, consider sybil resistance—often achieved by weighting actions by the cost or stake involved—and decay mechanisms to ensure scores reflect recent, relevant activity.

Practical use cases for on-chain reputation are expanding. In DeFi, it can enable undercollateralized lending based on a user's social and financial history. DAOs use it to weight governance votes or gate access to high-level channels. Social apps can surface high-quality content from reputable users. The key advantage is interoperability; a reputation score built on Farcaster can be utilized by a Lens application, creating a unified web3 social identity. Start by defining clear, measurable actions that signal trust within your specific community.

prerequisites
FOUNDATIONS

Prerequisites and Tech Stack

Before building an on-chain reputation system, you need a clear understanding of the core components and tools required. This guide outlines the essential prerequisites and the modern tech stack for integrating reputation into social graphs.

An on-chain reputation system quantifies and records user contributions, interactions, and trust within a decentralized network. Unlike traditional systems, it uses immutable ledgers and cryptographic proofs to create a portable, verifiable identity layer. The foundational prerequisites include a working knowledge of Ethereum or another smart contract platform, understanding of decentralized identity (DID) standards like W3C's DID-Core, and familiarity with graph data structures to model social connections. You should also be comfortable with concepts like token-curated registries (TCRs), Soulbound Tokens (SBTs), and oracles for importing off-chain data.

Your development environment is critical. Start with Node.js (v18+) and a package manager like npm or yarn. You'll need a smart contract development framework; Hardhat or Foundry are industry standards for writing, testing, and deploying reputation logic in Solidity or Vyper. For interacting with the blockchain during development, use a local network like Hardhat Network or Anvil. Essential libraries include ethers.js v6 or viem for frontend integration and The Graph for indexing and querying complex reputation event data efficiently.

The core of your stack will be the smart contracts that define reputation logic. This includes a registry contract to issue SBTs or non-transferable NFTs representing attestations, a scoring/weighting contract that algorithmically calculates reputation scores based on on-chain actions, and an attestation contract allowing other entities to vouch for a user. For social graphs, you'll integrate with existing frameworks like Lens Protocol or Farcaster Frames, which provide base social primitives. Always write comprehensive tests using Waffle or Forge Std and consider upgrade patterns like Transparent Proxy or UUPS for your contracts.

Off-chain components are equally important. You'll need a server or serverless function (e.g., using Next.js API routes or Cloudflare Workers) to handle secure signing of attestations or to run more complex, gas-intensive reputation algorithms. A database like PostgreSQL or Supabase may cache scores or store private user data. For user onboarding, integrate wallet connectors such as RainbowKit or Dynamic. Finally, plan your go-to-market infrastructure: a subgraph on The Graph's decentralized network, IPFS (via Pinata or web3.storage) for metadata, and Alchemy or Infura for reliable RPC endpoints.

key-concepts-text
CORE CONCEPTS

Setting Up On-Chain Reputation Systems Within Social Graphs

This guide explains the foundational components and implementation strategies for building reputation systems directly into decentralized social graphs, moving beyond simple follower counts.

On-chain reputation systems quantify trust and contribution within decentralized social networks. Unlike Web2 platforms where reputation is a proprietary score, on-chain systems use transparent, programmable logic stored on a blockchain. This allows for portable reputation that users own and can carry across different applications. The core data structure is the social graph—a network of connections (edges) between user addresses (nodes). Reputation algorithms analyze this graph, often weighting connections based on interaction history, token holdings, or delegated stakes to calculate a user's influence or credibility score.

Implementing a basic system starts with defining reputation sources. Common sources include: - Social attestations (endorsements, likes as verifiable credentials), - On-chain activity (governance participation, successful transactions), - Financial stake (token holdings in relevant protocols), and - Content provenance (original minting vs. resharing). These inputs are stored as verifiable claims, often using standards like EIP-712 for signed typed data or Verifiable Credentials. A smart contract aggregates these claims, applying weights and decay functions to prevent score inflation and sybil attacks.

A critical technical challenge is preventing sybil attacks, where a single entity creates many fake accounts. Common mitigation patterns include: - Proof-of-personhood verification (e.g., Worldcoin, BrightID), - Stake-weighted graphs where influence requires capital at risk, - Trust-bounded voting where reputation propagates only a few degrees from verified anchors, and - Context-specific graphs that isolate reputation to a single community or topic. Projects like Lens Protocol and Farcaster Frames provide frameworks where reputation can be built atop their underlying social primitives.

For developers, a minimal reputation contract might track a mapping(address => uint256) for scores and include functions to update them based on verified events. Oracles or indexers often handle the complex graph traversal off-chain, posting calculated scores on-chain via transactions. When integrating, consider composability: design your reputation outputs as ERC-20-like tokens or non-transferable NFTs (ERC-721) so other dApps can easily read and utilize the score. Always include a decay mechanism (score = score * decayFactor / 100) to ensure the system reflects recent activity.

Advanced implementations use eigenvector-based algorithms like PageRank adapted for decentralized graphs. Here, a user's reputation is a function of the reputation of those who interact with them. This requires off-chain computation due to gas costs, with results committed to chain. Frameworks like The Graph subgraphs are essential for querying complex graph relationships. When designing, audit for fairness and transparency: make the scoring algorithm open-source and allow users to query the inputs to their own score to build trust in the system.

The future of on-chain social reputation lies in interoperable, context-rich systems. A user might have a developer reputation in a protocol's governance forum, a curator reputation in an NFT community, and a borrower reputation in a lending protocol—all derived from the same social graph but applied differently. Standards like ERC-6551 for token-bound accounts allow NFTs to hold reputation states, enabling collective identities. The goal is to move from simplistic metrics to a nuanced, multi-dimensional reputation layer that becomes foundational infrastructure for decentralized society (DeSoc).

data-sources
REPUTATION SYSTEMS

Primary On-Chain Data Sources

Building a robust on-chain reputation system requires aggregating and analyzing data from multiple, verifiable sources. These are the foundational data layers developers use to construct social graphs and trust scores.

CORE APPROACHES

Reputation Scoring Algorithm Comparison

Comparison of foundational algorithms for calculating on-chain reputation scores within social graphs.

Algorithm / MetricPageRank-BasedEigenTrust-BasedSybil-Resistant (PoP)

Core Mechanism

Link analysis of graph connections

Local trust aggregation & transitivity

Costly signaling & identity attestation

Sybil Resistance

Partial (requires pre-trusted nodes)

Decentralization

High (no central authority)

Medium (requires seed set)

High (permissionless participation)

Compute Cost

High (requires global graph)

Medium (iterative local computation)

Low (local verification)

Data Freshness

Batch updates (epochs)

Real-time propagation

Real-time on attestation

Primary Use Case

Influence/authority scoring

Peer-to-peer trust networks

Proof-of-personhood & unique identity

Example Protocols

Lens Protocol, Farcaster

EigenTrust (original), Karma3 Labs

Worldcoin, BrightID, Proof of Humanity

Typical Gas Cost per Update

$0.50 - $2.00

$0.10 - $0.50

$2.00 - $10.00 (initial attestation)

implementation-steps
TECHNICAL GUIDE

Implementation Steps: Smart Contract & Indexer

This guide details the core technical implementation for building an on-chain reputation system, covering smart contract design and off-chain indexing strategies.

The foundation of any on-chain reputation system is a smart contract that defines the rules for accruing and storing reputation scores. A common approach is to create a ReputationRegistry contract that maps user addresses to a numeric score. This contract should expose functions for trusted entities, or attesters, to submit verifiable claims that update a user's score. For example, a function like submitAttestation(address user, uint256 scoreDelta, bytes memory signature) can allow an off-chain oracle to post a signed message proving a user completed a task. It's critical that the contract includes access control, such as OpenZeppelin's Ownable or a more granular role-based system using AccessControl, to prevent unauthorized score manipulation.

To make reputation data efficiently queryable, you need an indexer. Raw on-chain event data is not optimized for complex queries like "show me the top 10 users by reputation." An indexer, built with tools like The Graph, Subsquid, or a custom service listening to contract events, processes every AttestationSubmitted event. It transforms this data into a structured database, calculating cumulative scores and enabling fast, filtered queries via a GraphQL API. This decouples the immutable, secure logic of the smart contract from the performance needs of applications that need to read and display reputation data.

When designing your data schema for the indexer, model entities that reflect your contract's events and the relationships between them. A typical schema includes User (id: address), Attestation (id, user_id, scoreDelta, timestamp, attester), and an aggregated ReputationScore (user_id, totalScore). The indexer's mapping logic listens for events, creates or updates these entities, and recalculates the total score for a user by summing all related attestations. This allows dApps to query a user's full attestation history or get a leaderboard with a single, efficient query instead of multiple expensive RPC calls to the blockchain.

For production systems, consider scalability and cost. Storing detailed attestation data directly on-chain can become prohibitively expensive. A hybrid approach uses the blockchain as an anchor for verification while storing the bulk of the data off-chain. The contract can store only a cryptographic commitment, like a Merkle root of all attestations, while the indexer stores the full data set. Users can then provide cryptographic proofs to verify specific attestations against the on-chain root. Additionally, implement event indexing filters in your subgraph to only process events from specific attesters or for scores above a threshold, reducing unnecessary computation.

ON-CHAIN REPUTATION SYSTEMS

Common Implementation Issues and Fixes

Implementing reputation within social graphs presents unique challenges. This guide addresses frequent developer questions and technical hurdles, from data indexing to Sybil resistance.

Indexing social data from platforms like Farcaster or Lens Protocol is resource-intensive due to the volume and real-time nature of the data. The primary bottleneck is often the initial historical sync, which can involve processing millions of cast, post, or follow events.

Common fixes include:

  • Use The Graph Subgraphs: Deploy a subgraph to index events into a queryable API, offloading indexing logic from your app. For example, Lens Protocol's official subgraphs provide pre-indexed social data.
  • Implement Event Streaming: Instead of polling, use websocket connections to listen for new events in real-time (e.g., via Farcaster's Hub or Lens's Momoka).
  • Batch Historical Queries: When a full sync is needed, use RPC providers with high rate limits and implement exponential backoff for batch requests to avoid being throttled.
ARCHITECTURE PATTERNS

Platform-Specific Considerations

Lens Protocol: Profile-Centric Reputation

Lens Protocol's core primitive is the Profile NFT, which acts as a portable identity and reputation container. Reputation systems here are built by aggregating on-chain signals from publications (posts, comments, mirrors) and interactions (collects).

Key Implementation Strategy:

  • Use the LensHub contract to query a profile's publication history and collect metrics.
  • Build reputation scores by analyzing Open Actions (custom smart contract interactions attached to publications).
  • Leverage Lens API for efficient historical data fetching before moving logic on-chain.
  • Reputation is non-transferable with the Profile NFT, but can be gated using Lens Modules for token-gated content or membership.

Example Metric: A creator's "Engagement Score" could be calculated as a weighted sum of collects, mirrors, and comments on their last 50 publications.

use-cases
SOCIAL GRAPHS

Use Cases for Composable Reputation

On-chain reputation transforms social graphs from static connections into dynamic, programmable networks. These systems enable new forms of trust, governance, and economic interaction.

ON-CHAIN REPUTATION SYSTEMS

Frequently Asked Questions (FAQ)

Common technical questions and troubleshooting for developers building reputation systems on social graphs.

An on-chain reputation system is a set of rules and data structures stored and executed on a blockchain that quantifies and tracks the credibility or standing of participants (e.g., users, DAOs, bots) within a network. Its core components are immutable reputation scores and programmable logic for score calculation.

Key differences from off-chain systems:

  • Data Location & Control: On-chain scores are public, verifiable state on the ledger. Off-chain scores are held in private databases.
  • Composability: On-chain reputation is a public good that any smart contract can permissionlessly query and integrate (e.g., for loan collateral, governance weight). Off-chain data creates silos.
  • Censorship Resistance: Scores cannot be unilaterally altered by a central entity.
  • Cost & Speed: On-chain updates incur gas fees and are slower; off-chain can be faster and cheaper but requires trust in the operator.

Protocols like Lens Protocol and Farcaster store social graph data on-chain, enabling native reputation building.

conclusion
IMPLEMENTATION ROADMAP

Conclusion and Next Steps

This guide has covered the core components for building on-chain reputation within social graphs. The final step is to integrate these concepts into a cohesive system.

To implement a functional reputation system, you must connect the data layer, scoring logic, and application interface. Start by deploying your ReputationRegistry smart contract, which will store attestations and scores. Use a subgraph from The Graph to index on-chain events for efficient querying. Your frontend dApp can then pull reputation data via GraphQL and display user scores, badges, and social connections. This creates a closed loop where user actions on-chain are reflected in their verifiable reputation.

Consider these advanced patterns for a more robust system. Implement time-decay functions to ensure recent interactions weigh more heavily than old ones, preventing reputation stagnation. Use sybil-resistance mechanisms like proof-of-humanity or stake-weighted voting to mitigate spam. For composability, design your reputation scores as ERC-20 or ERC-1155 tokens, allowing them to be used as collateral in DeFi or governance power in DAOs. Projects like Gitcoin Passport demonstrate how aggregated attestations can create a portable identity score.

The next evolution involves context-specific reputation. A user's credibility in a developer DAO should differ from their standing in a gaming guild. Build modular scoring modules that can be mixed and matched. Explore frameworks like EAS (Ethereum Attestation Service) for making standard, portable attestations. Finally, prioritize privacy-preserving techniques such as zero-knowledge proofs, enabling users to prove they have a high reputation score without revealing the underlying transactions, a critical feature for mainstream adoption.

Your development roadmap should be iterative. Launch a minimum viable product (MVP) with basic following/follower graphs and a simple scoring algorithm on a testnet. Gather feedback, then incrementally add features like token-gated communities based on reputation thresholds or delegation mechanisms. Monitor key metrics: number of active reputations, score distribution, and the frequency of attestation issuance. The goal is to create a system that is both useful for applications and truly owned by the users who build their social capital within it.

How to Build On-Chain Reputation for Social Graphs | ChainScore Guides