9 releases (stable)

2.1.0 Feb 20, 2024
2.0.2 Jan 30, 2024
1.1.2 Jan 8, 2024
1.1.1 Nov 3, 2023
0.1.0 May 23, 2023

#288 in Cryptography

Download history 21/week @ 2023-12-29 62/week @ 2024-01-05 27/week @ 2024-01-12 22/week @ 2024-01-19 65/week @ 2024-01-26 10/week @ 2024-02-02 70/week @ 2024-02-09 224/week @ 2024-02-16 122/week @ 2024-02-23 67/week @ 2024-03-01 102/week @ 2024-03-08 92/week @ 2024-03-15 108/week @ 2024-03-22 55/week @ 2024-03-29 94/week @ 2024-04-05

374 downloads per month

Apache-2.0

96KB
1.5K SLoC


Blitzar Crate

Blitzar

Twitter Discord Server License OS CPU Rust CUDA Build State

High-Level Rust wrapper for the blitzar-sys crate.
Report Bug | Request a Feature

Background

Blitzar was created by the core cryptography team at Space and Time to accelerate Proof of SQL, a novel zero-knowledge proof for SQL operations. After surveying our options for a GPU acceleration framework, we realized that Proof of SQL needed something better… so we built Blitzar. Now, Proof of SQL runs with a 3.2 second proving time against a million-row table on a single GPU, and it’s only getting faster.

We’ve open-sourced Blitzar to provide the Web3 community with a faster and more robust framework for building GPU-accelerated zk-proofs. We’re excited to open the project to community contributions to expand the scope of Blitzar and lay the foundation for the next wave of lightning fast zk-proofs.

Overview

Blitzar-rs is a High-Level rust wrapper for the blitzar-sys crate for accelerating cryptographic zero-knowledge proof algorithms on the CPU and GPU.

Note This repo contains the high-Level rust wrapper for the blitzar-sys crate. If you are using C++, use the code from the companion repo here: https://github.com/spaceandtimelabs/blitzar.

The crate provides

WARNING: This project has not undergone a security audit and is NOT ready for production use.

Computational Backends

Although the primary goal of this library is to provide GPU acceleration for cryptographic zk-proof algorithms, the library also provides CPU support for the sake of testing. The following backends are supported:

Backend Implementation Target Hardware
cpu Serial x86 capable CPUs
gpu Parallel Nvidia CUDA capable GPUs

Cryptographic Primitives

Multi-Scalar Multiplication (MSM) / Generalized Pedersen Commitment / Multiexponentiation

Blitzar provides an implementation of Multi-Scalar Multiplication (i.e. generalized Pedersen commitments). Mathematical details behind MSM are outlined in the Blitzar Github repository.

Note: we interchangeably use the terms "multi-scalar multiplication" and "multiexponentiation" to refer to the this operation because when the group is written additively, the operation is a multi-scalar multiplication, and when the group is written multiplicatively, the operation is a multiexponentiation.

The Blitzar implementation allows for computation of multiple, potentially different length, MSMs simultaneously. Additionally, either built-in, precomputed, generators can be used, or they can be provided as needed.

Currently, Blitzar supports Curve25519 and bls12-381 G1 as groups. We're always working to expand the curves that we support, so check back for updates.

Inner Product Argument

Blitzar provides a modified implementation of an inner product argument (e.g. Bulletproofs and Halo2). Mathematical details of the modified inner product argument are outlined in the Blitzar Github repository.

Other Features to Come

If there is a particular feature that you would like to see, please reach out. Blitzar is a community-first project, and we want to hear from you.

Getting Started

To get a local copy up and running, consider the following steps.

Prerequisites to build from source

GPU backend prerequisites:
CPU backend prerequisites:

You'll need the following requirements to run the environment:

Usage

Add to your project

To add this library to your project, update your Cargo.toml file with the following line:

[dependencies]
blitzar = <version_number>

Feature Flags

Feature Default? Description
cpu x Enables the CPU backend.
gpu Enables the GPU Backend.

Tests

cargo test

Documentation

cargo doc --no-deps --open

Examples

Check EXAMPLES file.

Running benchmarks:

Benchmarks are run using criterion.rs:

$ cargo bench --features <cpu | gpu>

Development Process

The main branch is regularly built and tested, being the only source of truth. Tags are created regularly from automated semantic release executions.

Contributing

We're excited to open Blitzar-rs to the community, but are not accepting community Pull Requests yet due to logistic reasons. However, feel free to contribute with any suggestion, idea, or bugfix on our Issues panel. Also, see contribution guide.

Community & support

Join our Discord server to ask questions, discuss features, and for general chat.

License

This project is released under the Apache 2 License.

C++ code

This repo contains the high-Level rust wrapper for the blitzar-sys crate. If you are using C++, use the code from the companion repo here: https://github.com/spaceandtimelabs/blitzar.

Dependencies

~6–9MB
~165K SLoC