project screenshot 1
project screenshot 2
project screenshot 3
project screenshot 4
project screenshot 5
project screenshot 6

zKube

Two-player game, that utilizes zk-SNARKs technology to accurately and securely determine the winner.

zKube

Created At

ETHGlobal Istanbul

Winner of

Scroll - Deploy on Scroll

Prize Pool

Project Description

Our game integrates zk-SNARKs to facilitate accurate and secure verification of puzzle-solving in a competitive setting. Involving two players in successive timed rounds, it requires them to solve puzzles and employ zk-SNARKs to prove solution correctness without revealing the actual content. Victory hinges on the count of accurately solved puzzles, with tiebreakers adjudicated based on solution speed, measured in blockchain blocks, leveraging the inherent properties of zk-SNARKs for both privacy preservation and computational efficiency.

How it's Made

This project intricately blends blockchain technology, smart contract programming, and advanced front-end development to create an engaging and innovative puzzle game. At its core, we use EVM and smart contracts written in Solidity. The primary contracts, 'ZKube' and 'ZKubePuzzleSet' (an ERC721 contract), manage the game logic and the creation of diverse puzzle sets, respectively. This setup allows for direct blockchain interactions, enabling players to engage with the game seamlessly via their browsers.

A key technological highlight is the implementation of zero-knowledge proofs (ZKPs), which are essential for validating puzzle solutions while maintaining privacy and fairness. This integration of ZKPs with blockchain technology is a standout feature, demonstrating a novel application in the gaming sphere.

The game (Inspired by Cube Composer) design features a grid-based puzzle layout on an 8x8 grid with four color options. This design strikes a balance between challenge and accessibility, while the encoding of this grid for Ethereum Virtual Machine (EVM) compatibility is a notable innovation. We adopted base4 encoding, later converted to hexadecimal bytes32, optimizing storage space and transaction efficiency on the EVM.

Partner technologies from the Ethereum ecosystem were integral, providing tools for smart contract development, testing, and deployment. This facilitated a streamlined development process and ensured the creation of secure and robust contracts.

A particularly clever aspect of the project is the efficient encoding technique for the EVM and the deterministic, yet random, puzzle generation method. These ensure minimal storage costs, optimize transaction processing, and maintain fairness and unpredictability in the gameplay. The project, therefore, stands as a testament to the innovative fusion of blockchain technology, cryptographic techniques, and modern web development practices, with its use of ZKPs in gaming and blockchain-based smart contract integration showcasing groundbreaking applications in these fields. The game revolves around the 'ZKube' smart contract, which manages all aspects of gameplay, including game creation, joining, puzzle selection, and resolution. Additionally, the 'ZKubePuzzleSet' contract, conforming to the ERC721 standard, allows the creation of diverse puzzle sets, contributing to the game's variability and community engagement. From a technical perspective, the game's front-end is developed using NextJS and deployed on Vercel, ensuring a smooth user experience. Interaction with the game is direct through the browser, negating the need for a traditional backend, although the specific blockchain for smart contract deployment is yet to be decided.

The game employs an 8x8 grid with four color options, utilizing base4 encoding for efficiency, which is then converted to hexadecimal bytes32 for compatibility with the Ethereum Virtual Machine (EVM). The game's design considers the balance between permutation complexity and storage efficiency, with color representation ranging from no color (0) to blue (3), and the grid is read from left to right, bottom to top. Future improvements aim to enhance game integrity by developing a zero-knowledge proof system to verify that players use only the provided functions. This structure not only challenges traditional puzzle-solving skills but also leverages advanced blockchain technology for a secure and transparent gaming experience.

background image mobile

Join the mailing list

Get the latest news and updates