Secret Codes Validator

The Secret Codes Validator allows you to reward customers who receive a special code—whether it’s after winning a competition, making a purchase, or attending an exclusive event. This validator drives engagement and ensures that rewards go directly to your most valued participants, creating memorable and secure brand experiences.

This mechanism uses Zero-Knowledge Proofs (ZKP) to let users prove they possess a valid code without ever revealing the code on the blockchain. This ensures both privacy and security for your organization and your users.


How to Configure the Secret Codes Validator

Organization registration form

  1. Set the number of codes:
    Choose how many unique secret codes you want to generate (for example, N codes).
  2. Automatic code generation:
    The platform will generate N pseudo-random secret codes for your campaign or event.
  3. Hash calculation:
    Each code is hashed using the Poseidon cryptographic hash function.
  4. Store hashes on-chain:
    Only the hashes (never the codes themselves) are stored in the smart contract, keeping your codes secure.

How Users Claim Rewards

  1. User receives a secret code:
    After winning or participating in an event, the user receives a unique code from your organization.
  2. User enters their code:
    To claim their reward, the user enters the code into the platform’s interface.
  3. Local hash calculation:
    The code is hashed locally (on the user’s device), ensuring the secret code is never sent over the internet or stored on-chain.
  4. Hash verification:
    The platform checks if the hash matches one of the valid hashes stored in the smart contract.
  5. Zero-Knowledge Proof generation:
    The user’s device generates a Zero-Knowledge Proof (ZKP) to prove that they know a valid code, without revealing the code itself.
  6. Submit claim:
    The user submits the generated proof by calling the claimReward method on the smart contract.
  7. Reward distribution:
    • If the proof is valid, the contract records that the code was used and distributes the reward tokens to the user.
    • Each code can only be used once, preventing double-claims.

💡 Tip:
The Secret Codes Validator is ideal for exclusive promotions, event-based campaigns, and any scenario where you want to reward users with a high level of security and privacy.