Skip to main content

Overview

Reputation profiles aggregate all ratings received by a user across all applications and deals. IOTA Repstation provides both global and application-scoped reputation views, giving users comprehensive trust scores while preserving context-specific performance.

Reputation Structure

Global Reputation

Global reputation combines all ratings a user has received across all platforms using IOTA Repstation:
interface GlobalReputation {
  average: number;    // Overall average score (1-100)
  count: number;      // Total number of ratings received
  categories?: {      // Optional category breakdown
    [category: string]: {
      average: number;
      count: number;
    };
  };
}

App-Scoped Reputation

Each application maintains separate reputation statistics:
interface AppScopedReputation {
  appOwner: string;   // Application's admin address
  appId?: string;     // Application identifier (if available)
  stats: {
    average: number;  // Average score within this app
    count: number;    // Number of ratings within this app
  };
  categories?: {      // Category breakdown for this app
    [category: string]: {
      average: number;
      count: number;
    };
  };
}

Reputation Calculation

Weighted Averages

Reputation scores are calculated using weighted averages:
// Simple average calculation
const average = totalScore / ratingCount;

// Example: User has ratings of 85, 92, 78, 95
// Average = (85 + 92 + 78 + 95) / 4 = 87.5

Minimum Rating Threshold

Most applications should implement a minimum rating threshold for displaying reputation:
function getDisplayableReputation(profile: ReputationProfile) {
  const MIN_RATINGS = 3; // Minimum ratings to show reputation
  
  if (profile.global.count < MIN_RATINGS) {
    return {
      status: 'insufficient_data',
      message: `Needs ${MIN_RATINGS - profile.global.count} more ratings`
    };
  }
  
  return {
    status: 'valid',
    reputation: profile.global
  };
}

Querying Reputation

Basic Profile Query

const profile = await client.getReputationProfile({
  walletAddress: '0x742d35cc...'
});

if (profile.success && profile.profile) {
  console.log('Global reputation:', profile.profile.global);
  console.log('App-specific reputation:', profile.profile.appScoped);
} else {
  console.log('No reputation data found');
}

Handling Missing Data

function displayReputation(profile: ReputationProfile | null) {
  if (!profile || profile.global.count === 0) {
    return "New user - no ratings yet";
  }
  
  if (profile.global.count < 5) {
    return `${profile.global.average}/100 (${profile.global.count} ratings - limited data)`;
  }
  
  return `${profile.global.average}/100 (${profile.global.count} ratings)`;
}

Reputation Display

Trust Badges

Create visual trust indicators based on reputation:
function getTrustBadge(average: number, count: number) {
  if (count < 3) return { level: 'new', color: 'gray', text: 'New User' };
  if (average >= 90) return { level: 'excellent', color: 'green', text: 'Excellent' };
  if (average >= 80) return { level: 'good', color: 'blue', text: 'Trusted' };
  if (average >= 70) return { level: 'fair', color: 'yellow', text: 'Reliable' };
  if (average >= 60) return { level: 'poor', color: 'orange', text: 'Caution' };
  return { level: 'very_poor', color: 'red', text: 'High Risk' };
}

Reputation Components

function ReputationDisplay({ walletAddress }: { walletAddress: string }) {
  const [reputation, setReputation] = useState(null);
  
  useEffect(() => {
    loadReputation();
  }, [walletAddress]);
  
  const loadReputation = async () => {
    const result = await client.getReputationProfile({ walletAddress });
    if (result.success) {
      setReputation(result.profile);
    }
  };
  
  if (!reputation) {
    return <div>Loading reputation...</div>;
  }
  
  const badge = getTrustBadge(reputation.global.average, reputation.global.count);
  
  return (
    <div className="reputation-display">
      <div className={`trust-badge ${badge.level}`}>
        <span className="score">{reputation.global.average}/100</span>
        <span className="label">{badge.text}</span>
        <span className="count">({reputation.global.count} ratings)</span>
      </div>
      
      {reputation.appScoped.length > 0 && (
        <div className="app-reputation">
          <h4>Platform-Specific Ratings</h4>
          {reputation.appScoped.map((app, index) => (
            <div key={index} className="app-rating">
              <span>{app.stats.average}/100</span>
              <span>({app.stats.count} ratings)</span>
            </div>
          ))}
        </div>
      )}
    </div>
  );
}

Cross-Platform Benefits

Reputation Portability

Users carry their reputation across all platforms:
// User builds reputation on Platform A
// Reputation is immediately visible on Platform B
const userProfile = await client.getReputationProfile({
  walletAddress: userWallet
});

console.log('Total reputation across all platforms:', userProfile.global);
console.log('Performance on each platform:', userProfile.appScoped);

Trust Bootstrap

New platforms benefit from existing user reputation:
class NewMarketplace {
  async assessUserTrust(userWallet: string) {
    const reputation = await this.reputation.getReputationProfile({
      walletAddress: userWallet
    });
    
    if (reputation.global.count > 10 && reputation.global.average > 80) {
      // Trusted user - offer premium features
      return this.enablePremiumFeatures(userWallet);
    }
    
    if (reputation.global.count > 0) {
      // Some history - standard access
      return this.enableStandardAccess(userWallet);
    }
    
    // New user - require additional verification
    return this.requireVerification(userWallet);
  }
}

Reputation-Based Features

Dynamic Limits

Adjust platform limits based on reputation:
function calculateTransactionLimit(reputation: ReputationProfile): number {
  const base = 1000; // Base limit for new users
  
  if (!reputation || reputation.global.count < 3) {
    return base;
  }
  
  // Increase limit based on reputation
  const multiplier = Math.min(reputation.global.average / 50, 3); // Max 3x
  const ratingBonus = Math.min(reputation.global.count / 10, 2); // Max 2x for rating count
  
  return Math.floor(base * multiplier * ratingBonus);
}

Fee Discounts

Reward trusted users with reduced fees:
function calculateFeeDiscount(reputation: ReputationProfile): number {
  if (!reputation || reputation.global.count < 5) {
    return 0; // No discount
  }
  
  if (reputation.global.average >= 95 && reputation.global.count >= 20) {
    return 0.25; // 25% discount for excellent users
  }
  
  if (reputation.global.average >= 85 && reputation.global.count >= 10) {
    return 0.15; // 15% discount for good users
  }
  
  if (reputation.global.average >= 75) {
    return 0.05; // 5% discount for decent users
  }
  
  return 0;
}

Priority Matching

Prioritize high-reputation users:
class ServiceMatching {
  async findProvider(serviceRequest: ServiceRequest) {
    const providers = await this.getAvailableProviders(serviceRequest.category);
    
    // Load reputation for all providers
    const providersWithReputation = await Promise.all(
      providers.map(async (provider) => {
        const reputation = await this.reputation.getReputationProfile({
          walletAddress: provider.wallet
        });
        
        return {
          ...provider,
          reputation: reputation.profile?.global || { average: 0, count: 0 }
        };
      })
    );
    
    // Sort by reputation (average * log(count+1) for rating confidence)
    providersWithReputation.sort((a, b) => {
      const scoreA = a.reputation.average * Math.log(a.reputation.count + 1);
      const scoreB = b.reputation.average * Math.log(b.reputation.count + 1);
      return scoreB - scoreA;
    });
    
    return providersWithReputation;
  }
}

Privacy Considerations

Optional Reputation Display

Allow users to control reputation visibility:
interface UserSettings {
  showGlobalReputation: boolean;
  showAppSpecificReputation: boolean;
  showRatingCount: boolean;
}

function ReputationSettings({ userId }: { userId: string }) {
  const [settings, setSettings] = useState<UserSettings>({
    showGlobalReputation: true,
    showAppSpecificReputation: true,
    showRatingCount: true
  });
  
  return (
    <div className="reputation-settings">
      <h3>Reputation Privacy</h3>
      
      <label>
        <input
          type="checkbox"
          checked={settings.showGlobalReputation}
          onChange={(e) => setSettings({
            ...settings,
            showGlobalReputation: e.target.checked
          })}
        />
        Show global reputation score
      </label>
      
      <label>
        <input
          type="checkbox"
          checked={settings.showRatingCount}
          onChange={(e) => setSettings({
            ...settings,
            showRatingCount: e.target.checked
          })}
        />
        Show number of ratings received
      </label>
    </div>
  );
}

Analytics and Insights

Track reputation changes over time:
class ReputationAnalytics {
  async getReputationTrend(walletAddress: string, timeframe: string) {
    // This would require additional indexing/tracking
    const ratings = await this.getRatingsHistory(walletAddress, timeframe);
    
    const monthlyAverages = this.groupByMonth(ratings).map(month => ({
      month: month.date,
      average: month.ratings.reduce((sum, r) => sum + r.score, 0) / month.ratings.length,
      count: month.ratings.length
    }));
    
    return monthlyAverages;
  }
  
  async getPerformanceInsights(walletAddress: string) {
    const profile = await this.reputation.getReputationProfile({ walletAddress });
    
    return {
      overallTrend: this.calculateTrend(profile),
      strongestCategories: this.getTopCategories(profile),
      improvementAreas: this.getWeakestCategories(profile),
      benchmarkComparison: this.compareToBenchmark(profile)
    };
  }
}

Next Steps

Integration Examples

See how to integrate reputation into your application.

API Reference

Explore the reputation query API in detail.

Rating System

Learn how ratings build into reputation profiles.

Deal Management

Understand the foundation of the rating system.