Connect4 is a modern reimagination of the classic two-player strategy game where players take turns dropping colored discs into a vertical seven-column, six-row grid. The objective is simple yet challenging: connect four of your discs in a row—horizontally, vertically, or diagonally—while blocking your opponent from doing the same.
By leveraging the power of ZkNoid, the game integrates Zero-Knowledge Proofs (ZKPs) to ensure secure, provable fairness while delivering gasless transactions. This project, built for the EthBangkok Hackathon, demonstrates the intersection of blockchain technology and gaming innovation.
- Provable Fairness: Moves and outcomes are cryptographically verified without revealing the player's strategy.
- Gasless Transactions: Enjoy seamless gameplay without transaction fees.
- Security: Protect players from tampering or fraud with ZK technology.
- Transparency: Every action is logged and verified, fostering trust among players.
- Competitive leaderboard system for global rankings.
- Real-time matchmaking for a seamless multiplayer experience.
- Modular, scalable infrastructure for developers to extend or customize the game.
ZkNoid is a modular ZK (Zero-Knowledge) gaming platform built on the Mina Protocol. It provides the essential tools and infrastructure for developers to create and deploy provable games. ZkNoid's modularity allows developers to integrate Zero-Knowledge Proofs into game mechanics easily.
- Hackathon Provenance: Originated at a hackathon in Istanbul, ZkNoid has grown into a robust ecosystem for ZK-based gaming.
- Award-Winning Platform: Grand prize winner in the Mina Navigators Program.
- Developer-Friendly: A modular framework that simplifies game deployment and integration with ZKPs.
Learn more about ZkNoid:
This repository hosts the complete implementation of Connect4, featuring:
- Frontend: A dynamic and responsive user interface for the game.
- Smart Contracts: Zero-Knowledge-enabled contracts for move verification and game outcomes.
- Game Logic: Core game functionality, implemented using ZkNoid's modular framework.
- Matchmaking: Automated player pairing for real-time gameplay.
- Leaderboard System: Persistent global rankings for competitive play.
- Two players take turns dropping their colored discs into the grid.
- The game ends when a player connects four discs in a row (horizontally, vertically, or diagonally).
- If the grid is filled without any player achieving a connect-four, the game ends in a draw.
- Moves are validated using Zero-Knowledge Proofs to ensure fairness and prevent tampering.
- Zero-Knowledge Proofs: Cryptographic verification ensures secure and transparent gameplay.
- Matchmaking System: Players are paired in real time based on availability and ranking.
- Leaderboard Integration: Persistent global rankings encourage competition.
To set up and run Connect4 locally:
# Clone the repository
git clone https://github.com/Vatsal596/connect4
cd connect4
# Use the correct Node.js version
nvm use
# Install dependencies
pnpm install
# Start the development server
pnpm env:inmemory dev