Overview
SolChess is a real-time multiplayer chess platform where games can carry a SOL wager. Both players lock their stake in an on-chain escrow when the game starts, and the program pays the winner at the end. Spectators can stake on the player they expect to win.
I built the whole stack on my own in about a week: the React interface, the Fastify and Socket.IO game server, and the Anchor program, plus free practice modes against an in-browser Stockfish engine.
The challenge
Online chess with money on the line needs someone to hold the stakes. Normally that is the platform, which means players have to trust it to pay out. A game also has to stay fast: moves, clocks and chat need to arrive instantly, which a blockchain alone cannot do.
So the design had to split the work: the chain holds money and settles it, while a server runs the live game.
The goal
Let two people play for stakes without trusting a middleman, while the game itself feels instant.
- 01Lock both players' wagers in a smart contract escrow and settle automatically.
- 02Allow different wager sizes for creator and joiner, and spectator staking on either side.
- 03Relay moves, timers and chat in real time over WebSockets.
- 04Offer free practice against an engine or a friend, and invite codes for private games.
The on-chain program
An Anchor program holds each game's escrow and the spectator stake pool. Its instructions cover platform setup, creating and joining a game, opening a stake window, placing a stake, claiming stake winnings and claiming an abandoned game. Settlement pays the winner the pot minus a platform fee, with a treasury and player stats accounts alongside.
Live games
A Fastify and Socket.IO server runs the games. It validates moves, switches the clocks, handles resign and undo requests, and broadcasts game state and spectator counts to everyone in the room. Games, moves, stakes, users and refresh tokens live in PostgreSQL through Prisma, and sign-in uses wallet-based auth with refresh tokens.
- 01Hosted games: a game you watch while two others play.
- 02Six-character game codes to invite a specific opponent.
- 03A world chat and private chat, and a leaderboard ranked by trust score.
Practice and play modes
Practice mode needs no wager. The browser runs a Stockfish build for games against the engine, and a friend mode lets two people play without staking. Seeded test games and a lookup by code made it quick to try the flows while building.
Interface and mobile layout
The interface has a home page with animated stats, a game page with player cards, timers, a staking panel and prize pool, and a profile dropdown on the wallet button. In the last days I added a bottom tab bar and mobile layout, SEO metadata and a sitemap, and Docker and Vercel configuration for deployment.
The outcome
SolChess has a frontend on Vercel, a backend with a Docker setup and an Anchor program targeting Solana devnet. All 29 commits are mine and fall between 4 and 11 May 2026. It shows a complete wager-and-settle design where the chain holds the money and a server handles the live game. It has not been audited, and the README names mainnet as a future target.


