Coder Social home page Coder Social logo

fpgaq / zkproofofbuffiness Goto Github PK

View Code? Open in Web Editor NEW

This project forked from 0xmarto/zkproofofbuffiness

0.0 0.0 0.0 8.13 MB

One of the many cool implementations of a zkProofOfOwnership platform developed for the ETHDenver 2022 hackaton.

License: MIT License

HTML 3.82% TypeScript 66.72% Shell 10.02% JavaScript 19.07% CSS 0.36%

zkproofofbuffiness's Introduction

zkProof Of Buffiness - ETH Denver 2021

Live & deployed contracts

Vision

Hi anon, join us at ZKPoB and prove that you are a Bufficorn without revealing anything about yourself other than your Buffiness

Description

zkPoB is a mobile compatible tool that lets anyone prove they own a Bufficorn (or any NFT) without revealing which Buffi they own or the address they are verifying themselves with

Mobile first

How it works

Let's say you want to organize an event in which only a set of addresses can participate (for ETH Denver we will use the set of addresses that own a Bufficorn). When a guest arrives you must check that they were invited (ie. their address owns at least one Bufficorn)... but your guests are a bunch of anons that do not want to reveal their address or any data that may point to their address, such as an NFT number (Bufficorn holders love privacy).

Sounds like a bit difficult, or almost impossible... but.. here is where we can use ZKProofs.

With ZKPoB, the host can sign a set of messages with their private key. The messages consist of a tuple (address, event_id) that lists the addresses that can attend the event with the host's signature... (kind of taking an snapshot at certain block of all the Bufficorn holders).

ZKPoB will construct a circom circuit that will take the following inputs:

  1. the guests' addresses and event id signed by the host previously chosen from the pre-computed set;
  2. any message signed by the guest.

The circuit will:

  1. verify that the host signature is valid, obtaining a guest address and the event id;
  2. check that the event id is for the aforementioned event;
  3. verify the guest's signed message therefore verifying the guest's address;
  4. check that guest address obtained in 1, and the guest address obtained in 3 are equal.

The circuit output will be:

  1. True if the circuit conditions are met;
  2. A valid ZKProof, proving that the guest is in!
  • Note: the circuit will fail and will not be able to generate a proof if the guest is not a Bufficorn holder.

ZKPoB will also generate a verifier and deploy a contract to the blockchain.

Guests can browse the host's site and generate a proof of buffiness, storing it as a QR code in their mobile device.

When a guest arrives at the event, a doorman can verify the proof by reading the QR code containing the proof and calling the verifier contract through a mobile app. If the verification succeeds, the guest can go in without disclosing any information about them.

The app will also save in a list the already verified proofs to avoid a "double spend" (ie. two or more guests going in using the same proof).

  • Note: If a malicious guest generates a proof and then transfers his Bufficorn to a another address, they will not be able to cheat, as the snapshot taken by the host maps only one address per Bufficorn.

Authors

๐Ÿ‘ค Agustin Zavalla - https://github.com/azavalla

๐Ÿ‘ค Emilio Garcia - https://github.com/danielemiliogarcia

๐Ÿ‘ค Jose Baredes - https://github.com/josebaredes

๐Ÿ‘ค Martin Sanchez - https://github.com/martinlsanchez

Implemented using SnarkJs and Circom circuit compiler.

SNARKJS > https://github.com/iden3/snarkjs

CIRCOM LIB > https://github.com/iden3/circomlib

Requirements

# RUST (how to install rust)
curl --proto '=https' --tlsv1.2 https://sh.rustup.rs -sSf | sh
git clone https://github.com/iden3/circom.git
cd circom
cargo build  --release
cargo install --path circom

# snarkjs
npm install -g snarkjs


Development Scripts

 sh run_all.sh
 sh collect_static.sh

Start Dapp locally

cd dapp
npm i
npm run start

Inspired by some awesome ETH DENVER folks:

Disclosure

The circuit described in this ReadMe is slightly different than the one applied in the app, as we had only 48 hours to build it :).

The circuit used in the app is a simplified version of the one described as the mobile app currently performs a few of the checks that would be performed by the circuit.

However, it should not take us that much longer to implement the full circuit in the future!

Show your support

Give a โญ๏ธ if you like this project!

zkproofofbuffiness's People

Contributors

0xmarto avatar azavalla avatar danielemiliogarcia 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.