Overview
AlluChain is a decentralized gaming platform built on Arbitrum One that delivers provably fair crypto games without registration. Players connect their Web3 wallet, swap ACT tokens for wACT, and participate in on-chain games with fully transparent, verifiable outcomes powered by Chainlink VRF.
The flagship game, Everybody Win, is a next-generation multiplayer prize pool game with a โwin togetherโ mechanic โ even non-winners automatically earn 10 points redeemable for prizes, ensuring every participant gets value.
Key Achievement: Delivered a full-stack DApp from smart contract architecture to Angular frontend, with automated event-driven reward distribution and a dual-reward system (wACT + points).
Technical Highlights
๐ฒ Smart Contract Architecture
- Upgradeable Contracts: UUPS (Universal Upgradeable Proxy Standard) proxy pattern for future-proof deployment
- Chainlink VRF Integration: Verifiable Random Function ensuring provably fair, on-chain verifiable outcomes
- Merkle Tree Rewards: Gas-optimized reward distribution โ users claim only their own rewards
- wACT Token: Custom ERC-20 token swapped 1:1 from ACT, used as the platformโs betting currency
- Batch Betting: Optimized contract functions supporting multiple bets in a single transaction
๐ Blockchain Integration
- Network: Arbitrum One (mainnet)
- viem Library: Type-safe Ethereum interactions with comprehensive ABI support
- Event Monitoring: Real-time blockchain event listening via Alchemy webhooks
- Wallet Integration: MetaMask and Web3 wallet connection with session persistence
- Transaction Management: Robust error handling and retry logic for blockchain operations
๐๏ธ Backend Engineering
Supabase Edge Functions:
- cal-rewards-gen-merkle: Automated reward calculation and Merkle tree generation on draw completion
- complete-round: Round finalization and state management
- Webhook Security: IP whitelisting and HMAC signature verification for Alchemy webhooks
- PostgreSQL Database: Optimized schema for bet records, Merkle proofs, and user rewards
๐จ Frontend Architecture
Angular (Standalone Components):
- RxJS reactive state management
- Shopping cart system for batch betting
- Number picker with preset combinations
- Responsive design for mobile and desktop
Core Services:
- BlockchainService: Smart contract interaction
- PaymentService: wACT payment processing
- WalletService: Web3 wallet management with session handling
- SupabaseService: Database operations and Edge Function calls
Core Features
- โ Everybody Win โ multiplayer prize pool game with shared win mechanics
- โ No registration โ connect wallet and play instantly
- โ Provably fair draws via Chainlink VRF (on-chain verifiable)
- โ wACT token payments (swapped 1:1 from ACT)
- โ Non-winners automatically earn 10 points per round
- โ Points redeemable for prizes alongside wACT
- โ Web3 wallet connection (MetaMask, WalletConnect)
- โ Shopping cart batch betting system
- โ Merkle proof-based reward claiming
- โ Gas-optimized smart contracts on Arbitrum One
Technical Stack
Frontend:
- Framework: Angular
- Language: TypeScript
- Blockchain: viem, web3.js
- UI/UX: SCSS, RxJS
- Build: Angular CLI with SSR support
Backend:
- Database: Supabase (PostgreSQL)
- Edge Functions: Deno runtime
- Webhooks: Alchemy Notify integration
- Authentication: Wallet-based auth
Blockchain:
- Network: Arbitrum One
- Smart Contracts: OpenZeppelin Upgradeable
- VRF: Chainlink Verifiable Random Function
- Token: ERC-20 wACT (1:1 swap from ACT)
DevOps:
- Deployment: Cloudflare Pages
- CI/CD: Wrangler CLI
System Architecture
Data Flow:
- User connects Web3 wallet
- User swaps ACT โ wACT via โGet wACTโ
- User selects game and places bets (batch supported)
- Wallet signs transaction with wACT approval
- Smart contract processes bet and emits events
- Alchemy webhook triggers Edge Function
- Edge Function stores bet record in Supabase
- VRF generates verifiable random outcome
- DrawCompleted event triggers reward calculation
- Edge Function generates Merkle tree and proofs
- Winners claim rewards; non-winners auto-receive 10 points
Security Layers:
- IP whitelisting for webhook endpoints
- HMAC signature verification for Alchemy requests
- Smart contract reentrancy protection
- Wallet signature validation
- UUPS upgrade authorization control
Development Impact
- Architected complete DApp from smart contracts to frontend UI
- Implemented Merkle tree reward distribution significantly reducing gas costs per claim
- Built automated webhook system processing draw events with zero downtime
- Designed upgradeable contract architecture supporting future feature additions without redeployment
- Created dual-reward system (wACT + points) ensuring every player receives value
- Integrated Chainlink VRF ensuring cryptographically verifiable random draws
- Deployed on Arbitrum One mainnet with open-source, auditable smart contracts
Key Challenges Solved
1. Gas Optimization:
- Problem: Direct reward transfers would cost $100+ in gas per draw
- Solution: Merkle tree distribution allowing users to claim only their rewards (~$2 gas)
2. Randomness Verification:
- Problem: Need provably fair random number generation
- Solution: Chainlink VRF integration with on-chain verification
3. Webhook Security:
- Problem: Edge Functions exposed to public internet
- Solution: Multi-layer security (IP whitelist, HMAC signature, rate limiting)
4. Contract Upgradeability:
- Problem: Need to fix bugs and add features post-deployment
- Solution: UUPS proxy pattern with access control
Links
- ๐ Live Platform