Skip to main content
GET
/
referral
/
{wallet_address}
curl -X GET "https://api.strike.markets/referral/0x742d35cc6C6C7532B1140Da4C8A2f6C8ECfC9B46"
{
  "code": "TRADER123",
  "referralLink": "https://strike.markets?ref=TRADER123",
  "totalReferrals": 47,
  "totalCommissions": "2847.65",
  "networkStats": {
    "tier1": 47,
    "tier2": 123,
    "tier3": 89
  }
}
curl -X GET "https://api.strike.markets/referral/0x742d35cc6C6C7532B1140Da4C8A2f6C8ECfC9B46"
{
  "code": "TRADER123",
  "referralLink": "https://strike.markets?ref=TRADER123",
  "totalReferrals": 47,
  "totalCommissions": "2847.65",
  "networkStats": {
    "tier1": 47,
    "tier2": 123,
    "tier3": 89
  }
}

Overview

Get comprehensive referral network statistics for a wallet address, including referral code, network size, commission earnings, and multi-tier network breakdown. This endpoint provides all the data needed to understand referral performance and network growth.
This endpoint does NOT require authentication and provides public referral statistics for any wallet address.

Path Parameters

wallet_address
string
required
Ethereum wallet address to retrieve referral statistics for.Format: 42-character hex string starting with “0x”
Example: “0x742d35cc6C6C7532B1140Da4C8A2f6C8ECfC9B46”

Response Fields

code
string
User’s active referral code (custom or system-generated)
Complete referral link for sharing with potential referrals
totalReferrals
integer
Total number of direct referrals (Tier 1)
totalCommissions
string
Total commission earnings in USD from the referral network
networkStats
object
Breakdown of referral network by tiers

Referral Network Structure

Multi-Tier System

Strike Protocol operates a multi-tier referral system where you earn commissions from multiple levels of your network:

Tier 1 (Direct Referrals)

  • Definition: Users who registered using your referral code
  • Commission rate: Highest percentage of their trading fees
  • Relationship: Direct referral relationship
  • Impact: Your primary source of referral income

Tier 2 (Sub-Referrals)

  • Definition: Users referred by your Tier 1 referrals
  • Commission rate: Lower percentage than Tier 1
  • Relationship: Indirect referral through your network
  • Growth: Exponential network expansion potential

Tier 3 (Sub-Sub-Referrals)

  • Definition: Users referred by your Tier 2 referrals
  • Commission rate: Lowest percentage but widest reach
  • Relationship: Third-degree referral connection
  • Scale: Can grow to very large numbers

Network Growth Example

You (Referrer)
├── Alice (Tier 1) - Used your code "TRADER123"
│   ├── Bob (Tier 2) - Used Alice's code  
│   └── Carol (Tier 2) - Used Alice's code
│       └── Dave (Tier 3) - Used Carol's code
├── Eve (Tier 1) - Used your code "TRADER123"
└── Frank (Tier 1) - Used your code "TRADER123"
    ├── Grace (Tier 2) - Used Frank's code
    └── Henry (Tier 2) - Used Frank's code
        ├── Ivy (Tier 3) - Used Henry's code
        └── Jack (Tier 3) - Used Henry's code
Network Stats:
  • Tier 1: 3 (Alice, Eve, Frank)
  • Tier 2: 4 (Bob, Carol, Grace, Henry)
  • Tier 3: 3 (Dave, Ivy, Jack)
  • Total Network: 10 people

Commission Structure

Commission Rates (Approximate)

  • Tier 1: 30-50% of trading fees from direct referrals
  • Tier 2: 10-20% of trading fees from sub-referrals
  • Tier 3: 5-10% of trading fees from sub-sub-referrals

Commission Calculation

Total Commissions = (Tier 1 Volume × Tier 1 Rate) + 
                   (Tier 2 Volume × Tier 2 Rate) + 
                   (Tier 3 Volume × Tier 3 Rate)

Payment Schedule

  • Real-time tracking: Commissions updated continuously
  • Payment frequency: Varies by program structure
  • Minimum thresholds: May have minimum payout amounts
  • Lifetime earnings: Commissions continue indefinitely

Use Cases

Performance Tracking

  • Monitor network growth: Track how your referral network is expanding
  • Measure success: Evaluate effectiveness of marketing efforts
  • Income planning: Understand your referral income potential
  • Goal setting: Set targets for network growth and earnings

Network Analysis

  • Tier performance: See which tiers are growing fastest
  • Referral quality: Analyze the activity level of your network
  • Growth patterns: Understand how your network expands over time
  • Optimization: Focus efforts on most effective referral strategies

Marketing Strategy

  • ROI measurement: Calculate return on referral marketing investment
  • Channel effectiveness: Track which marketing channels drive referrals
  • Content performance: See what content generates the most referrals
  • Audience insights: Understand who your referrals are referring

Error Responses

400 Bad Request
object
Invalid wallet address format
{
  "error": 400,
  "message": "Invalid wallet address format"
}
404 Not Found
object
Wallet address not found in referral system
{
  "error": 404,
  "message": "No referral data found for this wallet address"
}
This means the wallet has not:
  • Set up a referral code
  • Registered with anyone’s referral code
  • Participated in the referral program

Usage Examples

Basic Referral Stats

async function getReferralStats(walletAddress) {
  try {
    const response = await fetch(`https://api.strike.markets/referral/${walletAddress}`);
    
    if (response.status === 404) {
      return {
        hasReferralProgram: false,
        message: "User is not participating in the referral program"
      };
    }
    
    if (!response.ok) {
      throw new Error(`HTTP ${response.status}: ${response.statusText}`);
    }
    
    const data = await response.json();
    
    return {
      hasReferralProgram: true,
      code: data.code,
      referralLink: data.referralLink,
      directReferrals: data.totalReferrals,
      totalEarnings: parseFloat(data.totalCommissions),
      networkSize: data.networkStats.tier1 + data.networkStats.tier2 + data.networkStats.tier3,
      networkBreakdown: data.networkStats
    };
  } catch (error) {
    console.error('Failed to fetch referral stats:', error);
    throw error;
  }
}

// Usage
const stats = await getReferralStats("0x742d35cc6C6C7532B1140Da4C8A2f6C8ECfC9B46");

if (stats.hasReferralProgram) {
  console.log(`Referral Code: ${stats.code}`);
  console.log(`Direct Referrals: ${stats.directReferrals}`);
  console.log(`Total Network: ${stats.networkSize} people`);
  console.log(`Total Earnings: $${stats.totalEarnings}`);
} else {
  console.log("User not in referral program");
}

Network Growth Analysis

class ReferralAnalytics {
  constructor() {
    this.historical = [];
  }
  
  async trackGrowth(walletAddress) {
    try {
      const stats = await getReferralStats(walletAddress);
      
      if (!stats.hasReferralProgram) {
        return null;
      }
      
      const snapshot = {
        timestamp: Date.now(),
        date: new Date().toISOString().split('T')[0],
        ...stats
      };
      
      this.historical.push(snapshot);
      
      return this.analyzeGrowth();
    } catch (error) {
      console.error('Failed to track growth:', error);
      return null;
    }
  }
  
  analyzeGrowth() {
    if (this.historical.length < 2) {
      return { message: "Need more data points for growth analysis" };
    }
    
    const latest = this.historical[this.historical.length - 1];
    const previous = this.historical[this.historical.length - 2];
    
    const timeDiff = (latest.timestamp - previous.timestamp) / (1000 * 60 * 60 * 24); // days
    
    const referralGrowth = latest.directReferrals - previous.directReferrals;
    const networkGrowth = latest.networkSize - previous.networkSize;
    const earningsGrowth = latest.totalEarnings - previous.totalEarnings;
    
    return {
      period: `${timeDiff.toFixed(1)} days`,
      growth: {
        directReferrals: referralGrowth,
        totalNetwork: networkGrowth,
        earnings: earningsGrowth
      },
      rates: {
        referralsPerDay: referralGrowth / timeDiff,
        networkGrowthPerDay: networkGrowth / timeDiff,
        earningsPerDay: earningsGrowth / timeDiff
      },
      trends: this.identifyTrends()
    };
  }
  
  identifyTrends() {
    if (this.historical.length < 3) return [];
    
    const trends = [];
    const recent = this.historical.slice(-3);
    
    // Check referral growth trend
    const referralGrowths = [];
    for (let i = 1; i < recent.length; i++) {
      referralGrowths.push(recent[i].directReferrals - recent[i-1].directReferrals);
    }
    
    if (referralGrowths.every(g => g > 0)) {
      trends.push('ACCELERATING_REFERRALS');
    } else if (referralGrowths.every(g => g === 0)) {
      trends.push('STAGNANT_REFERRALS');
    }
    
    // Check earnings growth
    const earningsGrowths = [];
    for (let i = 1; i < recent.length; i++) {
      earningsGrowths.push(recent[i].totalEarnings - recent[i-1].totalEarnings);
    }
    
    const avgEarningsGrowth = earningsGrowths.reduce((a, b) => a + b, 0) / earningsGrowths.length;
    
    if (avgEarningsGrowth > 50) { // 50+ USD average daily growth
      trends.push('HIGH_EARNINGS_GROWTH');
    } else if (avgEarningsGrowth < 5) {
      trends.push('LOW_EARNINGS_GROWTH');
    }
    
    return trends;
  }
  
  generateReport() {
    if (this.historical.length === 0) {
      return { error: "No historical data available" };
    }
    
    const latest = this.historical[this.historical.length - 1];
    const first = this.historical[0];
    
    const totalGrowthPeriod = (latest.timestamp - first.timestamp) / (1000 * 60 * 60 * 24);
    
    return {
      summary: {
        trackingPeriod: `${totalGrowthPeriod.toFixed(1)} days`,
        currentStats: latest,
        totalGrowth: {
          referrals: latest.directReferrals - first.directReferrals,
          network: latest.networkSize - first.networkSize,
          earnings: latest.totalEarnings - first.totalEarnings
        }
      },
      performance: this.calculatePerformanceMetrics(),
      recommendations: this.generateRecommendations()
    };
  }
  
  calculatePerformanceMetrics() {
    if (this.historical.length < 2) return null;
    
    const latest = this.historical[this.historical.length - 1];
    
    // Network leverage: how well direct referrals create sub-referrals
    const networkLeverage = latest.networkSize > 0 ? 
      (latest.networkBreakdown.tier2 + latest.networkBreakdown.tier3) / latest.networkBreakdown.tier1 : 0;
    
    // Earnings per referral
    const earningsPerReferral = latest.directReferrals > 0 ? 
      latest.totalEarnings / latest.directReferrals : 0;
    
    // Network depth: how deep the referral tree goes
    const tier2Ratio = latest.networkSize > 0 ? 
      latest.networkBreakdown.tier2 / latest.networkSize : 0;
    const tier3Ratio = latest.networkSize > 0 ? 
      latest.networkBreakdown.tier3 / latest.networkSize : 0;
    
    return {
      networkLeverage: networkLeverage.toFixed(2),
      earningsPerReferral: earningsPerReferral.toFixed(2),
      networkDepth: {
        tier1Percentage: (latest.networkBreakdown.tier1 / latest.networkSize * 100).toFixed(1),
        tier2Percentage: (tier2Ratio * 100).toFixed(1),
        tier3Percentage: (tier3Ratio * 100).toFixed(1)
      },
      efficiency: this.calculateEfficiency()
    };
  }
  
  calculateEfficiency() {
    // Efficiency metrics based on network structure and earnings
    const latest = this.historical[this.historical.length - 1];
    
    let score = 0;
    const factors = [];
    
    // High direct referral count
    if (latest.directReferrals > 20) {
      score += 25;
      factors.push('Strong direct referral base');
    }
    
    // Good network leverage (sub-referrals per direct referral)
    const networkLeverage = latest.directReferrals > 0 ? 
      (latest.networkBreakdown.tier2 + latest.networkBreakdown.tier3) / latest.networkBreakdown.tier1 : 0;
    
    if (networkLeverage > 2) {
      score += 25;
      factors.push('Excellent network multiplication');
    } else if (networkLeverage > 1) {
      score += 15;
      factors.push('Good network growth');
    }
    
    // Strong earnings
    if (latest.totalEarnings > 1000) {
      score += 25;
      factors.push('High total earnings');
    } else if (latest.totalEarnings > 100) {
      score += 15;
      factors.push('Solid earnings base');
    }
    
    // Active tier 3 network
    if (latest.networkBreakdown.tier3 > 10) {
      score += 25;
      factors.push('Deep network penetration');
    } else if (latest.networkBreakdown.tier3 > 0) {
      score += 10;
      factors.push('Growing network depth');
    }
    
    let rating = 'POOR';
    if (score >= 80) rating = 'EXCELLENT';
    else if (score >= 60) rating = 'GOOD';
    else if (score >= 40) rating = 'AVERAGE';
    else if (score >= 20) rating = 'FAIR';
    
    return {
      score,
      rating,
      factors
    };
  }
  
  generateRecommendations() {
    const latest = this.historical[this.historical.length - 1];
    const recommendations = [];
    
    if (latest.directReferrals < 10) {
      recommendations.push({
        priority: 'HIGH',
        action: 'Focus on acquiring direct referrals',
        reason: 'Low direct referral count limits network growth potential'
      });
    }
    
    const networkLeverage = latest.directReferrals > 0 ? 
      (latest.networkBreakdown.tier2 + latest.networkBreakdown.tier3) / latest.networkBreakdown.tier1 : 0;
    
    if (networkLeverage < 1) {
      recommendations.push({
        priority: 'MEDIUM',
        action: 'Encourage direct referrals to recruit their own referrals',
        reason: 'Network leverage is low - referrals are not recruiting sub-referrals'
      });
    }
    
    if (latest.networkBreakdown.tier3 === 0) {
      recommendations.push({
        priority: 'MEDIUM',
        action: 'Develop tier 2 referral engagement strategies',
        reason: 'No tier 3 network indicates limited network depth'
      });
    }
    
    const earningsPerReferral = latest.directReferrals > 0 ? 
      latest.totalEarnings / latest.directReferrals : 0;
    
    if (earningsPerReferral < 10) {
      recommendations.push({
        priority: 'LOW',
        action: 'Focus on referring active traders',
        reason: 'Low earnings per referral suggests inactive referrals'
      });
    }
    
    return recommendations;
  }
}

// Usage
const analytics = new ReferralAnalytics();

// Track growth over time (call periodically)
setInterval(async () => {
  await analytics.trackGrowth(walletAddress);
}, 24 * 60 * 60 * 1000); // Daily tracking

// Generate comprehensive report
const report = analytics.generateReport();
console.log('Referral Performance Report:', report);

Referral Leaderboard

async function createReferralLeaderboard(walletAddresses) {
  const leaderboard = [];
  
  for (const address of walletAddresses) {
    try {
      const stats = await getReferralStats(address);
      
      if (stats.hasReferralProgram) {
        leaderboard.push({
          address: address,
          code: stats.code,
          directReferrals: stats.directReferrals,
          totalNetwork: stats.networkSize,
          earnings: stats.totalEarnings,
          networkLeverage: stats.networkSize / stats.directReferrals
        });
      }
    } catch (error) {
      console.error(`Failed to get stats for ${address}:`, error);
    }
  }
  
  // Sort by total earnings (descending)
  leaderboard.sort((a, b) => b.earnings - a.earnings);
  
  return leaderboard.map((entry, index) => ({
    rank: index + 1,
    ...entry
  }));
}

// Usage
const topAddresses = [
  "0x742d35cc6C6C7532B1140Da4C8A2f6C8ECfC9B46",
  "0x1234567890123456789012345678901234567890",
  // ... more addresses
];

const leaderboard = await createReferralLeaderboard(topAddresses);
console.log('Top Referral Performers:', leaderboard.slice(0, 10));

Commission Tracker

class CommissionTracker {
  constructor(walletAddress) {
    this.walletAddress = walletAddress;
    this.snapshots = [];
  }
  
  async takeSnapshot() {
    try {
      const stats = await getReferralStats(this.walletAddress);
      
      if (!stats.hasReferralProgram) {
        return null;
      }
      
      const snapshot = {
        timestamp: Date.now(),
        date: new Date().toISOString(),
        totalCommissions: stats.totalEarnings,
        networkStats: stats.networkBreakdown,
        networkSize: stats.networkSize
      };
      
      this.snapshots.push(snapshot);
      
      // Keep only last 30 days of snapshots
      const thirtyDaysAgo = Date.now() - (30 * 24 * 60 * 60 * 1000);
      this.snapshots = this.snapshots.filter(s => s.timestamp > thirtyDaysAgo);
      
      return snapshot;
    } catch (error) {
      console.error('Failed to take commission snapshot:', error);
      return null;
    }
  }
  
  getCommissionTrend(days = 7) {
    if (this.snapshots.length < 2) {
      return { message: "Insufficient data for trend analysis" };
    }
    
    const cutoff = Date.now() - (days * 24 * 60 * 60 * 1000);
    const recentSnapshots = this.snapshots
      .filter(s => s.timestamp > cutoff)
      .sort((a, b) => a.timestamp - b.timestamp);
    
    if (recentSnapshots.length < 2) {
      return { message: "Insufficient recent data" };
    }
    
    const first = recentSnapshots[0];
    const last = recentSnapshots[recentSnapshots.length - 1];
    
    const commissionGrowth = last.totalCommissions - first.totalCommissions;
    const timePeriod = (last.timestamp - first.timestamp) / (1000 * 60 * 60 * 24);
    
    const dailyAverage = commissionGrowth / timePeriod;
    
    // Calculate trend direction
    let trend = 'STABLE';
    if (commissionGrowth > 0) {
      trend = 'GROWING';
    } else if (commissionGrowth < 0) {
      trend = 'DECLINING';
    }
    
    return {
      period: `${days} days`,
      totalGrowth: commissionGrowth.toFixed(2),
      dailyAverage: dailyAverage.toFixed(2),
      trend: trend,
      projectedMonthly: (dailyAverage * 30).toFixed(2),
      projectedAnnual: (dailyAverage * 365).toFixed(2)
    };
  }
  
  getTopPerformingTiers() {
    if (this.snapshots.length < 2) {
      return null;
    }
    
    const latest = this.snapshots[this.snapshots.length - 1];
    const previous = this.snapshots[this.snapshots.length - 2];
    
    const tierGrowth = {
      tier1: latest.networkStats.tier1 - previous.networkStats.tier1,
      tier2: latest.networkStats.tier2 - previous.networkStats.tier2,
      tier3: latest.networkStats.tier3 - previous.networkStats.tier3
    };
    
    // Estimate commission contribution by tier (approximate)
    const commissionGrowth = latest.totalCommissions - previous.totalCommissions;
    const totalNetworkGrowth = tierGrowth.tier1 + tierGrowth.tier2 + tierGrowth.tier3;
    
    if (totalNetworkGrowth === 0) {
      return { message: "No network growth in this period" };
    }
    
    // Approximate commission weights (higher tiers contribute more per person)
    const weightedGrowth = {
      tier1: tierGrowth.tier1 * 3, // Direct referrals worth 3x
      tier2: tierGrowth.tier2 * 1.5, // Tier 2 worth 1.5x
      tier3: tierGrowth.tier3 * 1 // Tier 3 base weight
    };
    
    const totalWeightedGrowth = Object.values(weightedGrowth).reduce((a, b) => a + b, 0);
    
    if (totalWeightedGrowth === 0) {
      return { message: "No weighted growth to analyze" };
    }
    
    return {
      tier1: {
        count: tierGrowth.tier1,
        contribution: (weightedGrowth.tier1 / totalWeightedGrowth * 100).toFixed(1) + '%',
        estimatedCommissions: (commissionGrowth * weightedGrowth.tier1 / totalWeightedGrowth).toFixed(2)
      },
      tier2: {
        count: tierGrowth.tier2,
        contribution: (weightedGrowth.tier2 / totalWeightedGrowth * 100).toFixed(1) + '%',
        estimatedCommissions: (commissionGrowth * weightedGrowth.tier2 / totalWeightedGrowth).toFixed(2)
      },
      tier3: {
        count: tierGrowth.tier3,
        contribution: (weightedGrowth.tier3 / totalWeightedGrowth * 100).toFixed(1) + '%',
        estimatedCommissions: (commissionGrowth * weightedGrowth.tier3 / totalWeightedGrowth).toFixed(2)
      }
    };
  }
}

// Usage
const tracker = new CommissionTracker(walletAddress);

// Take regular snapshots
setInterval(() => {
  tracker.takeSnapshot();
}, 4 * 60 * 60 * 1000); // Every 4 hours

// Analyze trends
const weeklyTrend = tracker.getCommissionTrend(7);
console.log('Weekly Commission Trend:', weeklyTrend);

const tierPerformance = tracker.getTopPerformingTiers();
console.log('Tier Performance:', tierPerformance);

Integration Best Practices

Data Refresh Strategy

  • Cache duration: Cache stats for 5-10 minutes to reduce API calls
  • Update triggers: Refresh after referral-related actions
  • Background updates: Periodically refresh for active users
  • Error handling: Gracefully handle API failures

Performance Optimization

class ReferralStatsCache {
  constructor(ttl = 300000) { // 5 minute TTL
    this.cache = new Map();
    this.ttl = ttl;
  }
  
  async getStats(walletAddress) {
    const key = `stats_${walletAddress}`;
    const cached = this.cache.get(key);
    
    if (cached && Date.now() - cached.timestamp < this.ttl) {
      return cached.data;
    }
    
    const data = await getReferralStats(walletAddress);
    
    this.cache.set(key, {
      data,
      timestamp: Date.now()
    });
    
    return data;
  }
  
  invalidate(walletAddress) {
    const key = `stats_${walletAddress}`;
    this.cache.delete(key);
  }
}

Privacy and Security

  • Public data: Remember that referral stats are publicly accessible
  • Sensitive information: Don’t expose personal wallet details
  • Rate limiting: Implement client-side rate limiting for bulk requests
  • Error handling: Don’t expose internal system details in errors
Use referral statistics to optimize your marketing efforts. Focus on strategies that generate not just direct referrals, but referrals who also recruit others (high network leverage).
Referral statistics are updated in real-time as your network grows and generates trading activity. Commission earnings may have a slight delay due to trade settlement processing.

Path Parameters

wallet_address
string
required

Ethereum wallet address

Response

200 - application/json

Referral statistics retrieved successfully

code
string
totalReferrals
integer
totalCommissions
string
networkStats
object