Fair token distribution powered by on-chain reputation
The demo covers:
- โ Connecting Solana wallet (Phantom)
- โ Fetching FairScore from FairScale API
- โ Linking X/Twitter for social score boost
- โ Viewing tier benefits and score breakdown
- โ Claiming an airdrop with tier multiplier
- โ Cooldown system and claim history
- โ Score improvement tips and leaderboard
FairDrop is a sybil-resistant airdrop platform that uses FairScale reputation scores to distribute tokens fairly on Solana. Instead of equal distribution that rewards bot farms, FairDrop allocates tokens based on your on-chain reputation.
| Issue | Impact |
|---|---|
| ๐ค Sybil Attacks | Bots create thousands of wallets to farm airdrops |
| โ๏ธ Unfair Distribution | Real users compete with fake accounts |
| ๐ญ No Trust Layer | No way to distinguish legitimate participants |
| ๐ธ Wasted Tokens | Projects lose value to farmers, not users |
FairDrop uses FairScale's FairScore to create merit-based distribution:
- โ Gate access based on reputation tiers
- โ Multiply allocations for trusted wallets (up to 3x)
- โ Apply dynamic cooldowns based on trust level
- โ Show score improvement tips to help users grow
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ FairDrop Frontend โ
โ Next.js 14 + React + TypeScript โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ โ
โ โโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโ โ
โ โ Wallet โ โ FairScale โ โ Airdrop โ โ
โ โ Connection โโโโโถโ API Client โโโโโถโ Manager โ โ
โ โ (Phantom, โ โ โ โ โ โ
โ โ Solflare) โ โ /score โ โ Tier Gating โ โ
โ โโโโโโโโโโโโโโโโโโ โ /fairScore โ โ Multipliers โ โ
โ โ โ /walletScore โ โ Cooldowns โ โ
โ โ โ /socialScore โ โโโโโโโโโโโโโโโโโโ โ
โ โ โโโโโโโโโโโโโโโโโโ โ โ
โ โ โ โ โ
โ โผ โผ โผ โ
โ โโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโ โ
โ โ Solana โ โ FairScore โ โ Claim โ โ
โ โ Web3.js โ โ Processing โ โ History โ โ
โ โ โ โ โ โ (LocalStorage)โ โ
โ โ - PublicKey โ โ - Score 0-1000โ โ โ โ
โ โ - Signing โ โ - Tier Calc โ โ - Records โ โ
โ โ โ โ - Badges โ โ - Timestamps โ โ
โ โโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโ โ
โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ External Services โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ โ
โ โโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโ โ
โ โ FairScale โ โ Solana โ โ Solscan โ โ
โ โ API โ โ RPC โ โ Explorer โ โ
โ โ โ โ โ โ โ โ
โ โ api.fairscale โ โ Devnet / โ โ Transaction โ โ
โ โ .xyz โ โ Mainnet โ โ Links โ โ
โ โโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโ โ
โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
User Connects Wallet
โ
โผ
โโโโโโโโโโโโโโโโโโโโโ
โ Fetch FairScore โโโโโ FairScale API (/score?wallet=xxx&twitter=yyy)
โ from FairScale โ
โโโโโโโโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโ
โ Calculate Tier โ Score 0-299 โ Bronze (1x)
โ from Score โ Score 300-599 โ Silver (1.5x)
โ โ Score 600-849 โ Gold (2x)
โโโโโโโโโโโโโโโโโโโโโ Score 850-1000 โ Diamond (3x)
โ
โผ
โโโโโโโโโโโโโโโโโโโโโ
โ Display Airdrops โ Filter by tier requirements
โ + Allocations โ Calculate: base ร multiplier
โโโโโโโโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโ
โ Process Claim โ Check cooldown (tier-based)
โ โ Save to claim history
โโโโโโโโโโโโโโโโโโโโโ
FairDrop deeply integrates FairScale at its core - not just for display, but for all business logic.
| Endpoint | Purpose | Example |
|---|---|---|
GET /score |
Full score + breakdown + badges | Main dashboard data |
GET /fairScore |
Quick score lookup | Leaderboard updates |
GET /walletScore |
On-chain activity score only | Analytics |
GET /socialScore |
Social reputation score | X/Twitter boost |
1. Main API Client (src/lib/fairscale.ts)
const FAIRSCALE_API_BASE = "https://api.fairscale.xyz";
export async function getFairScoreFromAPI(
walletAddress: string,
apiKey: string,
twitterHandle?: string
): Promise<FairScoreResponse> {
// Build query with optional Twitter handle
const params = new URLSearchParams({ wallet: walletAddress });
if (twitterHandle) {
params.append("twitter", twitterHandle);
}
const response = await fetch(
`${FAIRSCALE_API_BASE}/score?${params.toString()}`,
{
headers: {
"fairkey": apiKey, // FairScale API authentication
"Content-Type": "application/json",
},
}
);
const data: FairScaleAPIScoreResponse = await response.json();
// Transform API response - scale 0-100 to 0-1000
return {
wallet: data.wallet,
fairScore: Math.round(data.fairscore * 10),
tier: mapTier(data.tier),
badges: data.badges.map(transformBadge),
breakdown: {
walletScore: data.fairscore_base,
socialScore: data.social_score,
walletAgeDays: data.features.wallet_age_days,
txCount: data.features.tx_count,
activeDays: data.features.active_days,
platformDiversity: data.features.platform_diversity,
// ... more features
},
};
}2. Tier-Based Access Control (src/components/AirdropList.tsx)
// Airdrops are gated by minimum tier requirement
const canAccessAirdrop = (airdrop: Airdrop): boolean => {
if (!tier) return false;
const tierOrder = ["bronze", "silver", "gold", "diamond"];
const userTierIndex = tierOrder.indexOf(tier.name);
const requiredTierIndex = tierOrder.indexOf(airdrop.minTier);
return userTierIndex >= requiredTierIndex;
};3. Allocation Multipliers (src/lib/fairscale.ts)
// Higher FairScore = larger allocation
export function calculateAllocation(baseAmount: number, fairScore: number): number {
const tier = getTierFromScore(fairScore);
return Math.floor(baseAmount * tier.multiplier);
}
// Tier multipliers
export const TIERS = {
bronze: { minScore: 0, multiplier: 1.0 },
silver: { minScore: 300, multiplier: 1.5 },
gold: { minScore: 600, multiplier: 2.0 },
diamond: { minScore: 850, multiplier: 3.0 },
};4. Dynamic Cooldowns (src/lib/fairscale.ts)
// Trust reduces wait time between claims
export function getCooldownHours(tier: TierName): number {
switch (tier) {
case "diamond": return 0; // No cooldown - max trust
case "gold": return 6; // 6 hour cooldown
case "silver": return 12; // 12 hour cooldown
case "bronze": return 24; // 24 hour cooldown
}
}5. Social Score Integration (src/components/Dashboard.tsx)
// Users can link their X/Twitter handle to boost score
const handleTwitterSubmit = async () => {
localStorage.setItem(TWITTER_STORAGE_KEY, twitterInput);
setTwitterHandle(twitterInput);
// Refetch score with Twitter handle included
const result = await fetchFairScore(
publicKey.toBase58(),
twitterInput // Passed to FairScale API
);
setScoreData(result);
};FairDrop uses these FairScale API features:
| Feature | API Field | How We Use It |
|---|---|---|
| Fair Score | fairscore |
Main score (0-1000 scaled) |
| Wallet Score | fairscore_base |
On-chain activity component |
| Social Score | social_score |
X/Twitter reputation boost |
| Wallet Age | features.wallet_age_days |
Display in breakdown |
| Transaction Count | features.tx_count |
Activity metric |
| Active Days | features.active_days |
Consistency metric |
| Platform Diversity | features.platform_diversity |
DeFi exploration |
| Conviction Ratio | features.conviction_ratio |
Holding behavior |
| Badges | badges[] |
Achievement display |
| Tier | tier |
Access gating |
| Tier | FairScore | Multiplier | Cooldown | Benefits |
|---|---|---|---|---|
| ๐ฅ Bronze | 0-299 | 1.0x | 24h | Basic access |
| ๐ฅ Silver | 300-599 | 1.5x | 12h | Early access |
| ๐ฅ Gold | 600-849 | 2.0x | 6h | Priority + Exclusive drops |
| ๐ Diamond | 850-1000 | 3.0x | None | VIP + Governance |
| Feature | Description |
|---|---|
| ๐ Tier-Gated Access | Only eligible wallets can claim specific airdrops |
| ๐ Dynamic Multipliers | Higher reputation = larger token allocations |
| โฑ๏ธ Smart Cooldowns | Trust level reduces wait times between claims |
| ๐ Score Breakdown | Transparent view of how your score is calculated |
| ๐ Achievement Badges | Visual recognition of on-chain accomplishments |
| ๐ Claim History | Track all your claims with transaction links |
| ๐ก Improvement Tips | Personalized suggestions to boost your score |
| ๐ Leaderboard | See how you rank against other users |
| ๐๏ธ Eligibility Simulator | Preview what you unlock at different score levels |
| ๐ค Social Sharing | Share your score on X/Twitter |
- Node.js 18+
- npm or yarn
- Solana wallet (Phantom recommended)
- FairScale API key (Get one here)
# 1. Clone the repository
git clone https://github.com/z0neSec/FairDrop.git
cd FairDrop
# 2. Install dependencies
npm install
# 3. Set up environment variables
cp .env.example .env.localEdit .env.local:
# Required: FairScale API Key
NEXT_PUBLIC_FAIRSCALE_API_KEY=your_api_key_here
# Optional: Solana RPC URL (defaults to devnet)
NEXT_PUBLIC_RPC_URL=https://api.devnet.solana.com# Development mode (with hot reload)
npm run dev
# Production build
npm run build
npm startOpen http://localhost:3000 in your browser.
FairDrop/
โโโ src/
โ โโโ app/
โ โ โโโ globals.css # Global styles + Tailwind
โ โ โโโ layout.tsx # Root layout with providers
โ โ โโโ page.tsx # Main page component
โ โ
โ โโโ components/
โ โ โโโ Navbar.tsx # Navigation + wallet button
โ โ โโโ HeroSection.tsx # Landing hero section
โ โ โโโ HowItWorks.tsx # Feature explanation
โ โ โโโ Dashboard.tsx # Main dashboard (score + airdrops)
โ โ โโโ ScoreDisplay.tsx # FairScore visualization + breakdown
โ โ โโโ AirdropList.tsx # Airdrop cards + claim logic
โ โ โโโ ScoreImprovementTips.tsx # Personalized tips
โ โ โโโ ShareScore.tsx # Social sharing
โ โ โโโ Leaderboard.tsx # Top users ranking
โ โ โโโ EligibilitySimulator.tsx # Score preview slider
โ โ โโโ PlatformStats.tsx # Platform metrics
โ โ โโโ Footer.tsx # Footer links
โ โ
โ โโโ lib/
โ โ โโโ fairscale.ts # โญ FairScale API integration
โ โ โโโ utils.ts # Helper functions
โ โ
โ โโโ providers/
โ โโโ WalletProvider.tsx # Solana wallet context
โ
โโโ public/ # Static assets
โโโ .env.example # Environment template
โโโ tailwind.config.ts # Tailwind configuration
โโโ package.json # Dependencies
| Category | Technology |
|---|---|
| Framework | Next.js 14 (App Router) |
| Language | TypeScript |
| Styling | Tailwind CSS |
| Animations | Framer Motion |
| Blockchain | Solana Web3.js |
| Wallet | Solana Wallet Adapter |
| Reputation | FairScale API |
| Deployment | Vercel |
- Click the button above
- Connect your GitHub account
- Add environment variable:
NEXT_PUBLIC_FAIRSCALE_API_KEY - Deploy!
# Build for production
npm run build
# The output is in .next/ folder
# Deploy to any Node.js hosting provider- On-chain claim transactions with SPL tokens
- Project dashboard for airdrop creators
- Merkle proof verification for large drops
- Multi-chain support (EVM via FairScale)
- DAO governance integration
- Real-time score updates via WebSocket
- Mobile app (React Native)
MIT License - see LICENSE for details.
- FairScale - On-chain reputation infrastructure
- Solana - High-performance blockchain
- FairScale Hackathon - For the opportunity
Built with ๐ for the FairScale Hackathon 2026