SkillAgentSearch skills...

Blitzar

Zero-knowledge proof acceleration with GPUs for C++ and Rust

Install / Use

/learn @spaceandtimefdn/Blitzar
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

<div id="top"></div> <!-- PROJECT LOGO --> <br /> <div align="center"> <picture> <source media="(prefers-color-scheme: dark)" width="200px" srcset="https://raw.githubusercontent.com/spaceandtimefdn/blitzar-rs/assets/logo_dark_background.png"> <source media="(prefers-color-scheme: light)" width="200px" srcset="https://raw.githubusercontent.com/spaceandtimefdn/blitzar-rs/assets/logo_light_background.png"> <img alt="Blitzar" width="200px" src="https://raw.githubusercontent.com/spaceandtimefdn/blitzar-rs/assets/logo_light_background.png"> </picture> <p align="center"> <a href="https://github.com/spaceandtimefdn/blitzar/actions/workflows/release.yml"> <img alt="Build State" src="https://github.com/spaceandtimefdn/blitzar/actions/workflows/release.yml/badge.svg"> </a> <a href="https://twitter.com/intent/follow?screen_name=spaceandtimedb"> <img alt="Twitter" src="https://img.shields.io/twitter/follow/spaceandtimedb.svg?style=social&label=Follow"> </a> <a href="http://discord.gg/SpaceandTimeDB"> <img alt="Discord Server" src="https://img.shields.io/discord/953025874154893342?logo=discord"> </a> <a href="https://github.com/spaceandtimefdn/blitzar/blob/main/LICENSE"> <img alt="License" src="https://img.shields.io/badge/License-Apache_2.0-blue.svg"> </a> <a href="https://en.cppreference.com/w/cpp/20"> <img alt="C++ Logo" src="https://img.shields.io/badge/C%2B%2B-20-blue?style=flat&logo=c%2B%2B"> </a> <a href="https://www.linux.org/"> <img alt="OS" src="https://img.shields.io/badge/OS-Linux-blue?logo=linux"> </a> <a href="https://www.linux.org/"> <img alt="CPU" src="https://img.shields.io/badge/CPU-x86-red"> </a> <a href="https://developer.nvidia.com/cuda-downloads"> <img alt="CUDA" src="https://img.shields.io/badge/CUDA-12.6-green?style=flat&logo=nvidia"> </a> <p align="center"> Space and Time C++ library for accelerating cryptographic zero-knowledge proofs algorithms on the CPU and GPU. <br /> <a href="https://github.com/spaceandtimefdn/blitzar/issues">Report Bug</a> | <a href="https://github.com/spaceandtimefdn/blitzar/issues">Request a Feature</a> </p> </div>

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 can execute analytic queries on 1M+ rows in less than a second, 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 is a C++ library for accelerating cryptographic zero-knowledge proof algorithms on the CPU and GPU.

Note
This repo contains the C++ implementation along with cbindings and a Rust sys-crate. If you are using Rust, use the crate from the companion blitzar-rs repo.

The library provides

The library is adopted from code in the libsodium and zkcrypto projects. It extends both project's cryptographic functions to support CUDA so that they are usable on GPUs.

Installation

We provide prebuilt binaries for glibc-based, x86-64 linux distributions.

Dependencies are statically linked and set to have internal linkage with export maps to ensure portability. The only run-time dependency to use GPU acceleration is an up-to-date GPU driver.

For most users, we recommend installing with cargo via blitzar-rs.

Alternatively, users that want to use the c api directly can download the shared library and header file from the github release.

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

Let $g_0\ldots g_n\in \mathbb{G}$ be elements of a group (with prime order), and let $a_0\ldots a_n\in\mathbb{F}$ be elements of the corresponding scalar field. (i.e. the field $\mathbb{F}_p$ where $p$ is the order of the group.)

Then, the Generalized Pedersen Commitment of the vector $\mathbf{a}=(a_1,\ldots, a_n)$ is

P = a_1\cdot g_1+\cdots+ a_n\cdot g_n

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 $g_n$ can be used, or they can be provided as needed.

Currently, Blitzar supports group elements from the Curve25519, bls12-381 G1, bn254-381 G1, and Grumpkin curves.

Inner Product Argument

Blitzar provides a modified implementation of an inner product argument (e.g. Bulletproofs and Halo2).

Given generators $g_1, \ldots, g_n$; Pedersen commitment $P$; scalar $c$; and vectors $\mathbf{a}=(a_1,\ldots, a_n)$ and $\mathbf{b}=(b_1,\ldots, b_n)$; Blitzar's version of the inner product proof allows a Prover to establish that

\begin{aligned}
P &= a_1\cdot g_1+\cdots+ a_n\cdot g_n \\
c &= \langle \mathbf{a}, \mathbf{b} \rangle = a_1\cdot b_1+\cdots+ a_n\cdot b_n
\end{aligned}

where it is assumed that $\boldsymbol{g}$, $\boldsymbol{b}$, and $c$ are known to both the Prover and Verifier.

This version of the inner product argument can be used in the context of a broader protocol.

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.

Performance (associated commit hash)

Benchmarks are run against four different types of GPU:

<details> <summary>Expand to see the multi-scalar multiplication / generalized Pedersen commitment results</summary>

The subsequent outcomes are derived from the preceding benchmark execution of the Pedersen commitment, during which the number of sequences, bytes per element, sequence length, and GPU type were varied.

BN254 Multiexponentiation Benchmarks BLS12-381 Multiexponentiation Benchmarks Grumpkin Multiexponentiation Benchmarks Curve25519 Multiexponentiation Benchmarks

</details>

Getting Started

See the example folder for some examples.

Prerequisites to build from source

<details open> <summary>Build environment</summary>

Prerequisites:

From your terminal, run the following command in the root of the source directory to set up a build environment.

nix develop

Note: if this is the first time, it may take a while as we build a clang co

Related Skills

View on GitHub
GitHub Stars4.9k
CategoryDevelopment
Updated3d ago
Forks154

Languages

C++

Security Score

100/100

Audited on Mar 22, 2026

No findings