Giter Site home page Giter Site logo

zk-draw's Introduction

zk-draw

Verifiable random draw with zero-knowledge of the random seed

How to run

  1. Install dependencies
yarn
  1. Start server
yarn dev
  1. Enter localhost:3000/ to your browser.

wasm packages are built on x86_64-unknown-linux-gnu.
For other platforms, change target in circuits/.cargo/config appropriately, and run yarn build:wasm before starting the server.

How to play

Guess the random lotto number in range [0, 2^32). Keep your input secret until the random number is generated! 0. Calculate keccak hash of your lotto number.

  1. Copy and paste the hash value. Server knows nothing about your lotto number.
    Enter Hash
  2. Generate lucky number. We will also verify that server generated random value correctly. If server didn't generate the random value honestly, verification will fail.
    HonestServer MaliciousServer
  3. If your guess was correct, provide your lotto number as proof. Server will check that your number actually calculates to the hash you committed. If you try to cheat after seeing the random number, the hash wouldn't match so that server will decline your proof.
    Sucess Fail

Description

Random number generation circuit originates from halo2-gacha.
The idea is based on linear-congruential-generator, which gives pseudo-random values from seed. We wrote the circuit with halo2, generating proof that the output random_value is computed correctly, while server keeps the seed secret.

Our model is based on the situation where the user and server of a game doesn't believe each other. Imagine the gacha (vending machine) games.

  • Users don't believe that the server generated the gacha result "randomly".
  • If server reveals the random seeds to show honesty, malicious users might capture the trend of seed generation.

We solve the problem with zero-knowledge circuit, where

  • User can verify that the random number is the result of random number generator.
  • Server can keep the seed secret.

Maintainers

PSESC_halo2 team @ Ethcon Korea 2023

zk-draw's People

Contributors

jae-cuz avatar

Stargazers

Chutian Yang avatar Suning Yao avatar Seongsu Jeon avatar Kurt Pan avatar Sora Suegami avatar DoHoon Kim avatar Sigrid Jin (ง'̀-'́)ง oO avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.