Overview
This project is a fully functional chess application where every component, including the game rules engine,
the AI opponent, and the web frontend, runs directly on-chain as smart contract code in an Internet Computer canister.
There is no traditional web server, no cloud backend, and no centralised point of failure.
Why the Internet Computer and not Ethereum?
Ethereum and most EVM chains are optimised for financial transactions and simple contract state.
They are fundamentally unsuited to an application like this for several reasons:
-
Gas costs: Running chess move validation or an AI search tree on Ethereum
would cost prohibitive amounts in gas fees as each computation is metered and billed per opcode.
The IC executes WebAssembly with a reverse-gas model where developers fund cycles, not users.
-
Storage: Ethereum stores state in a 256-bit key-value trie, which is expensive and
not designed for structured application data. IC canisters have native stable memory,
allowing practical on-chain storage of game state, history, and user data.
-
Frontend serving: Ethereum has no mechanism to serve HTTP content.
The IC's HTTP gateway allows canisters to respond to browser requests directly,
meaning the frontend itself lives on-chain, so the entire app stack is decentralised.
-
Compute speed: IC query calls execute in milliseconds, making interactive
UX possible. Ethereum transactions take seconds to minutes and require wallet signing for every state change.
On-Chain AI: Alpha-Beta Pruning
The AI opponent runs natively inside a canister, implemented in Rust using an
alpha-beta pruning minimax search. Rather than calling an external API or
offloading to a centralised server, the engine evaluates the game tree entirely on-chain:
demonstrating that meaningful compute, not just state storage, can live in smart contracts.
Alpha-beta pruning makes this practical by dramatically reducing the number of nodes evaluated
compared to a naive minimax search, keeping response times within IC cycle limits.
Architecture
Frontend
React + JavaScript, served directly from an asset canister
Game Logic
Rust canister handling move validation, game state, and rules enforcement
AI Engine
Alpha-beta minimax search running natively on-chain in Rust
Infrastructure
Internet Computer — no servers, no cloud infrastructure
What's Next
The next phase of the project will explore NFT integration, which would allow players
to own custom board themes and piece sets as on-chain assets, with ownership verified and
rendered directly by the canister at runtime. It will also include Crypto Wallet integration To enable users to wager cryptocurrency securely on the result of games through smart contracts.
Motoko
Rust
React
TypeScript
Smart Contracts
Alpha-Beta Pruning
WebAssembly
NFTs