Skip to main content

ZnaKes

python-version codecov License: LGPL v3 PRs Welcome FLAKE8

A one-stop client library which facilitates the creation of arguments for zero-knowledge Proofs. ZnaKes provide an easy interface to generate zk-friendly crypto primitives necessary in efficient circuits developed with popular tools such as ZoKrates, Circom, Noir and so on...

:warning: This is a proof-of-concept implementation. It has not been tested for production.

This repository code is primarily based from ZoKrates Pycrypto for the zkSNARKs toolbox ZoKrates. Nonetheless, we plan of adding more primitives support by other tools as well. Some of these primitives are:

  • Poseidon, mimc and pedersen hashes.
  • EdDSA signatures for multiple curves (BN254, BLS12_381...)
  • ... and more!

Install

Make sure you are running a python 3 runtime.

pip install ZnaKes

Example

For more examples of the package functionalities, take a look in the tests folder.

Create and verify Eddsa signature

Let's create a simple demo, called demo.py, in which we sign a hashed message with the BabyJubJub curve:

import hashlib

from znakes.curves import BabyJubJub
from znakes.eddsa import PrivateKey, PublicKey

if __name__ == "__main__":

    raw_msg = "This is my secret message"
    msg = hashlib.sha512(raw_msg.encode("utf-8")).digest()

    sk = PrivateKey.from_rand(curve=BabyJubJub)
    sig = sk.sign(msg)

    pk = PublicKey.from_private(sk)
    is_verified = pk.verify(sig, msg)
    print(is_verified)

Contributing

We happily welcome contributions. You can either pick an existing issue or create a new issue. Before that make sure you have read our CODE_OF_CONDUCT and CONTRIBUTION GUIDELINES

Please note that your submited contributions shall be licensed as below, without any additional terms or conditions.

Setup

First install the development packages via pip install -r requirements-dev.txt.

In addition this repo uses the python package pre-commit to make sure the correct formatting (black & flake) is applied and all tests pass. You can install it via pip install pre-commit.

Then you just need to call pre-commit install.

Acknowledgements

  • ZoKrates dev tem for providing a great starting point for this project and for the awesome tool ZoKrates.
  • jesse squires for the great CONTRIBUTING.md and CODE_OF_CONDUCT guidelines.
  • Josee9988 for the amazing issue templates.

License

This repo is released under the GNU Lesser General Public License v3.

Metadata

Release files for ZnaKes 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ZnaKes 0.1.1
File Size Uploaded
znakes-0.1.1.tar.gz 96.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ZnaKes 0.1.1
File Interpreter ABI Platform
znakes-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 118.2 kB

Release files / znakes-0.1.1.tar.gz

Download URL znakes-0.1.1.tar.gz
Size 96.6 kB
Tags Source
SHA-256 checksum
How to use checksums
5b6a011fa58995a6b9b2825e91247d59ea30c8e861709ae529f3be10569364bb
BLAKE2b-256 checksum
How to use checksums
44e88607194e07cb2b3b4d7f5290c6cb88cd8ed2b07e909f8f5c3a9506a11f09
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.8

Release files / znakes-0.1.1-py3-none-any.whl

Download URL znakes-0.1.1-py3-none-any.whl
Size 21.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
251e22861d552efc6591b472faae949b95c0b9b1513fc71f78e3d1f4d18f8c4e
BLAKE2b-256 checksum
How to use checksums
c902ed0674d431b8a3a042f9643fdb46ae1cb4db31d3a42f6a1a976c17200abd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.8

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page