zkPass
You need to login in order to like this zkApp. Click Here
zkPass
You need to login in order to like this zkApp. Click Here
Adventrue - A True Adventure!
Built during zkHack Krakow 2024 - (Awarded Honourable Mention) The Problem Adventrue Solves: Adventrue leverages zero-knowledge proofs (zk) to verify that users have successfully solved puzzles. This approach ensures the integrity and authenticity of the solution process while providing a flexible framework for various applications. Challenges We Ran Into: We aimed to integrate GPS location verification to add another level of authenticity. Additionally, we explored incorporating Protokit to store progress as on-chain state, enhancing the game’s functionality and user experience.
A True Adventure, with zk
Adventrue allows users to complete and create “treasure hunt” style quiz games with prizes on the Mina blockchain. Mina is a lightweight (22kb) zero-knowledge blockchain with smart contract functionality. We utilized Mina’s o1js smart contract to enable users to create their own quest games, blending off-chain and on-chain elements seamlessly.
How It Works:
- Create Quiz Games: Users can create quiz games and set a fixed prize for the first user to complete the quiz.
- Join Quiz Games: Participants can join a quiz game using the smart contract public key.
- Answer Questions: The game involves physical in-person questions, and users submit their answers on-chain.
- Claim Prizes: If the answers are correct, the contract allows the user to claim the prize.
Example:
In our example, we used Krakow as the inspiration for the questions, making them solvable within a short timeframe. The reward for solving the puzzles can vary, including testnet MINA, a MINA NFT, or even a physical prize.
Potential for Expansion:
- Geolocation Integration: Future versions could integrate zkLocus or another proof of geolocation to ensure users are at the specified locations.
- Progress Tracking: Using Protokit, we could manage progress through the game with on-chain state updates after each question rather than just at the end.
- Time-Sensitive Contracts: Introducing contracts with time limits, such as a 10-block time window (equivalent to 30 minutes on Mina devnet), could add urgency and excitement to the game.
Interesting Code Snippets:
Here are some interesting code lines from the Adventrue project: Smart Contract Initialization:
const { isReady, shutdown } from ‘snarkyjs’; const { Adventrue } = require(‘./Adventrue’);
await isReady; console.log(‘SnarkyJS is ready’); const adventure = new Adventrue();
Creating a New Game:
async createGame(gameId, questions, answers, prize) {
this.gameId = gameId;
this.questions = questions;
this.answers = answers;
this.prize = prize;
console.log(Game created with ID: ${gameId}
);
}
Submitting Answers:
async submitAnswers(userAnswers) { if (this.verifyAnswers(userAnswers)) { console.log(‘Answers are correct. Claiming prize…’); this.claimPrize(); } else { console.log(‘Incorrect answers. Try again.’); } }
Verifying Answers:
verifyAnswers(userAnswers) { for (let i = 0; i < userAnswers.length; i++) { if (userAnswers[i] !== this.answers[i]) { return false; } } return true; }
Claiming the Prize:
async claimPrize() { // Code to transfer the prize to the user console.log(‘Prize claimed successfully!’); }
Overview of the Code: The source code for Adventrue is available on GitHub, providing a comprehensive look at the implementation details and the various components that make up the game. View the code on GitHub Visit website www.adventrue.org
With Adventrue, embark on a true adventure, solving puzzles and earning rewards, all secured by the power of zero-knowledge proofs on the Mina blockchain.
Categories: Mina Ecosystem , Infrastructure , Community Ecosystem ,