Reputation Scoring

🎯 Overview

Build trust, loyalty, and engagement with dynamic reputation systems powered by comprehensive on-chain behavioral analysis. zPass enables you to create sophisticated reputation-based features that reward genuine users and foster long-term community growth.

Perfect for: Community platforms, loyalty programs, governance systems, access control, gamified experiences


🏆 The Power of Reputation

Why Reputation Matters in Web3

  • Trust Building: Establish credibility in pseudonymous environments

  • Quality Assurance: Identify reliable users and contributors

  • Incentive Alignment: Reward long-term commitment over speculation

  • Community Growth: Foster engagement and loyalty

  • Risk Mitigation: Reduce fraud and bad actor participation

Traditional Reputation Challenges

  • Sybil Vulnerability: Easy to create fake accounts with high reputation

  • Gaming Susceptibility: Simple metrics can be manipulated

  • Lack of Portability: Reputation locked to single platforms

  • Static Systems: Don't adapt to changing user behavior

  • Limited Context: Missing cross-protocol behavioral data


🏗️ zPass Reputation Framework

Multi-Dimensional Scoring

zPass reputation goes beyond simple transaction counts:

Core Reputation Factors

  • Longevity: Account age and consistent activity

  • Diversity: Engagement across multiple protocols and chains

  • Quality: Meaningful interactions vs. spam or farming

  • Reliability: Consistent positive behavior patterns

  • Leadership: Community contributions and governance participation

Dynamic Weighting

  • Context-Aware: Adjust weights based on your protocol's values

  • Time-Decay: Recent behavior weighted more heavily

  • Peer Validation: Cross-reference with community interactions

  • Outcome-Based: Factor in results of user actions


🏗️ Implementation Guide

Step 1: Basic Reputation Integration

Start with simple reputation-based features:

async function getUserReputationProfile(walletAddress) {
  const reputationData = await zpass.getReputationScore(walletAddress);
  
  return {
    overallScore: reputationData.zscore,
    reputationLevel: getReputationLevel(reputationData.zscore),
    categoryScores: {
      defi: reputationData.categories.defi,
      nft: reputationData.categories.nft,
      gaming: reputationData.categories.gaming,
      dao: reputationData.categories.dao
    },
    trustIndicators: {
      accountAge: reputationData.account_age_days,
      protocolDiversity: reputationData.protocols_used.length,
      liquidationHistory: reputationData.liquidation_count,
      governanceParticipation: reputationData.governance_votes
    },
    reputationTrend: reputationData.score_trend_30d
  };
}

function getReputationLevel(zscore) {
  if (zscore >= 800) return { level: 'Legendary', tier: 5, color: '#FFD700' };
  if (zscore >= 600) return { level: 'Expert', tier: 4, color: '#9932CC' };
  if (zscore >= 400) return { level: 'Experienced', tier: 3, color: '#1E90FF' };
  if (zscore >= 200) return { level: 'Developing', tier: 2, color: '#32CD32' };
  return { level: 'Newcomer', tier: 1, color: '#808080' };
}

// Basic reputation-gated features
async function getFeatureAccess(walletAddress) {
  const reputation = await getUserReputationProfile(walletAddress);
  
  return {
    // Basic features available to all
    basicTrading: true,
    communityAccess: true,
    
    // Reputation-gated features
    advancedTrading: reputation.overallScore >= 300,
    betaFeatures: reputation.overallScore >= 500,
    governanceVoting: reputation.overallScore >= 400,
    proposalCreation: reputation.overallScore >= 600,
    moderatorTools: reputation.overallScore >= 700,
    vipSupport: reputation.overallScore >= 800,
    
    // Special privileges
    feeDiscounts: calculateFeeDiscount(reputation.overallScore),
    withdrawalLimits: calculateWithdrawalLimits(reputation.overallScore),
    priorityAccess: reputation.reputationLevel.tier >= 4
  };
}

Step 2: Dynamic Reputation System

Implement a comprehensive reputation system with real-time updates:

class ReputationSystem {
  constructor(zpassClient, protocolConfig) {
    this.zpass = zpassClient;
    this.config = protocolConfig;
    this.userReputations = new Map();
  }

  async calculateProtocolReputation(walletAddress) {
    // Get base zPass reputation
    const baseReputation = await this.zpass.getReputationScore(walletAddress);
    
    // Get protocol-specific activity
    const protocolActivity = await this.getProtocolActivity(walletAddress);
    
    // Calculate weighted reputation score
    const protocolReputation = this.calculateWeightedScore(
      baseReputation, 
      protocolActivity
    );
    
    // Apply protocol-specific modifiers
    const finalScore = this.applyProtocolModifiers(
      protocolReputation, 
      protocolActivity
    );
    
    return {
      baseScore: baseReputation.zscore,
      protocolScore: finalScore,
      breakdown: this.getScoreBreakdown(baseReputation, protocolActivity),
      badges: this.calculateEarnedBadges(baseReputation, protocolActivity),
      nextMilestone: this.getNextMilestone(finalScore)
    };
  }

  calculateWeightedScore(baseReputation, protocolActivity) {
    const weights = this.config.reputationWeights;
    
    let score = 0;
    
    // Base zPass score (40% weight)
    score += baseReputation.zscore * weights.baseScore;
    
    // Protocol-specific factors (60% weight)
    score += protocolActivity.transactionVolume * weights.volume;
    score += protocolActivity.frequencyScore * weights.frequency;
    score += protocolActivity.loyaltyScore * weights.loyalty;
    score += protocolActivity.communityScore * weights.community;
    
    return Math.min(1000, Math.max(0, score));
  }

  applyProtocolModifiers(score, activity) {
    let modifiedScore = score;
    
    // Positive modifiers
    if (activity.isEarlyAdopter) modifiedScore *= 1.1;
    if (activity.hasReferrals) modifiedScore *= 1.05;
    if (activity.providesLiquidity) modifiedScore *= 1.08;
    if (activity.participatesInGovernance) modifiedScore *= 1.12;
    
    // Negative modifiers
    if (activity.hasViolations) modifiedScore *= 0.8;
    if (activity.suspiciousActivity) modifiedScore *= 0.7;
    
    return Math.min(1000, Math.max(0, modifiedScore));
  }

  calculateEarnedBadges(baseReputation, protocolActivity) {
    const badges = [];
    
    // Volume-based badges
    if (protocolActivity.totalVolume > 1000000) badges.push('whale');
    if (protocolActivity.totalVolume > 100000) badges.push('high_roller');
    
    // Loyalty badges
    if (protocolActivity.daysActive > 365) badges.push('veteran');
    if (protocolActivity.consecutiveDays > 30) badges.push('dedicated');
    
    // Community badges
    if (protocolActivity.referralCount > 10) badges.push('ambassador');
    if (protocolActivity.governanceVotes > 20) badges.push('governor');
    
    // Cross-protocol badges
    if (baseReputation.protocols_used.length > 10) badges.push('explorer');
    if (baseReputation.categories.defi > 700) badges.push('defi_expert');
    
    return badges;
  }

  async updateReputationRealTime(walletAddress, action) {
    const currentReputation = this.userReputations.get(walletAddress);
    
    if (!currentReputation) {
      // First time user - calculate full reputation
      const reputation = await this.calculateProtocolReputation(walletAddress);
      this.userReputations.set(walletAddress, reputation);
      return reputation;
    }
    
    // Update based on action
    const reputationDelta = this.calculateActionImpact(action);
    const updatedReputation = this.applyReputationDelta(
      currentReputation, 
      reputationDelta
    );
    
    this.userReputations.set(walletAddress, updatedReputation);
    
    // Check for milestone achievements
    await this.checkMilestones(walletAddress, updatedReputation);
    
    return updatedReputation;
  }

  calculateActionImpact(action) {
    const impacts = {
      // Positive actions
      'large_transaction': { score: +5, category: 'volume' },
      'provide_liquidity': { score: +10, category: 'contribution' },
      'governance_vote': { score: +8, category: 'community' },
      'successful_referral': { score: +15, category: 'growth' },
      'bug_report': { score: +20, category: 'contribution' },
      
      // Negative actions
      'failed_transaction': { score: -2, category: 'reliability' },
      'violation_warning': { score: -10, category: 'conduct' },
      'suspicious_activity': { score: -25, category: 'trust' }
    };
    
    return impacts[action.type] || { score: 0, category: 'neutral' };
  }
}

Step 3: Gamified Reputation Features

Create engaging, game-like reputation experiences:

class ReputationGameification {
  constructor(reputationSystem) {
    this.reputation = reputationSystem;
    this.achievements = new Map();
    this.leaderboards = new Map();
  }

  async createUserProfile(walletAddress) {
    const reputation = await this.reputation.calculateProtocolReputation(walletAddress);
    
    return {
      // Core reputation data
      level: this.calculateLevel(reputation.protocolScore),
      experience: reputation.protocolScore,
      nextLevelXP: this.getNextLevelRequirement(reputation.protocolScore),
      
      // Visual elements
      avatar: this.generateAvatar(reputation),
      title: this.getUserTitle(reputation),
      badges: reputation.badges,
      
      // Progress tracking
      achievements: await this.getUserAchievements(walletAddress),
      streaks: await this.getUserStreaks(walletAddress),
      milestones: this.getUpcomingMilestones(reputation),
      
      // Social features
      rank: await this.getUserRank(walletAddress),
      followers: await this.getFollowerCount(walletAddress),
      following: await this.getFollowingCount(walletAddress)
    };
  }

  calculateLevel(score) {
    // Exponential leveling system
    const level = Math.floor(Math.sqrt(score / 10));
    return {
      current: level,
      progress: (score - (level * level * 10)) / ((level + 1) * (level + 1) * 10 - level * level * 10),
      maxLevel: 100
    };
  }

  async createLeaderboard(category, timeframe = '30d') {
    const leaderboardKey = `${category}_${timeframe}`;
    
    if (this.leaderboards.has(leaderboardKey)) {
      return this.leaderboards.get(leaderboardKey);
    }
    
    // Fetch top users for category
    const topUsers = await this.reputation.zpass.getTopUsers({
      category,
      timeframe,
      limit: 100
    });
    
    const leaderboard = {
      category,
      timeframe,
      lastUpdated: Date.now(),
      entries: topUsers.map((user, index) => ({
        rank: index + 1,
        walletAddress: user.wallet_address,
        score: user.score,
        change: user.score_change,
        badges: user.badges
      }))
    };
    
    this.leaderboards.set(leaderboardKey, leaderboard);
    return leaderboard;
  }

  async createReputationQuests(walletAddress) {
    const userProfile = await this.createUserProfile(walletAddress);
    const currentLevel = userProfile.level.current;
    
    // Generate personalized quests based on user's current reputation
    const quests = [
      {
        id: 'daily_trader',
        title: 'Daily Trader',
        description: 'Make at least one trade every day for 7 days',
        type: 'streak',
        target: 7,
        current: userProfile.streaks.trading || 0,
        reward: { xp: 50, badge: 'consistent_trader' },
        difficulty: 'easy'
      },
      {
        id: 'governance_participant',
        title: 'Voice of the Community',
        description: 'Vote on 5 governance proposals',
        type: 'count',
        target: 5,
        current: userProfile.achievements.governance_votes || 0,
        reward: { xp: 100, badge: 'governor' },
        difficulty: 'medium'
      },
      {
        id: 'liquidity_provider',
        title: 'Market Maker',
        description: 'Provide liquidity for 30 days',
        type: 'duration',
        target: 30,
        current: userProfile.achievements.liquidity_days || 0,
        reward: { xp: 200, badge: 'market_maker' },
        difficulty: 'hard'
      }
    ];
    
    // Filter quests appropriate for user's level
    return quests.filter(quest => this.isQuestAppropriate(quest, currentLevel));
  }
}

🎯 Real-World Applications

Community Platform Example

// Reputation-based community features
async function getCommunityFeatures(walletAddress) {
  const reputation = await getUserReputationProfile(walletAddress);
  
  return {
    // Posting privileges
    canPost: reputation.overallScore >= 100,
    canCreatePolls: reputation.overallScore >= 300,
    canPin: reputation.overallScore >= 500,
    canModerate: reputation.overallScore >= 700,
    
    // Interaction limits
    dailyPostLimit: Math.min(50, Math.floor(reputation.overallScore / 10)),
    canDirectMessage: reputation.overallScore >= 200,
    canCreateChannels: reputation.overallScore >= 400,
    
    // Special privileges
    verifiedBadge: reputation.overallScore >= 600,
    customEmoji: reputation.overallScore >= 800,
    prioritySupport: reputation.reputationLevel.tier >= 4
  };
}

Loyalty Program Integration

// Dynamic loyalty rewards based on reputation
async function calculateLoyaltyRewards(walletAddress, transactionAmount) {
  const reputation = await getUserReputationProfile(walletAddress);
  
  // Base reward rate
  let rewardRate = 0.01; // 1%
  
  // Reputation multipliers
  if (reputation.overallScore >= 800) rewardRate *= 3.0;
  else if (reputation.overallScore >= 600) rewardRate *= 2.5;
  else if (reputation.overallScore >= 400) rewardRate *= 2.0;
  else if (reputation.overallScore >= 200) rewardRate *= 1.5;
  
  // Category bonuses
  if (reputation.categoryScores.defi > 700) rewardRate *= 1.2;
  if (reputation.trustIndicators.protocolDiversity > 10) rewardRate *= 1.1;
  
  const baseReward = transactionAmount * rewardRate;
  
  return {
    baseReward,
    reputationMultiplier: rewardRate / 0.01,
    bonusReward: baseReward - (transactionAmount * 0.01),
    totalReward: baseReward,
    nextTierBonus: calculateNextTierBonus(reputation.overallScore)
  };
}

📊 Success Metrics & Benefits

Proven Results

Community Engagement

  • 40% increase in user retention with reputation systems

  • 60% more quality content creation

  • 25% reduction in spam and low-quality posts

  • 3x higher governance participation rates

User Loyalty

  • 50% increase in user lifetime value

  • 35% higher transaction frequency

  • 20% reduction in churn rate

  • 2x more referrals from high-reputation users

Implementation Benefits

Metric
Before Reputation
After Reputation
Improvement

User Retention

45%

63%

+40%

Quality Score

6.2/10

8.1/10

+31%

Engagement Rate

12%

19%

+58%

Support Tickets

150/day

95/day

-37%


🚀 Getting Started

Quick Implementation

  1. Set Up zPass - Get your API credentials

  2. Define Reputation Model - Choose weights and factors for your protocol

  3. Implement Basic Features - Start with simple reputation-gated access

  4. Add Gamification - Introduce levels, badges, and achievements

  5. Monitor & Optimize - Track engagement and adjust parameters

Best Practices

  • Start Simple: Begin with basic reputation levels and features

  • Make it Visible: Show users their reputation and progress clearly

  • Reward Consistently: Ensure reputation gains feel fair and achievable

  • Prevent Gaming: Use zPass's Sybil detection to maintain integrity

  • Iterate Based on Data: Continuously improve based on user behavior


🤝 Support & Resources

Implementation Support

  • 💬 Discord: Join our community building discussions

  • 📧 Email: [email protected]

  • 📞 Consultation: Schedule a reputation system design session

Advanced Features

  • Custom Algorithms: Develop protocol-specific reputation models

  • Cross-Platform Integration: Portable reputation across applications

  • Real-time Updates: Live reputation tracking and notifications

Ready to build a thriving community with reputation? Start Building →

Last updated