Git Product home page Git Product logo

plonk_gadgets's Introduction

Plonk Gadgets

Build Status Repository Documentation

This library cointains the gadgets that the Dusk-Network protocol needs to build it's ZK-Circuits. The library contains generic gadgets which are used across Dusk's tech stack, all of the other gadgets used which depend on foreign types are placed on the libraries where this types are defined.

WARNING

This implementation is not audited. Use under your own responsability.

Content

This library provides:

  • Scalar gadgets: is_non-zero, maybe_equals, conditionally_select_one, conditionally_select_zero.
  • Range gadgets: range_check, max_bound.

Acknowledgements

  • Conditional selection gadgets and AllocatedScalar structure have been taken from the ZCash sapling circuits and translated to the Plonk Constraint System language.

Licensing

This code is licensed under Mozilla Public License Version 2.0 (MPL-2.0). Please see LICENSE for further info.

About

Implementation designed by the dusk team.

Contributing

  • If you want to contribute to this repository/project please, check CONTRIBUTING.md
  • If you want to report a bug or request a new feature addition, please open an issue on this repository.

plonk_gadgets's People

Contributors

cperezz avatar jules avatar kevaundray avatar vlopes11 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

plonk_gadgets's Issues

Port BlindBid lib gadgets to this library

This will allow us to reduce the code complexity from other libraries that use gadgets such as the blindbid library.

  • Port single_complex_rangeproof from blindbidlib to here.

Implement decomposition gadget

The decomposition gadget for RC is currently being done in PLONK. However, it can be implemented in this repo by accessing the allocated scalars

Rangeproof gadget not working as expected

If we don't constrain the boolean output of the rangeproof. It should always pass. But this is not the case, and I tested that thanks to @kevaundray 's suggestions this morning.

Therefore, considering this, and that @kevaundray did a really nice commit with the same code but more readable and mantainable.
I think we should migrate to his code when working with this. This issue then, will be closed as soon as we merge @kevaundray 's version of the rangeproof gadget.

Implement El Gamal encryption gadget

The Encryption gadget has now been chosen to utilise the El Gamal encryption scheme. This needs to be added to the gadgets so they can be used in the token contract circuits.

Implement inverse_single_complex_rangeproof

We actually have the method single_complex_rangeproof which has been ported from dusk-blindbid in #12

This gadget works fine and it's tested. The problem is that it is only intended to work to prove that: witness < max_range (not a pow of 2).

But we also need to check sometimes the reverse operation, so: witness > min_range(not a pow of 2). And we cannot use the previous method for this.

Therefore, we need to implement a new gadget that works on that way and decomposes the witness also.

This will help in order to close dusk-network/dusk-blindbid#21

Implement basic Scalar gadgets for PLONK

We will need some basic BLS12_381 Fr / JubJub Fq in order to be able to built the tools required by #3 listed in #4 .

  • Implement is_non_zero gadget

  • Implement conditionally_selection gadget

  • Test is_non_zero gadget

  • Test conditionally_selection gadgets

Port the repo to plonk_v0.1.0

This is intended to set this repo inline with the actual status of plonk.
And have it as a container for all of the gadgets we use within the dusk_network protocol.

Basic ECC ops gadgets for PLONK with JubJub

This is the list of gadgets that we need to implement & test in order to implement #3 :

  • Implement Point addition gadget

  • Implement Point doubling gadget

  • Implement Point equalty gadget

  • Implement Curve Eq satisfaction gadget

  • Implement Scalar mul gadget

  • Implement ConditionallySelect gadget

  • Test Point addition gadget

  • Test Point doubling gadget

  • Test Point equalty gadget

  • Test Curve Eq satisfaction gadget

  • Test Scalar mul gadget

  • Test ConditionallySelect gadget

Change dependency for PLONK

Currently the gadgets rely upon a very outdated version of plonk. Which we no longer use. This needs to be changed for the whole dependency refactor.

This is tied to issue 47 on the phoenix repo, where we need to refactor types across the github.

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.