> ## 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.

# Getting Started

> Complete guide to getting started with ZKScore

## Overview

ZKScore is a decentralized reputation system that calculates on-chain reputation scores across multiple categories. This guide will help you get started with ZKScore.

## What is ZKScore?

ZKScore aggregates on-chain activity across 8 categories to create a comprehensive reputation score (0-1000):

* **DeFi** (20%): Lending, borrowing, liquidity provision
* **NFT** (15%): Trading, collecting, creation
* **Social** (10%): Community engagement
* **Trading** (20%): Trading performance
* **Governance** (10%): DAO participation
* **Gaming** (10%): Gaming achievements
* **Identity** (10%): Verification level
* **Trust** (5%): Attestations received

## Quick Start

### 1. Get an API Key

1. Visit [app.onzks.com](https://app.onzks.com)
2. Connect your wallet
3. Create an API key
4. Copy your API key for use in applications

### 2. Install SDK

<CodeGroup>
  ```bash Bash theme={null}
  npm install @zkscore/sdk
  ```

  ```bash Bash theme={null}
  yarn add @zkscore/sdk
  ```

  ```bash Bash theme={null}
  pnpm add @zkscore/sdk
  ```
</CodeGroup>

### 3. Basic Usage

<CodeGroup>
  ```javascript JavaScript theme={null}
  import { ZKScoreClient } from '@zkscore/sdk';

  const client = new ZKScoreClient({
    apiKey: 'your_api_key_here',
    environment: 'mainnet'
  });

  // Get user score
  const score = await client.getScore('alice.zks');
  console.log('Score:', score.total);

  // Get score breakdown
  const breakdown = await client.getScoreBreakdown('alice.zks');
  console.log('DeFi score:', breakdown.defi);
  ```

  ```python Python theme={null}
  from zkscore import ZKScoreClient

  client = ZKScoreClient(
      api_key='your_api_key_here',
      environment='mainnet'
  )

  # Get user score
  score = await client.get_score('alice.zks')
  print(f'Score: {score["total"]}')

  # Get score breakdown
  breakdown = await client.get_score_breakdown('alice.zks')
  print(f'DeFi score: {breakdown["defi"]}')
  ```
</CodeGroup>

## Identity System

### ZKS IDs

ZKScore uses human-readable identifiers called ZKS IDs (e.g., `alice.zks`) that automatically resolve to wallet addresses.

### Minting Identity

<CodeGroup>
  ```javascript JavaScript theme={null}
  // Check if ZKS ID is available
  const isAvailable = await client.checkZKSIdAvailability('alice.zks');
  console.log('Available:', isAvailable);

  // Mint identity (requires wallet connection)
  const result = await client.mintIdentity({
    zksId: 'alice.zks',
    displayName: 'Alice Smith',
    avatarUrl: 'https://example.com/avatar.jpg'
  });
  console.log('Identity minted:', result.transactionHash);
  ```
</CodeGroup>

### Activating Identity

<CodeGroup>
  ```javascript JavaScript theme={null}
  // Activate identity to enable full functionality
  const result = await client.activateIdentity();
  console.log('Identity activated:', result.transactionHash);
  ```
</CodeGroup>

## Score System

### Getting Scores

<CodeGroup>
  ```javascript JavaScript theme={null}
  // Get total score
  const score = await client.getScore('alice.zks');
  console.log('Total score:', score.total);

  // Get detailed breakdown
  const breakdown = await client.getScoreBreakdown('alice.zks');
  console.log('Category scores:', breakdown);

  // Get score history
  const history = await client.getScoreHistory('alice.zks');
  console.log('Score history:', history);
  ```
</CodeGroup>

### Score Categories

<CodeGroup>
  ```javascript JavaScript theme={null}
  const breakdown = await client.getScoreBreakdown('alice.zks');

  console.log('DeFi Score:', breakdown.defi);
  console.log('NFT Score:', breakdown.nft);
  console.log('Social Score:', breakdown.social);
  console.log('Trading Score:', breakdown.trading);
  console.log('Governance Score:', breakdown.governance);
  console.log('Gaming Score:', breakdown.gaming);
  console.log('Identity Score:', breakdown.identity);
  console.log('Trust Score:', breakdown.trust);
  ```
</CodeGroup>

## Achievement System

### Getting Achievements

<CodeGroup>
  ```javascript JavaScript theme={null}
  // Get user achievements
  const achievements = await client.getAchievements('alice.zks');
  console.log('Achievements:', achievements);

  // Get available achievements
  const available = await client.listAchievements();
  console.log('Available achievements:', available);
  ```
</CodeGroup>

### Claiming Achievements

<CodeGroup>
  ```javascript JavaScript theme={null}
  // Check if user can claim achievement
  const canClaim = await client.canClaimAchievement('alice.zks', 'achievement-id');
  if (canClaim) {
    const result = await client.claimAchievement('alice.zks', 'achievement-id');
    console.log('Achievement claimed:', result.transactionHash);
  }
  ```
</CodeGroup>

## Trading Data

### Trading Statistics

<CodeGroup>
  ```javascript JavaScript theme={null}
  // Get trading stats
  const stats = await client.getTradingStats('alice.zks');
  console.log('Total volume:', stats.totalVolume);
  console.log('Win rate:', stats.winRate);

  // Get trading history
  const history = await client.getTradingHistory('alice.zks');
  console.log('Trading history:', history);
  ```
</CodeGroup>

### Trading Leaderboard

<CodeGroup>
  ```javascript JavaScript theme={null}
  // Get trading leaderboard
  const leaderboard = await client.getTradingLeaderboard({
    period: '30d',
    limit: 100
  });
  console.log('Top traders:', leaderboard);
  ```
</CodeGroup>

## Trust Layer

### Attestations

<CodeGroup>
  ```javascript JavaScript theme={null}
  // Get user attestations
  const attestations = await client.getAttestations('alice.zks');
  console.log('Attestations:', attestations);

  // Create attestation
  const result = await client.createAttestation({
    recipient: 'bob.zks',
    schema: 'skill-verification',
    data: {
      skill: 'Solidity Development',
      level: 5
    }
  });
  console.log('Attestation created:', result.transactionHash);
  ```
</CodeGroup>

## Error Handling

### Common Errors

<CodeGroup>
  ```javascript JavaScript theme={null}
  try {
    const score = await client.getScore('alice.zks');
    console.log('Score:', score.total);
  } catch (error) {
    if (error.code === 'IDENTITY_NOT_FOUND') {
      console.error('User has no identity');
    } else if (error.code === 'SCORE_NOT_FOUND') {
      console.error('User has no score yet');
    } else {
      console.error('Error:', error.message);
    }
  }
  ```
</CodeGroup>

## Best Practices

1. **Always Handle Errors**: Implement proper error handling
2. **Use ZKS IDs**: Prefer ZKS IDs over wallet addresses
3. **Cache Data**: Cache frequently accessed data
4. **Monitor Rate Limits**: Stay within API rate limits
5. **Test Thoroughly**: Test with different user scenarios

## Next Steps

* [API Reference](/api-reference/introduction)
* [JavaScript SDK](/sdk/javascript/getting-started)
* [React SDK](/sdk/react/getting-started)
* [Smart Contracts](/contracts/introduction)
