Coder Social home page Coder Social logo

icicle's Introduction

ICICLE

Icicle is a library for ZK acceleration using CUDA-enabled GPUs.

image (4)

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.

If we want ZK hardware today we have FPGAs or GPUs which are relatively inexpensive. However, the biggest selling point of GPUs is the software; we talk in particular about CUDA, which makes it easy to write code running on Nvidia GPUs, taking advantage of their highly parallel architecture. Together with the widespread availability of these devices, if we can get GPUs to work on ZK workloads, then we have made a giant step towards accessible and efficient ZK provers.

Zero Knowledge on GPU

ICICLE is a CUDA implementation of general functions widely used in ZKP. ICICLE currently provides support for MSM, NTT, and ECNTT, with plans to support Hash functions soon.

Supported primitives

  • Fields
    • Scalars
    • Points
      • Projective: {x, y, z}
      • Affine: {x, y}
  • Curves

NOTE: Support for BN254 and BLS12-377 are planned

Build and usage

NOTE: NVCC is a prerequisite for building.

  1. Define or select a curve for your application; we've provided a template for defining a curve
  2. Include the curve in curve_config.cuh
  3. Now you can build the ICICLE library using nvcc
mkdir -p build
nvcc -o build/<ENTER_DIR_NAME> ./icicle/appUtils/ntt/ntt.cu ./icicle/appUtils/msm/msm.cu ./icicle/appUtils/vector_manipulation/ve_mod_mult.cu ./icicle/primitives/projective.cu -lib -arch=native

Testing the CUDA code

We are using googletest library for testing. To build and run the test suite for finite field and elliptic curve arithmetic, run from the icicle folder:

mkdir -p build
cmake -S . -B build
cmake --build build
cd build && ctest

Rust Bindings

For convenience, we also provide rust bindings to the ICICLE library for the following primitives:

  • MSM
  • NTT
    • Forward NTT
    • Inverse NTT
  • ECNTT
    • Forward ECNTT
    • Inverse NTT
  • Scalar Vector Multiplication
  • Point Vector Multiplication

A custom build script is used to compile and link the ICICLE library. The environement variable ARCH_TYPE is used to determine which GPU type the library should be compiled for and it defaults to native when it is not set allowing the compiler to detect the installed GPU type.

NOTE: A GPU must be detectable and therefore installed if the ARCH_TYPE is not set.

Once you have your parameters set, run:

cargo build --release

You'll find a release ready library at target/release/libicicle_utils.rlib.

Example Usage

An example of using the Rust bindings library can be found in our fast-danksharding implementation

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.

License

ICICLE is distributed under the terms of the MIT License.

See LICENSE-MIT for details.

icicle's People

Contributors

omershlo avatar leonhibnik avatar vhnatyk avatar guy-ingo avatar hadaringonyama avatar jeremyfelder avatar dmytrotym avatar punk5736 avatar robik75 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.