Zei is a library that provide tools to create and verify public transaction with confidential data.

Related tags

Cryptography zkp
Overview

GitHub top language GitHub tag (latest SemVer) GitHub issues GitHub pull requests License

#Zei: Findora's Cryptographic Library

Zei is a library that provide tools to create and verify public transaction with confidential data.

Support:

  • Basic Cryptographic tools:
    • ElGamal Encryption in the exponent over generic groups.
    • A Naive Multisignature (concatenation of ed25519 signatures)
    • BLS multisignatures (not currently integrated with Xfr creation)
    • Hybrid Encryption using signature key
  • Advanced Cryptographic tools:
    • Anonymous Credentials based on David Pointcheval and Olivier Sanders. Short Randomizable Signatures. CT RSA 2015. https://eprint.iacr.org/2015/525.pdf. It currently uses BLS12_381 as the underlying pairing
    • Confidential Anonymous Credential Reveal: Allows to encrypt credential attributes so that a verifier can check a credential signature without learning the attributes. This functionality allows for identity attributes tracking over a public ledger.
    • Chaum Pedersen proofs: Allows to prove in zero-knowledge that a set of Pedersen commitments open to the same value. Used in transfers to prove that the input confidential asset is the same as the output asset type.
    • Pedersen-ElGamal Equality Proofs: Allows to prove in zero-knowledge that the decryption of an Elgamal ciphertexts correctly opens a pedersen commitment. Use in transfers that allow tracking amounts and asset type without publicly revealing these values.
    • Dlog: Simple proof of knowlege of discrete logarithms over generic groups.
  • Xfr multi-input multi-output UTXO transfers
    • Plain: XfrNote reveal amount and asset type
    • Confidential amount and/or asset type: XfrNote hides amount and/or asset type
    • AssetType mixing: Allows for multiple asset types in a confidential transaction Implemented via the Cloak protocol. Currently using Interstellar spacesuite prototype
    • Tracking policies: Allow tracking of amount, asset type, and/or identity of asset holders. That is, confidential Xfrs need to provide ciphertexts of amount/asset_type and/or identity and prove that this are correctly formed.

Benchmarks

Use the benchmarks

Benchmarks are available for XfrNote operations. To run them all:

cargo bench

The report is available at target/criterion/report/index.html.

To run a specific benchmark:

cargo bench --bench {xfr_batch | xfr_{note|body}_{noidtracking|idtracking}_{assettracking|noassettracking}_{singleasset|multiasset}}_{time|cycles}

For example to run the benchmark for xfr notes with identity tracking, and no asset tracking for a single asset, run:

cargo bench --bench xfr_note_idtracking_noassettracking_singleasset_time

The benchmarks involving batch verification can be run with:

cargo bench --bench xfr_note_batch_time

Note that not all the combinations are implemented yet. So far the benchmarks available are (replace timeby cycles if you want the # of cpu cycles instead of seconds):

  • xfr_note_noidtracking_noassettracking_singleasset_time
  • xfr_note_idtracking_noassettracking_singleasset_time
  • xfr_note_idtracking_assettracking_multiasset_time
  • xfr_note_idtracking_assettracking_singleasset_time
  • xfr_body_idtracking_assettracking_singleasset_time
  • xfr_note_batch_time

Development environment setup

Install RUST

Run the following script and select option 1)

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

Git

We use special hooks before committing. To enable these hooks, copy them to the .git directory:

cp hooks/pre-commit .git/hooks/

Tests

The tests generate some parameters which are stored in the directory zei_api/data. If the tests fail, try first to remove the *.bin files in this directory and launch the tests again.

We recommend using the option --release for tests faster execution.

Run all the tests:

cargo test --all --release

Run only the documentation tests:

cargo test --doc --release

Test coverage

Tarpaulin is a test coverage tool for Rust. Note that Tarpaulin only supports x86_64 processors running Linux.

Install Tarpaulin:

cargo install cargo-tarpaulin

Run Tarpaulin, using a timeout of 120 seconds.

cargo tarpaulin --timeout 120

Generate and read the documentation

Standard

cargo doc --open

Visualize dependencies

Cargo tree

This tool allows to visualizes crates' dependencies as a tree.

To install:

cargo install cargo-tree

To run:

cargo tree

Cargo deps

This tool allows to visualizes crates' dependencies as a graph.

First you need to install graphviz.

For ubuntu:

sudo apt install graphviz

Then install cargo-deps:

cargo install cargo-deps

Generate the graph of dependencies as an image:

cargo deps --no-transitive-deps | dot -Tpng > graph.png

graph-dependencies

Code formatting

Use the following command to install rustfmt, the tool that allows to format the code according to some agreed standard defined in rustfmt.toml.

rustup component add rustfmt
rustup self update

Then to format your code run

cargo fmt

Use of zei library

To install, add the following to your project's Cargo.toml:

[dependencies.zei]
version = "v0.1.4d"

Then, in your library or executable source, add:

Import zei library

extern crate zei;

By default, several zei's tools uses curve25519-dalek's u64_backend feature, which uses Rust's i128 feature to achieve roughly double the speed as the u32_backend feature. When targetting 32-bit systems, however, you'll likely want to compile with cargo build --no-default-features --features="u32_backend". If you're building for a machine with avx2 instructions, there's also the experimental avx2_backend. To use it, compile with RUSTFLAGS="-C target_cpu=native" cargo build --no-default-features --features="avx2_backend"

Point to a branch of zei

If you want your project to point to a specific branch of zei do the following:

  • Edit Cargo.toml and replace the line (assume the branch name is refactor/api-module)
zei = { git = "https://github.com/FindoraNetwork/zei"}

by

zei = { git = "https://github.com/FindoraNetwork/zei", tag = "v0.1.4d" }

Licensing

The primary license for Zei is the Business Source License 1.1 (BUSL-1.1), see LICENSE.

You might also like...
L2 validity rollup combined with blind signatures over elliptic curves inside zkSNARK, to provide offchain anonymous voting with onchain binding execution on Ethereum

blind-ovote Blind-OVOTE is a L2 voting solution which combines the validity rollup ideas with blind signatures over elliptic curves inside zkSNARK, to

The Nervos CKB is a public permissionless blockchain, and the layer 1 of Nervos network.

Nervos CKB - The Common Knowledge Base master develop About CKB CKB is the layer 1 of Nervos Network, a public/permissionless blockchain. CKB uses Pro

The public source and documentation for Xenon iOS tweak.

THE GUIDE HAS BEEN MOVED TO THE WIKI This is the public source for the Xenon iOS tweak. The full version is available for $1.99 on Chariz. Differences

A template to create Rust-based Pure Data externals

Generate a Rust-based external for Pure Data This is a cargo generate template to create a Pure Data external written entirely in Rust. It uses pureda

Manage secret values in-repo via public key cryptography

amber Manage secret values in-repo via public key cryptography. See the announcement blog post for more motivation. Amber provides the ability to secu

Composable proof transcripts for public-coin arguments of knowledge
Composable proof transcripts for public-coin arguments of knowledge

Merlin: composable proof transcripts for public-coin arguments of knowledge Merlin is a STROBE-based transcript construction for zero-knowledge proofs

The Hybrid Public Key Encryption (HPKE) standard in Python

Hybrid PKE The Hybrid Public Key Encryption (HPKE) standard in Python. hybrid_pke = hpke-rs ➕ PyO3 This library provides Python bindings to the hpke-r

reth-indexer reads directly from the reth db and indexes the data into a postgres database all decoded with a simple config file and no extra setup alongside exposing a API ready to query the data.
reth-indexer reads directly from the reth db and indexes the data into a postgres database all decoded with a simple config file and no extra setup alongside exposing a API ready to query the data.

reth-indexer reth-indexer reads directly from the reth db and indexes the data into a postgres database all decoded with a simple config file and no e

Easy to use cryptographic framework for data protection: secure messaging with forward secrecy and secure data storage. Has unified APIs across 14 platforms.
Easy to use cryptographic framework for data protection: secure messaging with forward secrecy and secure data storage. Has unified APIs across 14 platforms.

Themis provides strong, usable cryptography for busy people General purpose cryptographic library for storage and messaging for iOS (Swift, Obj-C), An

Releases(v0.2.6)
Owner
Findora Foundation
Findora Foundation
Transparency for Mining Pool Transaction Selection

miningpool-observer Transparency for Mining Pool Transaction Selection The miningpool-observer project compares block templates produced by a Bitcoin

0xB10C 36 Nov 25, 2022
P2P Network to verify authorship & ownership, store & deliver proofs.

Anagolay Network Node Anagolay is a next-generation framework for ownerships, copyrights and digital licenses. ?? Local Development The installation a

Anagolay Network 5 May 30, 2022
Generates Solidity code to verify EIP-712 style signatures

eip712 Generates Solidity code to verify EIP-712 style signatures. Usage First, create an abstract contract implementing the functionality you want: /

Sam Wilson 11 Dec 22, 2022
Noir implementation of RSA-verify

noir-rsa This repository contains an implementation of a RSA signature verify for the Noir language. Currently supports pkcs1v15 + sha256 and exponent

Set Labs 5 Jul 22, 2023
Girl Friend <- Generate Foundry Fork Test from Attack Transaction

girlfriend Girl Friend <- G F <- Generate Foundry Fork Test from Attack Transaction She is truly a great friend. Prerequisites # Install abi-guesser g

fuzzland 92 Jul 24, 2024
Rust crate to retrieve public IP address and geolocation data. 🦀

?? Public IP Address Lookup and Geolocation Information public-ip-address is a simple Rust library for performing public IP lookups from over a dozen

Tomash Ghz 6 Apr 25, 2024
A quick create wizard to create and modify opinionated kustomize deployments.

kqc ?? ☸️ A quick create wizard to create and modify opinionated kustomize deployments. This tool should help to quickly create and build up kustomize

Daniel Jankowski 8 May 20, 2023
A guide for Mozilla's developers and data scientists to analyze and interpret the data gathered by our data collection systems.

Mozilla Data Documentation This documentation was written to help Mozillians analyze and interpret data collected by our products, such as Firefox and

Mozilla 75 Dec 1, 2022
A program on solana blockchain to provide escrow services.

Environment Setup Install Rust from https://rustup.rs/ Install Solana from https://docs.solana.com/cli/install-solana-cli-tools#use-solanas-install-to

null 0 Dec 24, 2021