Skip to main content

Overview

The ZKScore Score Calculator is a sophisticated smart contract that computes on-chain reputation scores based on eight distinct categories: DeFi, NFT, Social, Trading, Governance, Gaming, Identity, and Trust. The contract aggregates data from various on-chain sources and applies weighted algorithms to generate comprehensive ZKScores.
The Score Calculator contract is deployed on multiple networks. Always check the latest deployment addresses in the Deployment section before interacting with the contract.

Contract Architecture

Core Components

The Score Calculator consists of several key components:
  1. Category Calculators: Specialized modules for each of the 8 scoring categories
  2. Weight Management: Dynamic weighting system for category importance
  3. Data Aggregation: On-chain data collection and validation
  4. Score Computation: Algorithm for combining category scores
  5. Cache System: Efficient score storage and retrieval

Scoring Categories

1. DeFi Score (Weight: 20%)

Evaluates decentralized finance activity:
  • Liquidity provision
  • Lending/borrowing history
  • Protocol participation
  • Transaction volume
  • Portfolio diversity

2. NFT Score (Weight: 15%)

Measures NFT ecosystem engagement:
  • Collection ownership
  • Trading frequency
  • Rarity score
  • Creator support
  • Community participation

3. Social Score (Weight: 10%)

Assesses social platform activity:
  • Profile completeness
  • Content creation
  • Community engagement
  • Follower quality
  • Reputation signals

4. Trading Score (Weight: 20%)

Evaluates trading performance:
  • Trade volume
  • Success rate
  • Risk management
  • Protocol diversity
  • Market timing

5. Governance Score (Weight: 10%)

Measures governance participation:
  • Proposal voting
  • Delegation activity
  • Forum participation
  • Proposal creation
  • Voting power

6. Gaming Score (Weight: 10%)

Tracks gaming achievements:
  • Games played
  • Achievements earned
  • Leaderboard rankings
  • Tournament participation
  • In-game assets

7. Identity Score (Weight: 10%)

Validates identity strength:
  • Verification level
  • Account age
  • Cross-platform links
  • ENS/ZKS ID ownership
  • Attestations received

8. Trust Score (Weight: 5%)

Evaluates trustworthiness:
  • Attestations given/received
  • Reputation signals
  • Dispute history
  • Community feedback
  • Trust modules passed

Contract Addresses

Mainnet Deployments

Testnet Deployments

Scoring Algorithm

Overall Score Calculation

The total ZKScore is calculated using a weighted average of all category scores:

Score Normalization

All category scores are normalized to a 0-1000 scale:

Score Components

Each category score is composed of multiple sub-metrics:

Contract Interface

Core Functions

Events

Data Sources

On-Chain Data Collection

The Score Calculator collects data from multiple on-chain sources:

Score Updates

Automatic Updates

Scores are automatically updated when:
  1. User performs qualifying on-chain action
  2. Scheduled batch update runs (every 24 hours)
  3. User requests manual refresh
  4. Category weight changes occur

Manual Updates

Users can manually trigger score updates:

Update Costs

Gas Optimization

Caching Strategy

The contract implements efficient caching to minimize gas costs:

Batch Operations

For efficiency, the contract supports batch score calculations:

Access Control

Roles

Permission Matrix

Integration Examples

Basic Score Query

Score Update

Security Considerations

Data Validation

All input data is validated before processing:

Reentrancy Protection

All external calls are protected against reentrancy:

Best Practices

For Developers

  1. Cache Scores: Cache scores locally to minimize gas costs
  2. Batch Queries: Use batch functions when querying multiple users
  3. Monitor Events: Listen for score update events
  4. Validate Input: Always validate user addresses before queries
  5. Handle Errors: Implement comprehensive error handling

For Users

  1. Update Regularly: Keep scores updated for accuracy
  2. Understand Categories: Know how each category contributes
  3. Monitor Changes: Track score changes over time
  4. Optimize Activity: Focus on high-weight categories
  5. Verify Data: Cross-check scores with on-chain data