GithubHelp home page GithubHelp logo

noway / nzcb-circom Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 1.0 1021 KB

NZ COVID Badge - ZK-SNARK repo

Home Page: https://nzcb.netlify.app

License: MIT License

Shell 0.13% Makefile 6.94% JavaScript 92.93%
airdrop circom covid-19 newzealand nzcp snarkjs vaccine vaccine-passports zk zk-snarks

nzcb-circom's Introduction

NZ COVID Badge - ZK-SNARK repo

Info & FAQ

Read the website for more info.

Technical info

Based on NZCP.circom

How it works

The circuit takes in the following private inputs:

The circuit outputs the following public inputs:

  • nullifierHashPart - the blinded sha512 hash of the credential subject of the NZ COVID Pass. That is your given name, family name and date of birth delimited by comma. The blinding is done by taking 256 bits of the 512 bit hash, therefore one blinded hash can represent 2256 identities.
  • toBeSignedSha256 - the SHA256 hash of the toBeSigned value.
  • exp - the expiry date of the NZ COVID Pass.
  • data - 20 bytes of pass-through data that is used for the receiving address (MEV protection)

NZ COVID Pass verification

The circuit does not verify the signature of the NZ COVID Pass. It merely proves that an identity is associated with the NZ COVID Pass, be it signed or unsigned. The user may not be in a possession of a valid signature for the ToBeSigned value that is provided.

The signature is verified in the solidity contract.

Limitations

For live passes:

  • The length of the ToBeSigned value is limited to 351 bytes.
  • The length of the credential subject string (defined as ${familyName},${givenName},${dob}) is limited to 64 bytes.

Tests

  • Create .env file in the root directory of the project
  • Populate it with at least 1 live pass URI.
    • Use .env.example as a reference.
  • Run make test

Plonk proving key generation

  • powersOfTau28_hez_final_21.ptau from https://github.com/iden3/snarkjs#7-prepare-phase-2 was used to generate the Plonk proving key. Blake2b hash is 9aef0573cef4ded9c4a75f148709056bf989f80dad96876aadeb6f1c6d062391f07a394a9e756d16f7eb233198d5b69407cca44594c763ab4a5b67ae73254678
  • nzcp_example_final.zkey b2sum is 0a1979ca92cc7bcd608b0a5eb7d5252959ab17ffa69758dab8f17a44a83e842d61aa5709bde426215beca4296d7f1ddb86aadd66708717f484ce7295c8f8250c
  • nzcp_live_final.zkey b2sum is edab1c7534d26b495ac0ac779b4fa9f2c75bc89fe9c38ed0a2767b0c390d7bd53594e27a3e106696c6186e82c27e6683f87fbe58d38f1190990971fea37d173f

The key was generated using the plonk_example and plonk_live tasks in Makefile.

Tech Spec

Related repos

License

MIT License

nzcb-circom's People

Contributors

noway avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Forkers

zk-apps

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.