TESTING PHASE: This smart contract quiz is currently in TESTING PHASE. While we have thoroughly tested the contract logic, unforeseen issues may occur. By participating, you acknowledge and accept that we cannot be held liable for any failure of the smart contract or inability to claim prizes.
Educational Purpose & Legal Compliance
This is a Free Educational Demonstration
This quiz is provided completely free of charge to all participants as an educational demonstration of Cardano smart contract technology
The primary purpose is to encourage learning about and adoption of the Cardano blockchain ecosystem
A small ADA prize is included solely to provide incentive for participation and engagement with the technology
No payment, purchase, or consideration of any kind is required to enter or participate
Entry codes are provided free of charge and serve only to prevent automated bot submissions
This does not constitute a lottery, gambling, or gaming activity under UK law, as entry is free and based on skill (quiz performance)
Independence & Fair Play
Delegating to our stake pool (GNP1) or providing any other form of support does NOT affect your chances of winning
All participants have completely equal opportunities regardless of whether they support our pool
Winners are determined purely by quiz performance (highest score)
The smart contract enforces fair play โ no one, including pool operators, can manipulate results
All results are transparently recorded on the Cardano blockchain for public verification
Participation Terms
This is a free educational demonstration of smart contract technology
No payment or purchase is required to participate
Entry codes are provided free to prevent automated submissions
All participants have equal chances โ staking with our pool does not affect quiz results
Winners must have the highest scores โ ties broken by submission time
Privacy Notice
By submitting your entry, you acknowledge that:
You must select a username from the available drop-down lists in order to maintain your privacy and prevent inappropriate content ending up on the blockchain
Your username (hashed) and wallet address will be stored permanently in the on-chain datum and cannot be removed
All submissions are recorded in transaction metadata with cleartext usernames
The Cardano blockchain is public and immutable โ this data is permanent
We recommend using a secondary wallet if privacy is a concern
Usernames are for anonymity only and do not imply endorsement by any named individual
โน๏ธ How This Smart Contract Works
Answer quiz questions, get your score recorded on the Cardano blockchain, and the highest scorer wins ADA. It's free to play and nobody can cheat โ the blockchain enforces everything.
๐ฎ Playing the Quiz
Get a free access code โ pick a username โ enter your wallet address โ answer questions (5 seconds each, +2 correct, -1 wrong, 0 timeout). Your score is then submitted to the blockchain.
๐ Why Nobody Can Cheat
The correct answers are already stored on the blockchain as encrypted hashes. When you finish, the smart contract checks every answer itself and calculates your score independently. If the score doesn't match, the transaction is rejected. Nobody โ not even the admin โ can submit a fake score.
๐ The Prize
The ADA prize is locked in the smart contract. When the quiz ends, the contract reads all 5 pool leaderboards, finds the top scorer, and pays them automatically. If unclaimed after 48 hours, the admin can reclaim the funds so nothing gets stuck.
๐ Fully Transparent
Every submission is a real Cardano transaction on Cardanoscan. The source code is open. Your full quiz results are encrypted in the transaction and can be decrypted with your access code on the verification page.
Want the full technical breakdown? Switch to the ๐ง Technical Details tab above.
Overview
This is a trustless, decentralized quiz system built on the Cardano blockchain using Plutus V2 smart contracts. Every answer is verified on-chain via hash comparison, the leaderboard is immutable, and the prize can only go to the winner โ no one can cheat or manipulate results.
Key Features:
Multi-Pool System: 750 questions across 5 rotating pools (150 questions each) to bypass blockchain size limits
On-Chain Score Verification: The smart contract independently recalculates your score by comparing each submitted answer hash against the stored correct hashes (+2 correct, -1 wrong, 0 unanswered)
Salted Hashing: Answers are hashed with a secret salt to prevent rainbow table attacks
Immutable Leaderboard: Top 9 scores per pool are permanently recorded on the blockchain
Trustless Prize: ADA locked on-chain, distributed via reference input aggregation across all 5 pools
Admin Signature: All submissions require the admin's cryptographic signature, preventing unauthorized transactions
Encrypted Audit Trail: Full question/answer details encrypted in transaction metadata, decryptable only by the player
Transparent: All code and contract addresses are publicly available
Complete Process Flow
๐ Step 1: Access Code Request
User requests an access code from the pool operator
Each code can only be used once (validated server-side)
Codes are free โ they only prevent automated bot submissions
๐ฏ Step 2: Pool Assignment
When user starts quiz, server auto-assigns a pool via rotation (1โ2โ3โ4โ5โ1...)
Ensures even distribution across 5 pools
Each pool has 150 unique questions โ user gets a random subset
โ Step 3: Question Selection
Random questions selected from assigned pool's 150 questions
Multiple choice options shuffled randomly
User has 5 seconds per question โ quick thinking required!
โ๏ธ Step 4: Scoring
+2 points for a correct answer
-1 point for a wrong answer
0 points if you skip (run out of time)
Minimum score is 0 (can't go negative)
๐ Step 5: Server-Side Processing
Server compares user's answers with correct answers and calculates score
Each answer is hashed with a secret salt: SHA256(answer + salt)
Question indices and answer hashes are sorted by index position for efficient on-chain verification
Access code uniqueness is validated server-side, backed by the admin's cryptographic signature
โ๏ธ Step 6: On-Chain Score Verification
Transaction built with sorted answer hashes, question indices, username hash, and wallet address
The smart contract walks through the correct answer list in a single pass, comparing each submitted hash against the stored correct hash
Score calculated on-chain: +2 if hashes match (correct), -1 if they don't (wrong), 0 for empty hashes (timeout)
The on-chain calculated score must match the score in the output datum โ if not, the transaction is rejected
Admin signature required โ prevents any unauthorized submissions
Nobody can submit a fake score โ the blockchain independently verifies every answer
๐ Step 7: Leaderboard Update
New entry inserted into leaderboard sorted by score (highest first)
Only top 9 entries kept per pool (for blockchain size limits)
All submissions also recorded locally for complete history
Full question-by-question results encrypted and stored in transaction metadata
๐ Step 8: Prize Claiming (After Quiz Ends)
Winner initiates claim on the claims page
Smart contract uses reference inputs to read all 5 quiz pool leaderboards simultaneously
Leaderboards are aggregated and sorted to find the true overall winner across all pools
Validator checks: quiz ended, prize not yet awarded, all 5 pools present, winner's score meets minimum threshold
ADA sent directly to winner's wallet address โ fully automated, no human involvement
โฐ Step 9: Unclaimed Prize (After 48h Deadline)
If winner doesn't claim within 48 hours of quiz end
Admin can reclaim prize funds
This protects against locked funds if winner loses access
Why This Is Trustless
On-Chain Score Verification: The smart contract recalculates every score by comparing answer hashes โ fake scores are mathematically impossible
Answer Hashing: Correct answers locked on-chain as salted hashes before anyone takes quiz
Immutable Results: Once submitted, scores cannot be changed by anyone
Reference Input Aggregation: Prize claiming reads all 5 pool leaderboards to determine the true overall winner
Encrypted Audit Trail: Full quiz details encrypted in transaction metadata, decryptable by the player using their access code
Verifiable: Anyone can verify all transactions on Cardanoscan
Prize Locked: ADA provably locked, can only go to winner or admin (after deadline)
Open Source: All code publicly available for audit
Technical Architecture
Multi-Pool Design:
The 16KB datum size limit would only allow ~150 questions per UTxO. By deploying 5 separate quiz pool UTxOs (each with 150 questions) plus 1 prize pool UTxO, we achieve 750 total questions while staying within blockchain limits. Each pool is identified by its unique ADA amount (40, 40.1, 40.2, 40.3, 40.4 ADA), and users are automatically rotated between pools for even distribution.
Efficient On-Chain Scoring (V1007):
The validator uses a sorted single-pass algorithm to verify scores. Question indices are pre-sorted so the contract walks through the answer list just once, comparing hashes as it goes. This keeps memory usage constant regardless of how many questions are answered, allowing the contract to handle the full question set within Cardano's execution budget.
Raw BuiltinData Navigation:
The validator uses raw BuiltinData field access to avoid deserializing expensive datum fields. For ClaimPrize, reference inputs are processed by extracting only the leaderboard (field 1) and isPrizePool flag (field 6), completely skipping the 150 answer hashes. This makes prize claiming cost independent of question count and entry count.
The core validator logic written in Haskell/Plutus. This code is compiled to Plutus Core and runs on-chain.
V1007 Optimisations:
โข Raw BuiltinData navigation for both SubmitAnswers and ClaimPrize
โข On-chain score verification (+2 correct, -1 wrong, 0 unanswered)
โข Multi-pool system with 5 quiz pools (750 questions total)
โข Trustless prize pool with 48-hour claim window
โข Constant memory cost per submission โ no on-chain entry code storage
Loading Haskell source code...
Compiled Plutus Script
CBOR-encoded Plutus Core bytecode that runs on the Cardano blockchain.
Script Address: addr1w9grfwuzcqz690cperhxkwan790fwtf76d4km57aa6mu6dq0mprss Verification:View on Cardanoscan
Loading Plutus script...
Current On-Chain Datum Structure
Each of the 5 quiz pools stores 150 salted answer hashes and up to 9 leaderboard entries.
Datum Fields:
โข Field 0: correctAnswers[150] โ SHA256(answer + salt)
โข Field 1: leaderboard[9] โ Top scores with username hashes and wallet addresses
โข Field 2: usedCodes[] โ Legacy field (code validation is now server-side only)
โข Field 3: adminPkh โ Required signer for submissions
โข Field 4: endTime โ Quiz deadline (POSIX timestamp)
โข Field 5: prizeAwarded โ Boolean flag
โข Field 6: isPrizePool โ Boolean (false for quiz pools, true for prize pool)
โข Field 7: prizeAmount โ Prize in lovelace
โข Field 8: minPayoutScore โ Minimum score to claim prize
โข Field 9: numQuestions โ Questions per player
Multi-Pool System:
This quiz uses 6 UTxOs at the same contract address:
โข Pool 1: 40 ADA (150 questions)
โข Pool 2: 40.1 ADA (150 questions)
โข Pool 3: 40.2 ADA (150 questions)
โข Pool 4: 40.3 ADA (150 questions)
โข Pool 5: 40.4 ADA (150 questions)
โข Prize Pool: Variable ADA (for winner payout)
Click "Load Live Datum" to query current on-chain data.
Contract UTxOs & Locked ADA
Live query of all UTxOs at the smart contract address showing total ADA locked across all pools.
Contract Address: addr1w9grfwuzcqz690cperhxkwan790fwtf76d4km57aa6mu6dq0mprss Network: Cardano Mainnet Verification:View on Cardanoscan
Total UTxOs
-
Total ADA Locked
-
Query Time
-
Click "Refresh UTxO Data" to query the blockchain.
Cardano CLI Transaction Commands
Standard cardano-cli commands used to interact with the smart contract. Sensitive paths and keys have been sanitized.
Pool Identification:
Pools are identified by their exact ADA amount:
โข Pool 1: 40,000,000 lovelace (40 ADA)
โข Pool 2: 40,100,000 lovelace (40.1 ADA)
โข Pool 3: 40,200,000 lovelace (40.2 ADA)
โข Pool 4: 40,300,000 lovelace (40.3 ADA)
โข Pool 5: 40,400,000 lovelace (40.4 ADA)
โข Prize Pool: Variable lovelace
โ What the Smart Contract DOES Verify (Trustless, On-Chain):
1. Every Answer is Verified On-Chain
For each question, the validator takes the player's submitted answer hash and compares it against the correct answer hash stored in the datum. The score is calculated on-chain using the formula: +2 for correct, -1 for wrong, 0 for unanswered (timeout). This happens inside the Plutus validator โ no server, no human, no trust required.
2. Entry Code Validation
Entry code uniqueness is enforced server-side, backed by the admin's cryptographic signature on every transaction. The admin signature guarantees that only verified, unique codes are accepted โ no duplicate entries can be submitted without the admin's authorisation.
3. Time Window Enforcement
The validator enforces that submissions can only occur before the quiz end time, and prize claims can only occur within 48 hours after the quiz ends. These time constraints are checked on-chain using Cardano's validity interval.
4. Admin Signature Required
Every submission transaction must be signed by the admin's private key. This prevents unauthorised parties from submitting transactions to the contract.
5. Answer Count Validation
The validator confirms that the number of submitted answers matches the configured question count, and that the number of indices matches the number of answers.
6. Pool Segregation
The validator ensures that submissions only go to quiz pools (not the prize pool), preventing accidental or malicious prize pool modifications.
7. Prize Distribution
When claiming the prize, the validator aggregates leaderboards from all 5 quiz pools using reference inputs, determines the winner, and ensures the correct prize amount is paid to the winner's wallet address. No human involvement in prize distribution.
โ ๏ธ What the Smart Contract Does NOT Do:
1. Output Datum Construction
The validator does not verify that the updated datum (with the new leaderboard entry) is constructed correctly. The server builds the output datum, and the admin signature authorises it. This is a deliberate design choice to reduce on-chain memory usage, enabling 30 questions per quiz. The previous version (V1004) verified the output datum but was limited to fewer than 10 questions due to Cardano's 14M memory unit budget.
2. Question Selection
The validator does not control which questions are selected from the pool of 150. Question selection is handled server-side to ensure randomness and variety. The validator only checks that the submitted answer hashes correspond to valid question indices.
๐ On-Chain Metadata โ Full Audit Trail:
Every submission transaction includes permanent, immutable metadata on the Cardano blockchain containing:
Public (readable by anyone on CardanoScan):
โข Username and truncated wallet address
โข Final score and pool assignment
โข Per-question results: correct (+2), wrong (-1), or timeout (0) for every question
โข Timestamp of submission
Encrypted (decryptable only by the player):
โข Full question text for every question asked
โข The player's answer for each question
โข The correct answer for each question
โข Encrypted using AES-256-CBC with the player's entry code as the key
Players can decrypt their full quiz results at the quiz verification page using their access code. This data is permanent โ it cannot be altered or deleted by anyone, including the quiz administrator.
๐ How to Independently Audit a Quiz:
Step 1: Find the Transaction
Look up any submission transaction on CardanoScan. The metadata shows the per-question results and encrypted detail.
Step 2: Verify the Score
Count the per-question results in the metadata: each "correct" = +2 points, each "wrong" = -1 point, each "timeout" = 0 points. Confirm the total matches the recorded score.
Step 3: Verify Answer Hashes (Advanced)
The transaction's redeemer contains the player's answer hashes and question indices. The datum contains the correct answer hashes. If the salt were disclosed, anyone could independently verify each answer by hashing it with the salt and comparing against the datum. The salt is kept secret during and after the quiz to protect the answer set for future use.
Step 4: Verify the Validator Executed
The transaction on CardanoScan shows the script execution with CPU and memory units consumed. This proves the Plutus validator ran and approved the transaction โ the score was genuinely verified on-chain, not just recorded.