About
### Project Overview
At its core, the project is an engaging quiz game where users answer multiple-choice questions. The game is enhanced with Web3 features such as authentication, payment, and verification using WorldCoin’s MiniKit. Users can sign in via a WorldCoin-based OAuth provider, participate in the game, and even perform blockchain-based payments or verifications—all within a responsive, dynamic interface.
---
### Key Technologies & Architecture
- **Next.js & React:** The application leverages Next.js for server-side rendering, routing, and API endpoint creation. The UI is built with React components, using functional components and hooks for state management and effects.
- **TypeScript:** Code is type-checked for reliability and better developer experience.
- **Tailwind CSS:** Styling is primarily handled with Tailwind CSS along with some custom CSS, ensuring a responsive and modern design.
- **WorldCoin MiniKit Integration:** The project integrates WorldCoin’s MiniKit to facilitate:
- **Authentication:** Users can sign in using a WorldCoin OAuth provider integrated with NextAuth.
- **Payment:** The app supports initiating and confirming payments using blockchain tokens.
- **Verification:** Users can verify their identity or actions via cryptographic proofs processed through WorldCoin’s verification endpoints.
- **NextAuth:** Provides session management and authentication flows. It supports multiple providers, with WorldCoin as the key authentication provider.
- **Eruda:** A debugging console (integrated conditionally in non-production environments) to assist with client-side debugging during development.
---
### Detailed Components & Functionality
#### 1. **Layout and Global Styling**
- **`layout.tsx`:** Establishes the global structure of the app. It wraps children components with providers such as `NextAuthProvider`, `MiniKitProvider`, and conditionally, an Eruda debugging console. - **`globals.css`:** Contains base styles and Tailwind directives, along with CSS custom properties for theming (supporting dark mode).
#### 2. **Authentication Flow**
- **NextAuth Provider:** Configured in `/api/auth/[...nextauth]/route.ts`, it integrates a WorldCoin OAuth provider and handles sign-in callbacks. - **`SignIn` Component:** Provides a simple UI to sign in (or sign out) using NextAuth. It listens for session changes to update the application state.
#### 3. **Quiz Game Mechanics**
- **Game Module:** The game (located under `./Game/modules/Game.tsx`) randomly selects a set of questions from a JSON data file. - **Game Logic:** Manages state for player and opponent scores, question progress, timer countdown, and answer selections. - **Scoring:** Based on how quickly a correct answer is provided, using a decreasing exponential function to calculate scores. - **UI Components:** - **`Question`:** Displays the current question text. - **`AnswerOptions`:** Renders available answer buttons with visual feedback (e.g., correct/wrong highlights and icons). - **`Timer`:** A countdown component that has been enhanced to include a progress bar that visually shrinks as time runs out. When only a few seconds remain, the progress bar shakes and displays a bomb emoji to heighten urgency.
#### 4. **Enhanced Timer Component**
- The timer has been transformed into a progress bar that reacts to time pressure: - **Visual Feedback:** As the timer counts down, the progress bar width decreases. When time is critically low (e.g., 3 seconds or less), it shakes to simulate a bomb about to go off. - **User Engagement:** The bomb emoji and shaking effect create a sense of urgency, enhancing the user experience during the quiz.
#### 5. **WorldCoin MiniKit Integration** - **Payment Flow:** - **Initiation:** The `/api/initiate-payment/route.ts` endpoint generates a unique payment nonce, stored in cookies. - **Confirmation:** The `/api/confirm-payment/route.ts` endpoint verifies that the received transaction matches the initiated payment by comparing the nonce and checking the transaction status via WorldCoin’s API. - **UI Component (`PayBlock`):** Invokes the MiniKit pay command and processes the response, displaying success or failure messages. - **Verification Flow:** - **Backend Verification:** The `/api/verify/route.ts` endpoint accepts a payload from MiniKit’s verification command, verifies the cryptographic proof using WorldCoin’s `verifyCloudProof` method, and returns a success or error status. - **Frontend Integration:** The `VerifyBlock` component initiates the verification process and displays the result, enabling developers to handle user verification seamlessly.
---
### Additional Aspects
- **Dynamic Imports & Client-Side Only Components:** Certain components (e.g., Eruda and MiniKit integrations) are dynamically imported to ensure they run only on the client side, preserving server-side rendering capabilities.
- **State & Animation:** The game uses React state hooks and CSS animations (for shaking effects) to provide a lively and interactive user experience.
- **Debugging & Development:** Eruda integration helps developers debug the client-side behavior without impacting the production experience.
Prizes
- World · World Pool Prize · World Pool Prize
From the public ETHGlobal showcase page. Votes, swipes and the judge score are hackfeed's own.






