StakeLiGames - Stake on LinkedIn Games Scores

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.

Demo pics
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)
- Progressive Multi-Contract Dashboard - Parallel chunked event fetching across all current, second-last, and legacy contracts with progressive streaming, zero RPC range limits, and dynamic live analytics
- 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
- Connect Wallet - Link your MetaMask wallet (app auto-prompts Sepolia switch if needed)
- Choose Game - Select from 9 LinkedIn Games (Queens, Crossclimb, Pinpoint, Tango, Zip, Mini Sudoku, Wend, Patches, Sumbreak)
- Stake USDC - Set your target and stake amount (minimum: 0.01 USDC)
- Play Now - Use the in-app Play Now button to open the selected LinkedIn game in a new tab
- Verify Result - Submit your score/time; app requests nonce, gets verifier attestation, then settles on-chain
- 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
Also, create .env here:
PRIVATE_KEY=
SEPOLIA_RPC_URL=https://rpc.sepolia.org
NEXT_PUBLIC_USDC_ADDRESS=
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.
- Get free Sepolia ETH from https://sepolia-faucet.pk910.de/#/ via your wallet address
- Visit https://faucet.circle.com/ - the official Circle Sepolia USDC faucet
- Connect your wallet (e.g., MetaMask) and select the Sepolia network
- Paste your latest contract/wallet address and request testnet USDC
- Confirm the transaction in your wallet
- 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
6. Set Maximum Target Score
python set_max_target_scores.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...
The deployment script automatically creates .env.local:
PRIVATE_KEY=""
NEXT_PUBLIC_APP_NAME=""
NEXT_PUBLIC_CHAIN_ID="11155111"
NEXT_PUBLIC_CONTRACT_ADDRESS=""
NEXT_PUBLIC_LEGACY_CONTRACT_ADDRESSES=""
NEXT_PUBLIC_NETWORK_NAME="Sepolia Testnet"
NEXT_PUBLIC_RPC_URL="https://rpc.sepolia.org"
NEXT_PUBLIC_SECOND_LAST_CONTRACT_ADDRESS=""
NEXT_PUBLIC_THIRD_LAST_CONTRACT_ADDRESSES=""
NEXT_PUBLIC_USDC_ADDRESS=""
RPC_URL="https://ethereum-sepolia.publicnode.com"
7. Run Development Server
# From project root
npm run dev
Open http://localhost:3000
Stake on a Game
-
Connect Wallet - Click “Connect Wallet” (top right)
-
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
- Wend (Hard) → 20% reward
- Patches (Easy) → 10% reward
-
Configure Stake:
- Enter USDC amount (min: 0.01 USDC)
- Set your target (time or score, as per game)
- Review estimated returns
-
Create Stake - Approve USDC then create stake transaction
-
Play Game - Use Play Now and complete your LinkedIn Game
-
Verify Result - Submit result (nonce + signed attestation) to claim rewards
Verify & Claim Rewards
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
-
createGame - Create new stake on game result
- Args: gameId, gameType, targetScore, stakeAmount, flawlessStake
- Requires: USDC transfer to contract (min: 0.01 USDC)
-
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
-
setVerifierSigner / setDefaultAttestationWindow
- Owner-configurable verifier and attestation policy
-
withdrawFees - Owner withdraws platform fees
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
Recent Updates & Security Maintenance
Multi-Contract Dashboard & Progressive Streaming
- Concurrent Multi-Contract RPC Fetching: Implemented parallel, chunked event querying across all configured contracts (
NEXT_PUBLIC_CONTRACT_ADDRESS, NEXT_PUBLIC_SECOND_LAST_CONTRACT_ADDRESS, NEXT_PUBLIC_THIRD_LAST_CONTRACT_ADDRESSES, NEXT_PUBLIC_LEGACY_CONTRACT_ADDRESSES).
- Progressive Streaming & Zero RPC Limits: Resolved the RPC
range exceeds limit of 10000 limit by auto-chunking block ranges, streaming stakes directly to the table as each contract finishes.
- Dual Event Schema Resolution: Supports both legacy and modern
GameCreated / GameVerified event signatures concurrently without manual ABI toggles.
- Dynamic Live Analytics: Win/loss distribution charts dynamically re-aggregate in real time as historical and new stakes load, strictly scoped to the connected wallet.
- Dependabot Security & Toolchain Upgrades: Updated package versions in sync with compatibility, avoiding vulnerabilities to spread :)
Contributing
Contributions welcome! Please:
- Fork the repository
- Create a feature branch
- 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: 0xaf572a1a22a104A7e3f11E293D618620D37A1583
- Chain ID: 11155111
- Network: Sepolia Testnet
Project Structure
├─ .env.example
├─ .env.local
├─ .eslintrc.json
├─ .gitignore
├─ GAME_CONFIGURATIONS.md
├─ README.md
├─ StakeLiGames_flat.sol
├─ app
│ ├─ api
│ │ └─ verification
│ │ ├─ attest
│ │ │ └─ route.ts
│ │ └─ nonce
│ │ └─ route.ts
│ ├─ 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
│ ├─ hardhat.config.js
│ ├─ package.json
│ ├─ requirements.txt
│ ├─ scripts
│ │ └─ deploy.js
│ ├─ set_max_target_scores.py
│ └─ staking_contract.py
├─ lib
│ └─ verificationStore.ts
├─ next.config.js
├─ package-lock.json
├─ package.json
├─ postcss.config.js
├─ public
│ ├─ crossclimb.jpg
│ ├─ favicon.jpg
│ ├─ minisudoku.jpg
│ ├─ patches.jpg
│ ├─ pinpoint.jpg
│ ├─ sumbreak.jpg
│ ├─ queens.jpg
│ ├─ tango.jpg
│ ├─ wend.jpg
│ └─ zip.jpg
├─ scripts
│ ├─ check_balances.js
│ ├─ inspect_game.js
│ ├─ retroactive_topup.js
│ └─ set_reverse.js
├─ tailwind.config.ts
├─ tsconfig.json
└─ types
└─ ethereum.d.ts
评论