Example - ZKquiz
Introduction
This program leverages Aligned's ZK verification infrastructure to run a small quiz. If answered correctly, the user receives an NFT.
The process is as follows:
The user runs ZKQuiz and answers the questions.
ZKQuiz generates a ZK Proof of correct answers.
The proof is posted on Aligned.
Upon verification, ZKQuiz mints an NFT via a Smart Contract.
The NFT is only granted if the user answers correctly. Incorrect answers or tampering with the ZKQuiz code will result in proof generation failure or mismatched checksums, preventing NFT minting.
Next, we will see how to execute ZKQuiz to get your own ZKQuiz NFT!
Requirements
Usage
1 - Create Keystore
You can use cast to create a local keystore. If you already have one, you can skip this step.
Then you can import your created keystore using:
Then you need to get some funds to pay for gas and proof verification. You can do this by using this faucet
2 - Answer Quiz
To answer quiz questions run:
This will:
Ask quiz questions
Generate ZK proof
Pay & submit proof to aligned for verification
Wait for proof to be verified in aligned
Claim NFT if proof is verified
Last updated