Coder Social home page Coder Social logo

circom-bigint's Introduction

circom-bigint

Implementation of bigint arithmetic in circom.

Project overview

This repository provides proof-of-concept implementations of bigint arithmetic in circom. These implementations are for demonstration purposes only. These circuits are not audited, and this is not intended to be used as a library for production-grade applications.

Circuits can be found in circuits. scripts contains various utility scripts (most importantly, scripts for building an example zkSNARK using the bigint circuit primitive). test contains some unit tests for the circuits, mostly for witness generation.

Install dependencies

  • Run yarn at the top level to install npm dependencies (snarkjs and circomlib).
  • You'll also need circom version >= 2.0.2 on your system. Installation instructions here.
  • To build bigint circuits, you'll need to download a Powers of Tau file with 2^8 constraints and copy it into the circuits subdirectory of the project, with the name pot08_final.ptau. We do not provide such a file in this repo due to its large size. You can download and copy Powers of Tau files from the Hermez trusted setup from this repository.

Building keys and witness generation files

Run yarn build:bigint at the top level to compile a bigint related circuit.

This will create a subdirectory inside a build directory at the top level (which will be created if it doesn't already exist). Inside this directory, the build process will create r1cs and wasm files for witness generation, as well as a zkey file (proving and verifying keys).

This process will also generate and verify a proof for a dummy input in the respective scripts/bigint subdirectory, as a smoke test.

Benchmarks

Todo.

Testing

Run yarn test at the top level to run tests. Note that these tests only test correctness of witness generation. They do not check that circuits are properly constrained, i.e. that only valid witnesses satisfy the constraints.

Circuit unit tests are written in typescript, in the test directory using chai, mocha, and circom_tester. To run a subset of the tests, use yarn test --grep [test_str] to run all tests whose description matches [test_str].

Acknowledgments

This project was built during 0xPARC's Applied ZK Learning Group #1.

We use an optimization for big integer multiplication from xJsnark.

circom-bigint's People

Contributors

yi-sun avatar gubsheep avatar tloinuy avatar xu3kev avatar 0xbok avatar ecnerwala avatar junrui-liu avatar antimatter15 avatar

Stargazers

dybbuk avatar  avatar  avatar

circom-bigint's Issues

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.