DocumentationapiFairScore API

FairScore API

Endpoints for querying FairScore data.

Get FairScore

Get the FairScore for a wallet.

GET /api/fairscore/:address

Response

{
  "wallet": "7xKXtg2C...",
  "score": 78,
  "tier": "gold",
  "components": {
    "activeDays": 75,
    "social": 80,
    "transactionHistory": 70,
    "governanceParticipation": 85
  },
  "lastUpdated": "2024-02-28T00:00:00Z",
  "updateCount": 12
}

Get Score History

Get historical score records.

GET /api/fairscore/:address/history

Query Parameters

Maximum results.

Response

{
  "wallet": "7xKXtg2C...",
  "history": [
    {
      "score": 78,
      "timestamp": "2024-02-28T00:00:00Z",
      "change": 3
    },
    {
      "score": 75,
      "timestamp": "2024-02-21T00:00:00Z",
      "change": 2
    }
  ],
  "total": 12
}

Get Score Breakdown

Get detailed score breakdown with weights.

GET /api/fairscore/:address/breakdown

Response

{
  "wallet": "7xKXtg2C...",
  "compositeScore": 78,
  "breakdown": [
    {
      "component": "activeDays",
      "score": 75,
      "weight": 0.20,
      "weighted": 15.0
    },
    {
      "component": "social",
      "score": 80,
      "weight": 0.30,
      "weighted": 24.0
    },
    {
      "component": "transactionHistory",
      "score": 70,
      "weight": 0.20,
      "weighted": 14.0
    },
    {
      "component": "governanceParticipation",
      "score": 85,
      "weight": 0.30,
      "weighted": 25.5
    }
  ],
  "total": 78.5
}

Batch Get Scores

Get scores for multiple wallets.

POST /api/fairscore/batch

Request Body

{
  "addresses": [
    "7xKXtg2C...",
    "9qYw2hGx...",
    "3zBp7kMm..."
  ]
}

Response

{
  "scores": [
    {
      "wallet": "7xKXtg2C...",
      "score": 78,
      "tier": "gold"
    },
    {
      "wallet": "9qYw2hGx...",
      "score": 92,
      "tier": "platinum"
    }
  ]
}

Get Tier Requirements

Get tier thresholds and requirements.

GET /api/fairscore/tiers

Response

{
  "tiers": [
    {
      "name": "platinum",
      "minScore": 85,
      "maxScore": 100,
      "canSubmitStandard": true,
      "canSubmitExpedited": true,
      "canSubmitEmergency": true,
      "timeLockHours": 24,
      "delegationMultiplier": 1.5
    },
    {
      "name": "gold",
      "minScore": 70,
      "maxScore": 84,
      "canSubmitStandard": true,
      "canSubmitExpedited": false,
      "canSubmitEmergency": false,
      "timeLockHours": 48,
      "delegationMultiplier": 1.25
    }
  ]
}

Calculate Voting Power

Calculate voting power for given parameters.

POST /api/fairscore/calculate-power

Request Body

{
  "tokenBalance": 10000,
  "fairscore": 78
}

Response

{
  "tokenBalance": 10000,
  "fairscore": 78,
  "quadraticBase": 100,
  "reputationMultiplier": 2.56,
  "totalPower": 256,
  "formula": "votingPower = √(tokens) × (1 + fairscore/50)"
}