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...
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

⋰·⋰ Feeless is a Nano cryptocurrency node, wallet, tools, and Rust crate.

⋰·⋰ Feeless What is Feeless? Feeless is a Nano cryptocurrency node, wallet, tools, and Rust crate. This is not the official project for Nano, only an

Daemon and tools to control your ASUS ROG laptop. Supersedes rog-core.

asusctl for ASUS ROG - Asus Linux Website asusd is a utility for Linux to control many aspects of various ASUS laptops but can also be used with non-a

Demonstrates Solana data account versioning used in supporting the Solana Cookbook article: Account Data Versioning
Demonstrates Solana data account versioning used in supporting the Solana Cookbook article: Account Data Versioning

versioning-solana This repo demonstrates ONE rudimentary way to upgrade/migrate account data changes with solana program changes. What is data version

🥕 Create a multisig with taproot and spend from it using BDK 🥕

Multisig & carrots This repository contains all the code to build a taproot multisig with your friends, and to spend from it. It's been used first to

Releases(v0.2.6)
Owner
Findora Foundation
Findora Foundation
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
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
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
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

Aragon ZK Research 3 Nov 18, 2022
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

Nervos Network 1k Dec 30, 2022
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

aspen 1 Dec 28, 2022