Giter Site home page Giter Site logo

pyzpk's Introduction

OpenMined-logo License Python 3.5,3.6,3.7

PyZPK

PyZPK is a Python wrapper for open-source Zero Proof Knowledge Library, libsnark. This library provides a set of zkSNARK schemes, a cryptographic method for proving/verifying, in zero-knowledge, the integrity of computations.

Installation

Build from Source

If you want to install PyZPK from the repository, you should make sure to have the requirements for your platform. Currently, it supports Linux.

  1. Clone this repository
$ git clone https://github.com/OpenMined/PyZPK.git
  1. Get the third party libraries and the requirements (if you did not already) by running the following command from the root directory of the project. This script automates the installation of the prerequisite packages to get you started.
$ cd PyZPK
$ bash ext_source_setup.sh
  1. Build the PyZPK library
$ bash build.sh

Support

PyZPK is part of the OpenMined community, join the rapidly growing community of 8000+ on Slack. The slack community is friendly and great about quickly answering questions and getting your doubts cleared plus; it is a great place to interact with fellow community members with similar interests such as yours. Click here to join our Slack community!

Contributing

Pull requests are welcome. For significant changes, please open an issue first to discuss what you would like to change. Read the OpenMined contributing guidelines and styleguide for more information.

Contributors

See the list of contributors who participated in this project.

License

Apache License 2.0

pyzpk's People

Contributors

benardi avatar codeboy5 avatar gargarchit avatar imraniac avatar shaanrockz avatar vineetjai avatar

Stargazers

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

Watchers

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

pyzpk's Issues

Rename PyZPK to PyZKP

What?

Rename the repo and package name, plus docs.

Why?

It seems that the better way to phrase / write the name is Zero-knowledge Proofs so to avoid future confusion this could be renamed.

Breakdown

  • Rename the repo from PyZPK to PyZKP
  • Rename all doc references to the acronym PyZPK to PyZKP
  • Rename all full worded names as well.
  • Create an alias on PyPI to the old package name to smooth the transition

Add Bindings for gadgetlib1 utils

Feature Description

gadgetlib1 is a low-level library which exposes all features of the preprocessing zkSNARK for R1CS.

  • Add Bindings for constraint_profiling
  • Add Bindings for gadget
  • Add Bindings for pb_variable
  • Add Bindings for protoboard

Add sphinx documentation

Feature Description

We need to create the first version of pyzpk lib docs.

The docs would be linked to a CI/CD testing environment to ensure that each new PRs to the stable branch does not break the documentation.

Here is the reference link for the sphinx documentation.

Getting Error while binding functions which use libff::random_element()

Description

Getting Segmentation fault while binding, functions which use random_element()
random_element() is defined in Libff: a C++ library for Finite Fields and Elliptic Curves
and it returns a random element of Fp_model

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff40b7c8c in libff::Fp_model<5l, libff::mnt46_modulus_B>::random_element() ()
    at /home/PyZPK/third_party/libsnark/depends/libff/libff/algebra/fields/fp.tcc:712
712                 r.mont_repr.data[part] &= ~(1ul<<bit);
(gdb) p part
$1 = 288230376151711743
(gdb) p r.mont_repr.data
$2 = {0, 0, 0, 0, 0}

One of the functions which use libff::random_element() is generate_r1cs_example_with_field_input and it is wrapped here

Expected Behavior

The value of part should be <5 for the data array = {0, 0, 0, 0, 0}

It was tested in libsnark library directly where it was working fine without any error.

System Information

  • OS: Ubuntu
  • OS Version: 18.04
  • Language Version: Python 3.7

How to test

The following test must pass after solving this error, currently generate_r1cs_example_with_field_input is producing the error mentioned above.

import pyzpk
qap_degree = 1 << pyzpk.mnt6_Fr_s  # basic_domain_size
num_inputs = 10
num_constraints = qap_degree - num_inputs - 1
# For Field input
example = pyzpk.generate_r1cs_example_with_field_input(num_constraints, num_inputs)
assert example.constraint_system.is_satisfied(example.primary_input, example.auxiliary_input)

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.