dalek-cryptography / zkp

Licence: other
Experimental zero-knowledge proof compiler in Rust macros

Programming Languages

rust
11053 projects

Projects that are alternatives of or similar to zkp

crypto-in-action
algebra arithmetic, finite fields, elliptic curves, zero-knowledge
Stars: ✭ 65 (-46.28%)
Mutual labels:  elliptic-curves, zero-knowledge
schnorr-nizk
Schnorr Protocol for Non-interactive Zero-Knowledge Proofs
Stars: ✭ 67 (-44.63%)
Mutual labels:  elliptic-curves, zero-knowledge
zk
Cross-platform zero knowledge proofs
Stars: ✭ 44 (-63.64%)
Mutual labels:  zero-knowledge
noble-ed25519
Fastest JS implementation of ed25519, x25519 & ristretto255. Independently audited, high-security, 0-dependency EDDSA signatures and ECDH key agreement
Stars: ✭ 220 (+81.82%)
Mutual labels:  elliptic-curves
hazmat-math
Hazmat ECC arithmetic for Cryptography.io
Stars: ✭ 28 (-76.86%)
Mutual labels:  elliptic-curves
btclib
btclib: a python3 library for 'bitcoin cryptography'
Stars: ✭ 60 (-50.41%)
Mutual labels:  elliptic-curves
autovpn2
OpenVPN VPN Gate Client for Linux, connects you to a random Free VPN in a country of your choice by country code.
Stars: ✭ 30 (-75.21%)
Mutual labels:  zero-knowledge
wordlines
Mobile ZK Puzzle Game with NFT rewards
Stars: ✭ 180 (+48.76%)
Mutual labels:  zero-knowledge
ecurve
DiffieHellman, Elgamal, ECDSA & STS with elliptic curve in python
Stars: ✭ 19 (-84.3%)
Mutual labels:  elliptic-curves
bls-js
BLS signature implementation
Stars: ✭ 15 (-87.6%)
Mutual labels:  elliptic-curves
BulletproofJS
Set of JavaScript based tools and Ethereum Solidity contracts for BulletProof based range proofs and confidential transactions
Stars: ✭ 26 (-78.51%)
Mutual labels:  elliptic-curves
snarkOS
A Decentralized Operating System for Zero-Knowledge Applications
Stars: ✭ 1,302 (+976.03%)
Mutual labels:  zero-knowledge
libeddsa
cryptographic library for ed25519 and curve25519
Stars: ✭ 20 (-83.47%)
Mutual labels:  elliptic-curves
nim-blscurve
Nim implementation of BLS signature scheme (Boneh-Lynn-Shacham) over Barreto-Lynn-Scott (BLS) curve BLS12-381
Stars: ✭ 19 (-84.3%)
Mutual labels:  elliptic-curves
std-curves
Standard curve database.
Stars: ✭ 53 (-56.2%)
Mutual labels:  elliptic-curves
cryptos
Pure Python from-scratch zero-dependency implementation of Bitcoin for educational purposes
Stars: ✭ 846 (+599.17%)
Mutual labels:  elliptic-curves
aeonflux
Infinitely presentable (aeon) rerandomisable (flux) anonymous credentials.
Stars: ✭ 25 (-79.34%)
Mutual labels:  zero-knowledge
dusk-blindbid
Implementation of the blindbid logic within Zero Knowledge Proofs
Stars: ✭ 18 (-85.12%)
Mutual labels:  zero-knowledge
elliptic-curve
A polymorphic interface for elliptic curve operations
Stars: ✭ 37 (-69.42%)
Mutual labels:  elliptic-curves
zkc
zero-knowledge chat suite
Stars: ✭ 96 (-20.66%)
Mutual labels:  zero-knowledge

zkp: a toolkit for Schnorr proofs

This crate has a toolkit for Schnorr-style zero-knowledge proofs, instantiated using the ristretto255 group.

It provides two levels of API:

  • a higher-level, declarative API based around the define_proof macro, which provides an embedded DSL for specifying proof statements in Camenisch-Stadler-like notation:

    define_proof! {
      vrf_proof,   // Name of the module for generated implementation
      "VRF",       // Label for the proof statement
      (x),         // Secret variables
      (A, G, H),   // Public variables unique to each proof
      (B) :        // Public variables common between proofs
      A = (x * B), // Statements to prove
      G = (x * H) 
      }
    

    This expands into a module containing an implementation of proving, verification, and batch verification. Proving uses constant-time implementations, and the proofs have a derived implementation of (memory-safe) serialization and deserialization via Serde.

  • a lower-level, imperative API inspired by Bellman, which provides a constraint system for Schnorr-style statements. This allows programmable construction of proof statements at runtime. The higher-level define_proof macro expands into an invocation of the lower-level API. The lower-level API is contained in the toolbox module.

Examples

Examples of how to use the API can be found in the library's tests directory.

Currently, the examples include:

  • Specification of an "anonymous credential presentation with 10 hidden attributes" proof from CMZ'13. Depending on the backend selection, the generated implementation is between 20 to 40 times faster than the benchmark numbers reported in that paper.

  • A transcript-based signature and VRF construction with an auto-generated implementation. This includes an example of using the online interactive composition described in the Merlin blog post to provide chained signatures with a counterparty.

  • An example of using the lower-level constraint system API.

Use and features

To enable the define_proof macro, import the crate like so:

#[macro_use]
extern crate zkp;

Nightly features

The nightly feature enables nightly-specific features. It is required to build the documentation.

Backend selection

zkp provides the following pass-through features to select a curve25519-dalek backend:

  • u32_backend
  • u64_backend
  • simd_backend

Transcript debugging

The debug-transcript feature is for development and testing, and prints a log of the data fed into the proof transcript.

Autogenerated benchmarks

The define_proof macro builds benchmarks for the generated proof statements, but because these are generated in the client crate (where the macro expansion happens), they need an extra step to be enabled.

To enable generated benchmarks in your crate, do the following:

  • Add a bench feature to your crate's Cargo.toml;
  • Add #[cfg_attr(feature = "bench", feature(test))] to your crate's lib.rs or main.rs, to enable Rust's nightly-only benchmark feature.

WARNING

THIS IMPLEMENTATION IS NOT YET READY FOR PRODUCTION USE

While I expect the 1.0 version to be largely unchanged from the current code, for now there are no stability guarantees on the proofs, so they should not yet be deployed.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].