A real-time PvP wagering game powered by Solana.
Latch combines competitive multiplayer gameplay with blockchain-backed prize settlement. Players stake cryptocurrency, battle in real-time arenas, and receive automated payouts directly through Solana smart contracts.
Traditional online gaming platforms rely on centralized systems to manage entry fees, match outcomes, and rewards — players must trust the platform to handle funds fairly.
Latch addresses this by using blockchain technology for wager custody and payouts while keeping gameplay fast through a traditional game server architecture:
- Players maintain ownership of their funds until they enter a match
- Wagers are locked in a transparent on-chain escrow
- Match outcomes are validated by the authoritative game server
- Prize payouts are executed automatically through Solana smart contracts
- Players can verify all transactions directly on-chain
Latch allows players to:
- Connect a Solana wallet
- Join or create a wager-based match
- Deposit funds into a secure on-chain vault
- Compete in a real-time multiplayer battle
- Win the match and receive the combined prize pool
The platform combines the speed of modern multiplayer gaming with the transparency and security of blockchain settlement.
| Layer | Status | Stack |
|---|---|---|
| Frontend game client | ✅ Complete | Phaser 3, Vite |
| Multiplayer server | ✅ Complete | Node.js, Express, Socket.io |
| Wallet authentication | ✅ Complete | Solana Wallet Standard, Phantom, Backpack |
| User accounts | ✅ Complete | PostgreSQL (NeonDB) |
| On-chain escrow & payouts | 🔜 In progress | Solana, Anchor |
latch/
├── frontend/ Vite + Phaser 3 game client
└── server/ Express + Socket.io multiplayer server
- Node.js 18+
- A Solana wallet extension (Phantom or Backpack) set to Devnet
- A PostgreSQL database — NeonDB free tier works well
cd server
npm installCreate server/.env (copy from .env.example):
DATABASE_URL=postgresql://user:password@host/dbname?sslmode=require
PORT=3001node server.js
# → migrate: applied 001_create_users.sql
# → Server running on port 3001cd frontend
npm install
npm run dev
# → http://localhost:8080Open a second browser tab to test multiplayer.
Players connect a supported Solana wallet:
- Phantom
- Backpack
- Solflare
- Any Wallet Standard extension
The wallet serves as the player's identity and enables secure transaction signing. Extensions are auto-detected on page load — no manual selection needed if only one is installed.
On first connect, players pick a unique username (3–20 alphanumeric characters). Username and wallet address are stored in PostgreSQL. Returning players are recognized automatically and skip straight to the game.
A player can:
- Create a new battle with a chosen wager amount
- Join an existing battle created by another player
Once two players are matched, the battle begins.
Before entering the arena:
- Each player deposits their wager
- Funds are sent directly to a Solana smart contract
- The smart contract locks the funds in a secure escrow vault
Neither player nor the backend can withdraw these funds during the match.
The game runs in the browser using Phaser 3 and communicates with the backend through WebSockets (Socket.io).
The backend acts as the authoritative game server:
- Synchronizes player positions and animations
- Validates combat events and applies damage
- Determines the final winner
- Broadcasts results to all players in the scene
Players are isolated by scene — only players in the same area interact.
Controls: arrow keys to move · Space to attack · T to chat
When the battle ends:
- The backend verifies the winner
- A settlement request is triggered
- The Solana program validates the battle state
Only valid matches can be settled.
After successful validation:
- The entire prize pool is released from escrow
- Funds are transferred directly to the winner's wallet
- The transaction is recorded permanently on-chain
Players can independently verify the payout using a Solana explorer.
Connect Wallet
│
▼
Auth + Username Registration
│
▼
Character Select
│
▼
Create / Join Match
│
▼
Deposit Wager ← (in progress)
│
▼
Real-Time Battle
│
▼
Winner Determined (server-authoritative)
│
▼
Smart Contract Settlement ← (in progress)
│
▼
Prize Sent To Winner
- Game rendering and player controls
- Wallet detection via Wallet Standard + legacy
window.*injection - Devnet verification via Solana JSON-RPC (no
@solana/web3.jsdependency) - REST calls to server for user lookup / registration
- Real-time sync via Socket.io client
Tech: Phaser 3, Vite, Socket.io Client
- Authentication and user account management (PostgreSQL)
- Real-time game state, movement, and combat validation
- Scene-based player rooms — players only interact within the same scene
- SQL migrations applied automatically on boot
Tech: Node.js, Express, Socket.io, PostgreSQL (NeonDB)
- Escrow management and vault accounts
- Battle state storage via PDAs
- Automated payout execution
- Refund handling for cancelled matches
Tech: Solana, Anchor Framework, Program Derived Addresses
On-chain escrow — Player funds are stored in program-controlled vault accounts, not backend wallets. No need to trust the platform with custody.
Wallet-based authentication — Users authenticate through cryptographic signatures. No passwords.
Server-authoritative gameplay — The backend validates all critical gameplay events to prevent cheating.
Transparent settlement — Every deposit, refund, and payout is verifiable directly on the Solana blockchain.
Latch demonstrates how blockchain technology can be integrated into multiplayer gaming without sacrificing gameplay speed or user experience.
The project explores a model where:
- Competitive games become trust-minimized
- Prize pools are managed transparently
- Players retain visibility into how funds move
- Match outcomes can be settled securely and automatically
By combining real-time multiplayer infrastructure with Solana smart contracts, Latch creates a foundation for skill-based gaming with verifiable rewards.