Git Product home page Git Product logo

plonky2's Introduction

Plonky2 & more

This repository was originally for Plonky2, a SNARK implementation based on techniques from PLONK and FRI. It has since expanded to include tools such as Starky, a highly performant STARK implementation.

Documentation

For more details about the Plonky2 argument system, see this writeup.

Polymer Labs has written up a helpful tutorial here!

Examples

A good starting point for how to use Plonky2 for simple applications is the included examples:

  • factorial: Proving knowledge of 100!
  • fibonacci: Proving knowledge of the hundredth Fibonacci number
  • range_check: Proving that a field element is in a given range
  • square_root: Proving knowledge of the square root of a given field element

To run an example, use

cargo run --example <example_name>

Building

Plonky2 requires a recent nightly toolchain, although we plan to transition to stable in the future.

To use a nightly toolchain for Plonky2 by default, you can run

rustup override set nightly

in the Plonky2 directory.

Running

To see recursion performance, one can run this bench, which generates a chain of three recursion proofs:

RUSTFLAGS=-Ctarget-cpu=native cargo run --release --example bench_recursion -- -vv

Jemalloc

Plonky2 prefers the Jemalloc memory allocator due to its superior performance. To use it, include jemallocator = "0.5.0" inCargo.tomland add the following lines to your main.rs:

use jemallocator::Jemalloc;

#[global_allocator]
static GLOBAL: Jemalloc = Jemalloc;

Jemalloc is known to cause crashes when a binary compiled for x86 is run on an Apple silicon-based Mac under Rosetta 2. If you are experiencing crashes on your Apple silicon Mac, run rustc --print target-libdir. The output should contain aarch64-apple-darwin. If the output contains x86_64-apple-darwin, then you are running the Rust toolchain for x86; we recommend switching to the native ARM version.

Licenses

As this is a monorepo, see the individual crates within for license information.

Security

This code has not yet been audited, and should not be used in any production systems.

While Plonky2 is configurable, its defaults generally target 100 bits of security. The default FRI configuration targets 100 bits of conjectured security based on the conjecture in ethSTARK.

Plonky2's default hash function is Poseidon, configured with 8 full rounds, 22 partial rounds, a width of 12 field elements (each ~64 bits), and an S-box of x^7. BBLP22 suggests that this configuration may have around 95 bits of security, falling a bit short of our 100 bit target.

Links

  • System Zero, a zkVM built on top of Starky (no longer maintained)
  • Waksman, Plonky2 gadgets for permutation checking using Waksman networks (no longer maintained)
  • Insertion, Plonky2 gadgets for insertion into a list (no longer maintained)
  • u32, Plonky2 gadgets for u32 arithmetic (no longer actively maintained)
  • ECDSA, Plonky2 gadgets for the ECDSA algorithm (no longer actively maintained)

plonky2's People

Contributors

wborgeaud avatar npwardberkeley avatar dlubarov avatar typ3c4t avatar nbgl avatar nashtare avatar bgluth avatar unzvfu avatar sladuca avatar bhgomes avatar hratoanina avatar therealyingtong avatar 4l0n50 avatar 0x0ece avatar jimpo avatar lindaguiga avatar recmo avatar honeywest avatar qope avatar

Stargazers

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