Skip to content

Soumilgit/StakeLiGames

Repository files navigation

StakeLiGames - Stake on LinkedIn Games Scores

StakeLiGames - Protocol to stake on your LinkedIn games performance | Product Hunt

Stake on your LinkedIn Games performance using stablecoins and earn rewards based on real, verified results. Built for LinkedIn Games fans on Ethereum Sepolia using Solidity, TypeScript, Tailwind, and Next.js.

StakeLiGames Solidity Next.js TypeScript

Demo pics

newlyupdated-contract-successfuldepl updated-hero-section updated-why updated-pipeline staking-updated updated-footer updated-dashboard score-submit dashboard-l-2 dashboard-l-3 dashboard-l-4

Features

  • Sepolia Testnet - All staking and rewards use the Ethereum Sepolia testnet for fast, low-cost testing
  • USDC Stablecoin - Stake and earn rewards using Sepolia USDC (ERC20)
  • Auto Sepolia Switch - Wallet auto-prompts network switch during connect/stake/submit flows
  • Play Now Links - Per-game quick launch buttons open LinkedIn game links in a new tab
  • USDC Staking - Stake stablecoins on your LinkedIn Games scores
  • Attested Verification - Result settlement requires server-signed attestation (nonce + deadline + signature)
  • Historical Dashboard Aggregation - Charts aggregate across current, second-last, and legacy contracts
  • Instant Rewards - Earn rewards when you meet your target score
  • MetaMask Wallet - Browser wallet integration for Sepolia
  • Pleasant UI - Clean, minimal design inspired by competitive gaming and LinkedIn Games
  • Zero Gas Fees - Free testnet transactions, minimal mainnet costs

How It Works

  1. Connect Wallet - Link your MetaMask wallet (app auto-prompts Sepolia switch if needed)
  2. Choose Game - Select a LinkedIn Game (Queens, Crossclimb, Pinpoint, Tango, Zip, Mini Sudoku, Patches)
  3. Stake USDC - Set your target and stake amount (minimum: 0.01 USDC)
  4. Play Now - Use the in-app Play Now button to open the selected LinkedIn game in a new tab
  5. Verify Result - Submit your score/time; app requests nonce, gets verifier attestation, then settles on-chain
  6. Earn Rewards - Meet your target and receive payout based on game reward configuration

Tech Stack

Frontend

  • Next.js 14 - React framework with App Router
  • TypeScript - Type-safe development
  • TailwindCSS - For the styling
  • Framer Motion - Smooth animations
  • Chart.js - For the result analytics on dashboard
  • ethers - Wallet interaction and contract calls
  • Solidity - For 1 smart contract

Smart Contracts (Blockchain)

  • Solidity - On-chain staking and payout contract
  • OpenZeppelin - Security primitives (Ownable, ReentrancyGuard, ECDSA)
  • Sepolia Testnet - Fast and low-cost Ethereum test network

Backend/Scripts

  • Next.js API Routes - Nonce issuance and attestation endpoints
  • Python 3.8+ - Existing contract compilation/deployment scripts

Prerequisites

  • Node.js 18+ and npm
  • Python 3.8+ and pip
  • MetaMask Wallet (mobile or browser extension)
  • Sepolia Testnet Account (created via wallet)

Quick Start

1. Clone & Install

cd StakeLiGames
npm install

2. Set Up Python Environment for Smart Contracts

cd contracts

pip install -r requirements.txt

3. Compile Smart Contracts (Solidity)

# From contracts directory
python compile_solidity.py

This generates:

  • abi.json - Contract ABI
  • bytecode.txt - Compiled bytecode
  • compiled_contract.json - Full compilation artifact

4. Get Testnet USDC (Sepolia)

The testnet now uses Sepolia USDC (ERC20) for simulation and staking.

  1. Visit the official Circle Sepolia USDC faucet: https://faucet.circle.com/
  2. Connect your wallet (e.g., MetaMask) and select the Sepolia network.
  3. Paste your wallet address and request testnet USDC.
  4. Confirm the transaction in your wallet.
  5. You will receive Sepolia USDC directly to your wallet (no asset opt-in required).

Note: The old Algorand testnet asset (ID 10458941) is no longer used. All staking and rewards now use Sepolia USDC.

5. Deploy Smart Contract

# From contracts directory
python deploy_sepolia.py

Options:

  • Enter existing mnemonic (25 words from your wallet) OR
  • Press Enter to generate a new account (you'll need to fund it)

The deployment script will:

  • Compile Solidity contract
  • Deploy to Ethereum Sepolia testnet
  • Output deployed contract address
  • Create/update .env.local with config

Output:

Contract deployed successfully!
Contract Address: 0x...

6. Configure Frontend

The deployment script automatically creates .env.local:

# Ethereum Sepolia Configuration
NEXT_PUBLIC_CHAIN_ID=
NEXT_PUBLIC_RPC_URL=https://rpc.sepolia.org
RPC_URL=https://ethereum-sepolia.publicnode.com
NEXT_PUBLIC_NETWORK_NAME=Sepolia Testnet

# Smart Contract Addresses
NEXT_PUBLIC_CONTRACT_ADDRESS=
NEXT_PUBLIC_USDC_ADDRESS=
PRIVATE_KEY=
VERIFIER_PRIVATE_KEY=

# Historical / Legacy Contracts (optional)
# Direct previous deployment (2nd last). Dashboard/chart reads this
# alongside NEXT_PUBLIC_CONTRACT_ADDRESS.
NEXT_PUBLIC_SECOND_LAST_CONTRACT_ADDRESS=

# Comma-separated list of previous contract addresses to include
# in the read-only dashboard and charts. This is only used for
# displaying historical stakes; new stakes always go to
# NEXT_PUBLIC_CONTRACT_ADDRESS.
NEXT_PUBLIC_LEGACY_CONTRACT_ADDRESSES=

# Application Settings
NEXT_PUBLIC_APP_NAME=

7. Run Development Server

# From project root
npm run dev

Open http://localhost:3000

Using the Platform

Stake on a Game

  1. Connect Wallet - Click "Connect Wallet" (top right)

  2. Select Game:

    • Queens (Hard) → 25% reward
    • Crossclimb (Hard) → 25% reward
    • Mini Sudoku (Medium) → 20% reward
    • Tango (Medium) → 20% reward
    • Zip (Easy) → 15% reward
    • Pinpoint (Special) → 30% reward
    • Patches (Easy) → 10% reward
  3. Configure Stake:

    • Enter USDC amount (min: 0.01 USDC)
    • Set your target (time or score, as per game)
    • Review estimated returns
  4. Create Stake - Approve USDC then create stake transaction

  5. Play Game - Use Play Now and complete your LinkedIn Game

  6. Verify Result - Submit result (nonce + signed attestation) to claim rewards

Verify & Claim Rewards

// Frontend flow before settlement call:
// 1) POST /api/verification/nonce
// 2) POST /api/verification/attest
// 3) call verifyAndPayoutWithAttestation(...) on contract

Available Scripts

# Frontend
npm run dev          # Start development server
npm run build        # Build for production
npm run start        # Start production server
npm run lint         # Run ESLint

# Smart Contracts
npm run contracts:compile   # Compile Solidity contract
npm run contracts:deploy    # Deploy to Sepolia

# Python (from contracts/)
python compile_solidity.py    # Compile contracts
python deploy_sepolia.py     # Deploy to testnet

Testnet Resources

Smart Contract Details

State Schema

Global State:

  • total_staked - Total USDC locked in platform
  • total_games - Number of games created
  • platform_fee - Fee percentage (250 = 2.5%)
  • owner - Platform owner address

Local State (per user):

  • staked_amount - User's active stakes
  • games_participated - Total games count
  • total_winnings - Cumulative winnings
  • total_losses - Cumulative losses

Game Storage:

  • Game data: player, target score, stake amount, flawless stake, timestamp, status
  • Security data: verifier signer, used nonces, attestation window

Contract Methods

  1. createGame - Create new stake on game result

    • Args: gameId, gameType, targetScore, stakeAmount, flawlessStake
    • Requires: USDC transfer to contract (min: 0.01 USDC)
  2. verifyAndPayoutWithAttestation - Verify signed result and distribute rewards

    • Args: gameId, actualScore, flawlessClaimed, nonce, deadline, signature
    • Requires: valid verifier signature + unused nonce + unexpired deadline
    • Logic: If result meets target rule for game type -> payout, else stake flows to pool
  3. setVerifierSigner / setDefaultAttestationWindow

    • Owner-configurable verifier and attestation policy
  4. withdrawFees - Owner withdraws platform fees

    • Args: amount

UI Design Philosophy

  • Clean & Minimal - Inspired by the challenge and excitement of LinkedIn Games
  • Accessible - High contrast, readable fonts
  • Responsive - Mobile-first design

Security Features

  • OpenZeppelin patterns for access control and signature recovery
  • Reentrancy protection via ReentrancyGuard
  • ECDSA attestation checks with nonce replay protection
  • Access control for admin functions
  • Nonce + deadline validation for result submissions
  • Testnet first - Deploy safely before mainnet

Deployment to Production

Frontend Hosting

Vercel (Recommended):

npm install -g vercel
vercel deploy

Netlify:

npm run build
netlify deploy --prod --dir=.next

Customization

Add New Games

Edit components/StakingInterface.tsx:

const games = [
   { id: "new_game", name: "New Game", difficulty: "Hard", targetTime: 60, unit: "sec", reward: "25%" },
   // ... existing games
];

Adjust Rewards

Edit contracts/staking_contract.py:

reward := stake_amount / Int(5),  # 20% reward (1/5)
# Change to stake_amount / Int(4) for 25%
# Change to stake_amount / Int(10) for 10%

Recompile and redeploy:

python compile_solidity.py
python deploy_sepolia.py

Contributing

Contributions welcome! Please:

  1. Fork the repository
  2. Create a feature branch
  3. Submit a pull request

Support

Links


Built with love using Sepolia + Solidity + Next.js

Turn your gaming confidence into instant liquidity!

Ethereum Sepolia Deployment

  • Contract Address: 0x029EF7bCEC712a440cfAbFA9d65c7D01786FD8A2
  • Chain ID: 11155111
  • Network: Sepolia Testnet

Project Structure

├─ .env.local
├─ .eslintrc.json
├─ .gitignore
├─ GAME_CONFIGURATIONS.md
├─ README.md
├─ app
│  ├─ dashboard
│  │  └─ page.tsx
│  ├─ game
│  │  └─ [gameId]
│  │     └─ page.tsx
│  ├─ globals.css
│  ├─ layout.tsx
│  └─ page.tsx
├─ components
│  ├─ Features.tsx
│  ├─ Footer.tsx
│  ├─ Header.tsx
│  ├─ Hero.tsx
│  ├─ HowItWorks.tsx
│  ├─ NotificationBar.tsx
│  ├─ StakedGamesDashboard.tsx
│  ├─ StakingInterface.tsx
│  ├─ Stats.tsx
│  ├─ ThemeProvider.tsx
│  ├─ ThemeToggle.tsx
│  ├─ UserDashboard.tsx
│  └─ WalletProvider.tsx
├─ contracts
│  ├─ .env
│  ├─ @openzeppelin
│  │  └─ contracts
│  │     ├─ crosschain
│  │     │  ├─ amb
│  │     │  ├─ arbitrum
│  │     │  ├─ errors.sol
│  │     │  ├─ optimism
│  │     │  └─ polygon
│  │     ├─ finance
│  │     ├─ governance
│  │     │  ├─ compatibility
│  │     │  ├─ extensions
│  │     │  └─ utils
│  │     ├─ interfaces
│  │     ├─ metatx
│  │     ├─ mocks
│  │     │  ├─ ERC165
│  │     │  ├─ compound
│  │     │  ├─ crosschain
│  │     │  ├─ docs
│  │     │  ├─ governance
│  │     │  ├─ proxy
│  │     │  ├─ token
│  │     │  └─ wizard
│  │     ├─ package.json
│  │     ├─ proxy
│  │     │  ├─ ERC1967
│  │     │  ├─ beacon
│  │     │  ├─ transparent
│  │     │  └─ utils
│  │     ├─ security
│  │     ├─ token
│  │     │  ├─ ERC1155
│  │     │  │  ├─ extensions
│  │     │  │  ├─ presets
│  │     │  │  └─ utils
│  │     │  ├─ ERC20
│  │     │  │  ├─ extensions
│  │     │  │  ├─ presets
│  │     │  │  └─ utils
│  │     │  ├─ ERC721
│  │     │  │  ├─ extensions
│  │     │  │  ├─ presets
│  │     │  │  └─ utils
│  │     │  ├─ ERC777
│  │     │  │  └─ presets
│  │     │  └─ common
│  │     ├─ utils
│  │     │  ├─ cryptography
│  │     │  ├─ escrow
│  │     │  ├─ introspection
│  │     │  ├─ math
│  │     │  └─ structs
│  │     └─ vendor
│  ├─ StakeLiGames.sol
│  ├─ abi.json
│  ├─ bytecode.txt
│  ├─ compile.py
│  ├─ compile_solidity.py
│  ├─ compiled_contract.json
│  ├─ deploy.py
│  ├─ deploy_sepolia.py
│  ├─ deployment.json
│  ├─ hardhat.config.js
│  ├─ package.json
│  ├─ requirements.txt
│  ├─ scripts
│  │  └─ deploy.js
│  └─ staking_contract.py
├─ next.config.js
├─ package-lock.json
├─ package.json
├─ postcss.config.js
├─ public
│  └─ favicon.jpg
├─ tailwind.config.ts
├─ tsconfig.json
└─ types
   └─ ethereum.d.ts

About

StakeLiGames is an on-chain staking protocol for LinkedIn Games, enabling decentralized score verification and rewards using smart contracts. Built with Algorand blockchain on Sepolia testnet using PyTeal (Python smart contracts), Solidity, TypeScript and Next.js, with TailWind for the UI & multi-mode compatibility and Chart.js for analytics.

Topics

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors