Skip to content

๐Ÿ† XP & Achievements System โ€‹

Track your learning progress with our gamified XP and achievements system! Earn points, unlock badges, and see how you rank.

Overview โ€‹

The leaderboard system provides:

  • XP Tracking - Earn points for completing tutorials and challenges
  • Achievements - 8 unique badges to unlock
  • Progress Visualization - See your learning journey
  • Leaderboard - Compare with other developers

Quick Commands โ€‹

bash
# View your current XP and rank
npm run progress

# View all achievements (locked & unlocked)
npm run achievements

# View the global leaderboard
npm run quest:leaderboard

XP System โ€‹

How to Earn XP โ€‹

ActivityXP Reward
Complete a tutorial100-500 XP
Pass a test suite50 XP per test
Build a working example75 XP
Complete playground quest100-200 XP
Unlock achievementBonus 50-200 XP

Rank Progression โ€‹

RankXP RequiredTitle
๐Ÿฅ‰0Novice Developer
๐Ÿฅˆ500Apprentice Builder
๐Ÿฅ‡1,000Transaction Crafter
๐Ÿ’Ž2,000Token Master
๐Ÿ‘‘5,000Contract Wizard
๐Ÿ†10,000Ergo Legend

Achievements โ€‹

๐ŸŽฏ Available Achievements โ€‹

๐Ÿš€ First Transaction โ€‹

Build your first valid transaction

Requirement: Complete Tutorial 1
Reward: 100 XP + Badge


๐Ÿช™ Token Handler โ€‹

Successfully transfer tokens

Requirement: Complete Tutorial 2
Reward: 150 XP + Badge


๐ŸŽจ NFT Creator โ€‹

Mint your first NFT

Requirement: Complete Tutorial 3
Reward: 200 XP + Badge


๐Ÿ“œ Contract Interactor โ€‹

Interact with a smart contract

Requirement: Complete Tutorial 4
Reward: 250 XP + Badge


๐Ÿงช Test Master โ€‹

Pass all 86 tests

Requirement: Run npm test with 100% pass rate
Reward: 500 XP + Badge


๐ŸŒ Testnet Explorer โ€‹

Connect to Ergo testnet

Requirement: Successfully fetch UTXOs from testnet
Reward: 150 XP + Badge


๐ŸŽฎ Playground Champion โ€‹

Complete all playground quests

Requirement: Finish all 8 arena quests
Reward: 300 XP + Badge


๐Ÿ‘‘ Ergo Master โ€‹

Complete everything!

Requirement: All tutorials + all tests + all quests
Reward: 1000 XP + Badge

Using the API โ€‹

Check XP Progress โ€‹

typescript
import { Leaderboard } from "../src/leaderboard";

const leaderboard = new Leaderboard();
const username = "developer123";

// Get user progress
const progress = leaderboard.getProgress(username);

console.log(`XP: ${progress.xp}`);
console.log(`Rank: ${progress.rank}`);
console.log(`Achievements: ${progress.achievements.length}`);

Award XP โ€‹

typescript
// Award XP for completing a task
leaderboard.awardXP(username, 100, "Completed Tutorial 1");

// Award achievement
leaderboard.unlockAchievement(username, "first_transaction");

View Leaderboard โ€‹

typescript
// Get top 10 users
const topUsers = leaderboard.getTopUsers(10);

topUsers.forEach((user, index) => {
  console.log(`${index + 1}. ${user.name}: ${user.xp} XP`);
});

Progress File โ€‹

Your progress is stored locally in .fleet-progress.json:

json
{
  "username": "developer123",
  "xp": 850,
  "rank": "Transaction Crafter",
  "achievements": [
    {
      "id": "first_transaction",
      "name": "First Transaction",
      "unlockedAt": "2025-01-15T10:30:00Z"
    }
  ],
  "completedTutorials": [1, 2],
  "testsPass": 86,
  "lastActive": "2025-01-15T14:45:00Z"
}

Displaying Progress โ€‹

Terminal Output โ€‹

bash
$ npm run progress

๐Ÿ† Fleet SDK Progress
โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”

๐Ÿ‘ค Developer: developer123
โญ XP: 850 / 1000
๐ŸŽ–๏ธ Rank: ๐Ÿฅˆ Apprentice Builder
๐Ÿ“Š Progress: โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–‘โ–‘ 85%

๐Ÿ… Achievements: 3/8
  โœ… First Transaction
  โœ… Token Handler  
  โœ… NFT Creator
  โฌœ Contract Interactor
  โฌœ Test Master
  โฌœ Testnet Explorer
  โฌœ Playground Champion
  โฌœ Ergo Master

๐Ÿ“š Tutorials: 3/4 completed
๐Ÿงช Tests: 86/86 passing

Achievements Output โ€‹

bash
$ npm run achievements

๐Ÿ† All Achievements
โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”

โœ… ๐Ÿš€ First Transaction
   "Build your first valid transaction"
   Unlocked: Jan 15, 2025

โœ… ๐Ÿช™ Token Handler
   "Successfully transfer tokens"
   Unlocked: Jan 15, 2025

โฌœ ๐ŸŽจ NFT Creator
   "Mint your first NFT"
   Requirement: Complete Tutorial 3

โฌœ ๐Ÿ“œ Contract Interactor
   "Interact with a smart contract"
   Requirement: Complete Tutorial 4

...

Customizing Achievements โ€‹

You can add custom achievements by extending the leaderboard:

typescript
import { Leaderboard, Achievement } from "../src/leaderboard";

const leaderboard = new Leaderboard();

// Add custom achievement
const customAchievement: Achievement = {
  id: "speed_demon",
  name: "Speed Demon",
  description: "Complete tutorial in under 5 minutes",
  icon: "โšก",
  xpReward: 200
};

leaderboard.registerAchievement(customAchievement);

Integration with CI/CD โ€‹

Track progress automatically in your CI pipeline:

yaml
# .github/workflows/progress.yml
- name: Update Progress
  run: |
    npm test
    if [ $? -eq 0 ]; then
      npm run award-xp -- 50 "Passed all tests in CI"
    fi

Next Steps โ€‹

Released under the MIT License.