Skip to main content

Documentation Index

Fetch the complete documentation index at: https://core.anylayer.org/llms.txt

Use this file to discover all available pages before exploring further.

Overview

This guide presents common integration patterns for ZKScore, including authentication flows, score displays, achievement tracking, and trust verification.

Pattern 1: Authentication Flow

async function authenticateWithZKScore(walletAddress) {
  // Get user's ZKS ID
  const identity = await zkScore.getIdentity(walletAddress);
  
  // Get score
  const score = await zkScore.getScore(walletAddress);
  
  // Check minimum requirements
  if (score.total < 100) {
    throw new Error('Minimum score not met');
  }
  
  // Create session
  return createSession({
    address: walletAddress,
    zksId: identity.name,
    score: score.total
  });
}

Pattern 2: Real-time Score Display

import { useScore } from '@zkscore/sdk-react';

function ScoreDisplay({ identity }) {
  const { data: score, loading } = useScore(identity, { realTime: true });
  
  if (loading) return <div>Loading...</div>;
  
  return <div>Score: {score?.total || 0}</div>;
}

Best Practices

  1. Caching: Cache scores to reduce API calls
  2. Real-time Updates: Use WebSocket for live data
  3. Error Handling: Handle all edge cases
  4. User Experience: Provide clear feedback