6 releases

0.1.6 Feb 13, 2024
0.1.5 Aug 23, 2023
0.1.3 Dec 10, 2022
0.1.2 Aug 10, 2022
0.1.1 Jun 26, 2022

#965 in Cryptography

Download history 234/week @ 2023-12-24 887/week @ 2023-12-31 1240/week @ 2024-01-07 1120/week @ 2024-01-14 771/week @ 2024-01-21 758/week @ 2024-01-28 1012/week @ 2024-02-04 1416/week @ 2024-02-11 1175/week @ 2024-02-18 917/week @ 2024-02-25 862/week @ 2024-03-03 724/week @ 2024-03-10 1166/week @ 2024-03-17 734/week @ 2024-03-24 685/week @ 2024-03-31 431/week @ 2024-04-07

3,073 downloads per month
Used in 26 crates (5 directly)

Apache-2.0

78KB
1K SLoC

CUDA 1K SLoC // 0.0% comments Rust 163 SLoC // 0.1% comments C++ 62 SLoC

sppark

sppark (pronounced 'spark') is Supranational's performance primitives for arguments of knowledge such as SNARKs and STARKs. The library focuses on accelerating the most computationally expensive pieces of zero-knowledge proofs generation such as multi-scalar multiplication (MSM), number theoretic transform (NTT), arithmetic hashes, and more. The library is a collection of CUDA/C++ templates that can be instantiated for a range of finite fields and elliptic curves.

Table of Contents

Status

This library is under active development [with a list of planned significant improvements]

General notes on implementation

The goal of the sppark library is to provide foundational components for applications and other libraries that require high-performance operations for zero-knowledge proofs generation.

Platform and Language Compatibility

This library primarily supports x86_64 with Nvidia's Volta+ GPU hardware platforms on Linux and Windows operating systems. Non-GPU portions can be utilized even on ARM64, and additionally on Mac.

We show how to interface with Rust and are open to discussions on how to interface with Go. Caveat lector. Achieving highest possible GPU performance requires interfacing with target language memory management, possibly its async facilities, and might even require changes to object's data layout. These are hard to generalize and consequently are also a matter of discussion, likely on a case-by-case basis.

Introductory Integration Tutorial

[TBD]

Multi-scalar Multiplication (MSM)

[TBD]

Repository Structure

Root - Contains various configuration files, documentation, licensing.

  • conversion -
  • ec - Contains templates for elliptic curve operations such as addition and doubling for different point representations.
  • ff - Contains CUDA template[s] for finite field operations and instantiations of a variety of fields.
  • hash -
  • memory -
  • merkle -
  • msm - Contains multi-scalar multiplication template[s] that can be instantiated for a variety of elliptic curves such as BLS12-381 and the Pasta curves
  • ntt - Contains NTT CUDA kernels.
  • poc - Proof-of-concept implementations, including benchmarking.
  • rust - Houses Rust crate definition.
  • util - General-purpose helper classes.

Performance

Simplified benchmark results can be collected by end users by exercising proof-of-concept applications. "Simplified" refers to the fact that there is always room for application-specific tuning. Intention is to give a general "taste." Just in case, benchmarks are likely to require high-end GPUs and one can't expect that they will execute on a laptop unmodified.

Caveat lector. As you compile PoC applications you might get warnings about not FFI-safe types. Alarming as they are, the fact that tests pass means that it works out nevertheless. However, this is not to say that they should be ignored and that one can proceed to build production code upon it. We intend to work with external software maintainers to resolve these warnings.

License

The sppark library is licensed under the Apache License Version 2.0 software license.

Dependencies

~0–1.3MB
~15K SLoC