Skip to content

bcc-research/bolt-rs

Repository files navigation

bolt-rs

Implementation of Bolt: Faster SNARKs from Sketched Codes.

This code is for benchmarking and evaluation purposes only and should not be used for production code.

A significant portion of the code in this repository was generated by Claude Code. AI-generated code may not be eligible for copyright protection in all jurisdictions, and its legal status regarding intellectual property remains unsettled. Users should be aware of these potential copyright implications before incorporating any of this code into their own projects.

Benchmarks

The main focus of the benchmark is to demonstrate prover performance for large polynomials, and so the benchmark uses polynomials of size $2^{30}$ over a 32-bit binary field. There are implementations for both CPUs and Metal-based GPUs.

The encoding works as follows:

  1. The $2^{30}$ polynomial is interleaved to a matrix of dimensions $2^{23} \times 2^7$
  2. Each column is encoded using an expander of dimensions $2^{23} \times 2^{20}$ to get a syndrome
  3. Each syndrome is encoded with Reed-Solomon of rate $\frac{1}{2}$
  4. The code is then obtained by concatenating the message with the RS-encoded syndrome, resulting in dimensions $(2^{23} + 2^{21}) \times 2^7$
  5. The final interleaved code is committed by hashing each row (sized $2^7$) into a Merkle tree with SHA256

The implementation attempts to optimize the use of L1 and L2 caches, SIMD, GPU acceleration using Metal, low-level instructions for carry-less multiplication, low-level and hardware-accelerated instructions for SHA256.

The following are the results on an M4 Pro Mac mini with 14 CPU cores, 20 GPU cores and 64 GBs of memory, in a variant that hashes on GPU and encodes on CPU, pipeplining the hashing of the systematic part while encoding is taking place.

Variant Commit time (ms)
bolt-max 840
bolt-min 1250

You can run the benchmarks using ./run_benchmarks.sh bolt-xor bolt32 for Bolt, and ./run_benchmarks.sh --paper for the systems benchmarked in the paper.

Background

The codebase started as a Rust port of the Julia-based ligerito-impl. From there, it served as the main implementation for the paper. Optimizations, tests and benchmarks were majorly done by Claude Code, prompted by us.

The sumcheck prover incorporates several optimizations learned from binius.

License

Licensed under either of

at your option.

About

No description, website, or topics provided.

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors