icicle-core

A hardware acceleration library for compute intensive cryptography :ice_cube:

https://github.com/ingonyama-zk/icicle

Science Score: 36.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
    1 of 49 committers (2.0%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (13.7%) to scientific vocabulary

Keywords

cpu cryptography cuda golang msm ntt rust zero-knowledge

Keywords from Contributors

l2-scaling optimism ovm rollup fpga xilinx-fpga
Last synced: 6 months ago · JSON representation

Repository

A hardware acceleration library for compute intensive cryptography :ice_cube:

Basic Info
  • Host: GitHub
  • Owner: ingonyama-zk
  • License: mit
  • Language: C++
  • Default Branch: main
  • Homepage: https://dev.ingonyama.com
  • Size: 226 MB
Statistics
  • Stars: 435
  • Watchers: 18
  • Forks: 151
  • Open Issues: 31
  • Releases: 42
Topics
cpu cryptography cuda golang msm ntt rust zero-knowledge
Created almost 3 years ago · Last pushed 7 months ago
Metadata Files
Readme License Citation

README.md

ICICLE

ICICLE is a high-performance cryptographic acceleration library designed to optimize cryptographic computations across various hardware platforms, including CPUs, GPUs, and other accelerators.


ICICLE



Chat with us on Discord Follow us on LinkedIn Follow us on Twitter GitHub Release

Background

Zero Knowledge Proofs (ZKPs) are considered one of the greatest achievements of modern cryptography. Accordingly, ZKPs are expected to disrupt a number of industries and will usher in an era of trustless and privacy preserving services and infrastructure.

We believe that ICICLE will be a cornerstone in the acceleration of ZKPs:

  • Versatility: Supports multiple hardware platforms, making it adaptable to various computational environments.
  • Efficiency: Designed to leverage the parallel nature of ZK computations, whether on GPUs, CPUs, or other accelerators.
  • Scalability: Provides an easy-to-use and scalable solution for developers, allowing them to optimize cryptographic operations with minimal effort.

Getting Started

This guide will help you get started with ICICLE in C++, Rust, and Go.

[!NOTE] Developers: We highly recommend reading our documentation for a comprehensive explanation of ICICLEs capabilities.

[!TIP] Try out ICICLE by running some examples available in C++, Rust, and Go bindings. Check out our install-and-use examples in C++, Rust and Go

Prerequisites

  • Any compatible hardware: ICICLE supports various hardware, including CPUs, Nvidia GPUs, and other accelerators.
  • CMake, Version 3.18 or above. Latest version recommended. Required only if building from source.
  • CUDA Toolkit, Required only if using NVIDIA GPUs (version 12.0 or newer).

[!NOTE] For older GPUs that only support CUDA 11, ICICLE may still function, but official support is for CUDA 12 onwards.

Accessing Hardware

If you don't have access to an Nvidia GPU we have some options for you.

Google Colab offers a free T4 GPU instance and ICICLE can be used with it, reference this guide for setting up your Google Colab workplace.

If you require more compute and have an interesting research project, we have bounty and grant programs.

Building ICICLE from source

ICICLE provides build systems for C++, Rust, and Go. Each build system incorporates the core ICICLE library, which contains the essential cryptographic primitives. Refer to the Getting started page for full details about building and using ICICLE.

[!WARNING] Ensure ICICLE libraries are installed correctly when building or installing a library/application that depends on ICICLE so that they can be located at runtime.

Rust

In cargo.toml, specify the ICICLE libs to use:

```bash [dependencies] icicle-runtime = { git = "https://github.com/ingonyama-zk/icicle.git", branch="main" } icicle-core = { git = "https://github.com/ingonyama-zk/icicle.git", branch="main" } icicle-babybear = { git = "https://github.com/ingonyama-zk/icicle.git", branch="main" }

add other ICICLE crates here if need additional fields/curves

```

You can specify branch=branch-name, tag=tag-name, or rev=commit-id.

Build the Rust project:

bash cargo build --release

Go

There are two ways to build from source in Go:

  1. Clone the repo, update your go.mod to point to the local clone, and build ICICLE within the clone

sh git clone https://github.com/ingonyama-zk/icicle.git

Add ICICLE v3 to your go.mod file:

```go require github.com/ingonyama-zk/icicle/v3 v3.0.0

replace github.com/ingonyama-zk/icicle/v3 => ../path/to/cloned/icicle ```

Navigate to the cloned repo's golang bindings and build the library using the supplied build script

sh cd icicle/wrappers/golang chmod +x build.sh ./build.sh -curve=bn254

  1. Update your go.mod to include ICICLE as a dependency, navigate to the dependency in your GOMODCACHE and build ICICLE there

sh go get github.com/ingonyama-zk/icicle/v3 cd $(go env GOMODCACHE)/github.com/ingonyama-zk/icicle/v3@<version>/wrappers/golang chmod +x build.sh ./build.sh -curve=bn254

[!NOTE] To specify the field, use the flag -field=, where can be one of the following: babybear, stark252, m31, koalabear. To specify a curve, use the flag -curve=, where can be one of the following: bn254, bls12377, bls12381, bw6_761, grumpkin.

Once ICICLE has been built, you can add specific packages when you need them in your application:

go import ( runtime "github.com/ingonyama-zk/icicle/v3/wrappers/golang/runtime" core "github.com/ingonyama-zk/icicle/v3/wrappers/golang/core" bn254 "github.com/ingonyama-zk/icicle/v3/wrappers/golang/curves/bn254" bn254MSM "github.com/ingonyama-zk/icicle/v3/wrappers/golang/curves/bn254/msm" )

C++

ICICLE can be built and tested in C++ using CMake. The build process is straightforward, but there are several flags you can use to customize the build for your needs.

Clone the ICICLE repository:

bash git clone https://github.com/ingonyama-zk/icicle.git cd icicle

Configure the build:

bash mkdir -p build && rm -rf build/* cmake -S icicle -B build -DFIELD=babybear

[!NOTE] To specify the field, use the flag -DFIELD=field, where field can be one of the following: babybear, stark252, m31, koalabear. To specify a curve, use the flag -DCURVE=curve, where curve can be one of the following: bn254, bls12377, bls12381, bw6_761, grumpkin.

Build the project:

bash cmake --build build -j # -j is for multi-core compilation

Link your application (or library) to ICICLE:

cmake target_link_libraries(yourApp PRIVATE icicle_field_babybear icicle_device)

Install (optional):

To install the libs, specify the install prefix -DCMAKE_INSTALL_PREFIX=/install/dir/. Then after building, use cmake to install the libraries:

sh cmake -S icicle -B build -DFIELD=babybear -DCMAKE_INSTALL_PREFIX=/path/to/install/dir/ cmake --build build -j # build cmake --install build # install icicle to /path/to/install/dir/

Run tests (optional):

[!CAUTION] Most tests assume a CUDA backend exists and will fail otherwise, if a CUDA device is not found.

Add -DBUILD_TESTS=ON to the cmake command, build and execute tests:

bash cmake -S icicle -B build -DFIELD=babybear -DBUILD_TESTS=ON cmake --build build -j cd build/tests ctest

or choose the test-suite

```bash ./build/tests/testfieldapi # or another test suite

can specify tests using regex. For example for tests with ntt in the name:

./build/tests/testfieldapi --gtest_filter="ntt" ```

Build Flags:

You can customize your ICICLE build with the following flags:

  • -DCPU_BACKEND=ON/OFF: Enable or disable built-in CPU backend. default=ON.
  • -DCMAKE_INSTALL_PREFIX=/install/dir: Specify install directory. default=/usr/local.
  • -DBUILD_TESTS=ON/OFF: Enable or disable tests. default=OFF.
  • -DBUILD_BENCHMARKS=ON/OFF: Enable or disable benchmarks. default=OFF.

Install CUDA backend

To install the CUDA backend

  1. Download the release binaries.
  2. Install it, by extracting the binaries to /opt/ or any other custom install path.
  3. In your application, load the cuda backend and select a CUDA device.
  4. All subsequent API will now use the selected device.

Rust:

```rust use icicle_runtime::{runtime, Device};

runtime::loadbackendfromenvordefault().unwrap(); // or load programmatically runtime::loadbackend("/path/to/backend/installdir").unwrap(); // Select CUDA device let device = Device::new("CUDA", 1 /gpu-id/); icicleruntime::setdevice(&device).unwrap();

// Any call will now execute on GPU-1 ```

Go:

```go import( "github.com/ingonyama-zk/icicle/v3/wrappers/golang/runtime" )

result := runtime.LoadBackendFromEnvOrDefault() // or load from custom install dir result := runtime.LoadBackend("/path/to/backend/installdir", true) // Select CUDA device device := runtime.CreateDevice("CUDA", 0) // or other result := runtime.SetDevice(device)

// Any call will now execute on GPU-0 ``` C++:

```cpp

include "icicle/runtime.h"

// Load the installed backend eIcicleError result = icicleloadbackendfromenvordefault(); // or load it programmatically eIcicleError result = icicleloadbackend("/path/to/backend/installdir", true);

// Select CUDA device icicle::Device device = {"CUDA", 0 /gpu-id/}; eIcicleError result = iciclesetdevice(device);

// Any call will now execute on GPU-0 ```

Full details can be found in our getting started docs

Contributions

Join our Discord Server and find us on the ICICLE channel. We will be happy to work together to support your use case, and talk features, bugs and design.

Development Contributions

If you are changing code, please make sure to change your git hooks path to the repo's hooks directory by running the following command:

sh git config core.hooksPath ./scripts/hooks

In case clang-format is missing on your system, you can install it using the following command:

sh sudo apt install clang-format

You will also need to install codespell to check for typos.

This will ensure our custom hooks are run and will make it easier to follow our coding guidelines.

Hall of Fame

  • Robik, for his ongoing support and mentorship
  • liuxiao, for being a top notch bug smasher
  • gkigiermo, for making it intuitive to use ICICLE in Google Colab
  • nonam3e, for adding Grumpkin curve support into ICICLE
  • alxiong, for adding warmup for CudaStream
  • cyl19970726, for updating go install source in Dockerfile
  • PatStiles, for adding Stark252 field

Help & Support

For help and support talk to our devs in our discord channel #ICICLE or contact us at support@ingonyama.com.

License

ICICLE frontend is distributed under the terms of the MIT License.

See LICENSE-MIT for details.

[!NOTE] ICICLE backends, excluding backends exposed in this repository, are distributed under a special license and are not covered by the MIT license. If you want to learn more, check out our developer documentation.

Owner

  • Name: Ingonyama
  • Login: ingonyama-zk
  • Kind: organization
  • Email: hi@ingonyama.com

Shipping the world's fastest provers

Committers

Last synced: 9 months ago

All Time
  • Total Commits: 566
  • Total Committers: 49
  • Avg Commits per committer: 11.551
  • Development Distribution Score (DDS): 0.83
Past Year
  • Commits: 265
  • Committers: 28
  • Avg Commits per committer: 9.464
  • Development Distribution Score (DDS): 0.808
Top Committers
Name Email Commits
Jeremy Felder j****1@g****m 96
yshekel y****l@g****m 74
release-bot r****t@i****m 35
DmytroTym d****1@g****m 34
ChickenLover R****1@g****m 33
ImmanuelSegol 3****s@g****m 29
Leon Hibnik 1****k 28
Miki 1****a 22
Otsar 1****u 22
HadarIngonyama 1****a 21
Vitalii Hnatyk v****k@g****m 18
stas s****y@i****m 15
nonam3e 7****e 15
ShaniBabayoff s****b@i****m 15
Shlomtz o****s@g****m 9
Koren-Brand 1****d 8
danny-shterman 1****n 8
idanfr-ingo i****n@i****m 8
Emir Soyturk e****k@g****m 8
Elan 1****K 7
Guy Weissenberg g****y@i****m 6
Stas Polonsky s****s@i****m 5
Shanie Winitz 1****z 5
Aviad Dahan 1****o 4
Karthik Inbasekar 6****t 4
Koh Wei Jie c****t@k****m 4
Otsar 1****i 3
Vlad 8****p 3
Vitalii v****i@i****m 3
BigSky77 s****2@g****m 2
and 19 more...
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 112
  • Total pull requests: 1,175
  • Average time to close issues: 5 months
  • Average time to close pull requests: 7 days
  • Total issue authors: 37
  • Total pull request authors: 83
  • Average comments per issue: 1.65
  • Average comments per pull request: 0.36
  • Merged pull requests: 796
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 13
  • Pull requests: 673
  • Average time to close issues: 12 days
  • Average time to close pull requests: 6 days
  • Issue authors: 10
  • Pull request authors: 66
  • Average comments per issue: 2.69
  • Average comments per pull request: 0.27
  • Merged pull requests: 425
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • ImmanuelSegol (34)
  • LeonHibnik (13)
  • TalDerei (8)
  • jeremyfelder (7)
  • ChickenLover (6)
  • cliff0412 (4)
  • Otsar-Raikou (3)
  • 0xnullifier (3)
  • flyq (2)
  • sss1h (2)
  • DmytroTym (2)
  • btilmon (2)
  • qiji2023 (2)
  • bigsky77 (2)
  • vhnatyk (1)
Pull Request Authors
  • yshekel (225)
  • jeremyfelder (151)
  • ChickenLover (92)
  • LeonHibnik (75)
  • nonam3e (58)
  • mickeyasa (53)
  • ShaniBabayoff (42)
  • Otsar-Raikou (39)
  • HadarIngonyama (39)
  • emirsoyturk (37)
  • vhnatyk (36)
  • DmytroTym (32)
  • svpolonsky (29)
  • ImmanuelSegol (23)
  • Koren-Brand (22)
Top Labels
Issue Labels
backlog (44) type:feature (36) type:bug (29) lang:cuda/cpp (11) WOI (11) lang:rust (10) lang:go (7) NOM (7) area:ntt (7) area:tests (7) area:msm (6) good first issue (6) Next Sprint (4) type:docs (3) testing (3) area:ci (1) Stale (1) question (1) area:poseidon (1)
Pull Request Labels
lang:rust (8) lang:go (6) area:msm (4) area:ntt (3) type:bug (2) area:vec (2) type:feature (2) lang:cuda/cpp (1) area:tests (1) testing (1)

Packages

  • Total packages: 7
  • Total downloads:
    • cargo 3,017 total
  • Total dependent packages: 2
    (may contain duplicates)
  • Total dependent repositories: 1
    (may contain duplicates)
  • Total versions: 93
  • Total maintainers: 1
proxy.golang.org: github.com/ingonyama-zk/icicle
  • Versions: 31
  • Dependent Packages: 1
  • Dependent Repositories: 1
Rankings
Stargazers count: 4.4%
Dependent repos count: 4.7%
Average: 5.1%
Forks count: 5.3%
Dependent packages count: 5.8%
Last synced: 7 months ago
proxy.golang.org: github.com/ingonyama-zk/icicle/v3
  • Versions: 13
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent packages count: 6.3%
Average: 6.5%
Dependent repos count: 6.7%
Last synced: 7 months ago
proxy.golang.org: github.com/ingonyama-zk/icicle/goicicle
  • Versions: 17
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Stargazers count: 4.3%
Forks count: 5.2%
Average: 7.2%
Dependent packages count: 8.9%
Dependent repos count: 10.6%
Last synced: 7 months ago
proxy.golang.org: github.com/ingonyama-zk/icicle/v2
  • Versions: 14
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent packages count: 7.0%
Average: 7.4%
Dependent repos count: 7.9%
Last synced: 7 months ago
proxy.golang.org: github.com/ingonyama-ZK/icicle
  • Versions: 16
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent packages count: 9.6%
Average: 10.2%
Dependent repos count: 10.8%
Last synced: 7 months ago
crates.io: icicle-cuda-runtime

Ingonyama's Rust wrapper of CUDA runtime

  • Versions: 1
  • Dependent Packages: 1
  • Dependent Repositories: 0
  • Downloads: 1,567 Total
Rankings
Dependent repos count: 29.3%
Dependent packages count: 34.5%
Average: 53.4%
Downloads: 96.4%
Maintainers (1)
Last synced: 7 months ago
crates.io: icicle-core

A library for GPU ZK acceleration by Ingonyama

  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 1,450 Total
Rankings
Dependent repos count: 29.3%
Dependent packages count: 34.5%
Average: 53.4%
Downloads: 96.4%
Maintainers (1)
Last synced: 7 months ago

Dependencies

Dockerfile docker
  • nvidia/cuda 12.0.0-devel-ubuntu22.04 build
go.mod go
  • github.com/consensys/bavard v0.1.13
  • github.com/davecgh/go-spew v1.1.1
  • github.com/kr/pretty v0.1.0
  • github.com/pmezard/go-difflib v1.0.0
  • github.com/stretchr/testify v1.8.3
  • gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127
  • gopkg.in/yaml.v3 v3.0.1
  • rsc.io/tmplfunc v0.0.3
go.sum go
  • github.com/consensys/bavard v0.1.13
  • github.com/davecgh/go-spew v1.1.1
  • github.com/kr/pretty v0.1.0
  • github.com/kr/pty v1.1.1
  • github.com/kr/text v0.1.0
  • github.com/pmezard/go-difflib v1.0.0
  • github.com/stretchr/testify v1.8.3
  • gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405
  • gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127
  • gopkg.in/yaml.v3 v3.0.1
  • rsc.io/tmplfunc v0.0.3
wrappers/rust/Cargo.toml cargo
wrappers/rust/icicle-core/Cargo.toml cargo
wrappers/rust/icicle-cuda-runtime/Cargo.toml cargo
wrappers/rust/icicle-curves/icicle-bn254/Cargo.toml cargo
  • ark-bn254 0.4.0 development
  • ark-ec 0.4.0 development
  • ark-ff 0.4.0 development
  • ark-poly 0.4.0 development
  • ark-std 0.4.0 development
  • ark-bn254 0.4.0
examples/rust/msm/Cargo.toml cargo
examples/rust/ntt/Cargo.toml cargo
wrappers/rust/icicle-curves/icicle-bls12-377/Cargo.toml cargo
  • ark-bls12-377 0.4.0 development
  • ark-ec 0.4.0 development
  • ark-ff 0.4.0 development
  • ark-poly 0.4.0 development
  • ark-std 0.4.0 development
  • ark-bls12-377 0.4.0
wrappers/rust/icicle-curves/icicle-bls12-381/Cargo.toml cargo
  • ark-bls12-381 0.4.0 development
  • ark-ec 0.4.0 development
  • ark-ff 0.4.0 development
  • ark-poly 0.4.0 development
  • ark-std 0.4.0 development
  • ark-bls12-381 0.4.0
wrappers/rust/icicle-curves/icicle-bw6-761/Cargo.toml cargo
  • ark-bw6-761 0.4.0 development
  • ark-ec 0.4.0 development
  • ark-ff 0.4.0 development
  • ark-poly 0.4.0 development
  • ark-std 0.4.0 development
  • ark-bw6-761 0.4.0
examples/c++/msm/.devcontainer/Dockerfile docker
  • nvidia/cuda 12.0.0-devel-ubuntu22.04 build
examples/c++/multiply/.devcontainer/Dockerfile docker
  • nvidia/cuda 12.2.0-devel-ubuntu22.04 build
examples/c++/ntt/.devcontainer/Dockerfile docker
  • nvidia/cuda 12.0.0-devel-ubuntu22.04 build
examples/rust/msm/.devcontainer/Dockerfile docker
  • nvidia/cuda 12.0.0-devel-ubuntu22.04 build
examples/rust/ntt/.devcontainer/Dockerfile docker
  • nvidia/cuda 12.0.0-devel-ubuntu22.04 build
.github/workflows/codespell.yml actions
  • actions/checkout v3 composite
  • codespell-project/actions-codespell v2 composite
.github/workflows/examples.yml actions
  • actions/checkout v2 composite
examples/c++/polynomial_multiplication/.devcontainer/Dockerfile docker
  • nvidia/cuda 12.0.0-devel-ubuntu22.04 build
.github/workflows/check-changed-files.yml actions
  • actions/checkout v4 composite
  • tj-actions/changed-files v39 composite
.github/workflows/cpp_cuda.yml actions
  • actions/checkout v4 composite
.github/workflows/deploy-docs.yml actions
  • actions/checkout v3 composite
  • actions/setup-node v3 composite
  • peaceiris/actions-gh-pages v3 composite
.github/workflows/golang.yml actions
  • actions/checkout v4 composite
  • actions/download-artifact v4 composite
  • actions/upload-artifact v4 composite
.github/workflows/rust.yml actions
  • Jimver/cuda-toolkit v0.2.11 composite
  • actions/checkout v4 composite
.github/workflows/test-deploy-docs.yml actions
  • actions/checkout v3 composite
  • actions/setup-node v3 composite
examples/rust/poseidon/Cargo.toml cargo
wrappers/rust/icicle-curves/icicle-grumpkin/Cargo.toml cargo
  • ark-ec 0.4.0 development
  • ark-ff 0.4.0 development
  • ark-poly 0.4.0 development
  • ark-std 0.4.0 development
examples/rust/poseidon/.devcontainer/Dockerfile docker
  • nvidia/cuda 12.0.0-devel-ubuntu22.04 build
docs/package-lock.json npm
  • 1096 dependencies
docs/package.json npm
  • prettier ^3.2.4 development
  • @docusaurus/core 2.0.0-beta.18
  • @docusaurus/preset-classic 2.0.0-beta.18
  • @mdx-js/react ^1.6.22
  • clsx ^1.1.1
  • hast-util-is-element 1.1.0
  • mdx-mermaid ^1.2.2
  • mermaid ^9.1.2
  • prism-react-renderer ^1.3.1
  • react ^17.0.2
  • react-dom ^17.0.2
  • rehype-katex 5
  • remark-math 3