Code Monkey home page Code Monkey logo

crabust / lambdaworks_stark_platinum Goto Github PK

View Code? Open in Web Editor NEW

This project forked from lambdaclass/lambdaworks_stark_platinum

0.0 0.0 0.0 14.22 MB

STARK Cairo prover using lambdaworks. Cairo (CPU Algebraic Intermediate Representation) is a programming language for writing provable programs, where one party can prove to another that a certain computation was executed correctly. Cairo and similar proof systems can be used to provide scalability to blockchains.

Home Page: https://lambdaclass.github.io/lambdaworks_stark_platinum

License: Apache License 2.0

Rust 96.79% Makefile 1.06% Dockerfile 0.07% Cairo 2.07%

lambdaworks_stark_platinum's Introduction

🌟 Lambdaworks Stark Platinum Prover 🌟

drawing

An open-source STARK prover, drop-in replacement for Winterfell.

Telegram Chat

⚠️ Disclaimer

This prover is still in development and may contain bugs. It is not intended to be used in production yet.

Please check issues under security label, and wait for them to be resolved if they are relevant your project.

Output builtin is finished, and range check is supported but it's not sound yet.

We expect to have something working in a good state by mid August 2023.

CLI currently runs with 100 bits of conjecturable security

Table of Contents

Main building blocks

  • STARKS: Everything related to STARKs building blocks such as the prover, verifier and FRI.
  • Cairo: Implementation of the Cairo AIR.

To be added:

  • Add winterfell api compatibility
  • Add parameters for proving and verifying in the CLI / (Public inputs should be serialized and deserialized)
  • Add Cairo compilation inside Rust, to prove and verify Cairo1/Cairo2 from the .cairo file, instead of the .casm file
  • Add last constraint of Range Check Built In
  • Add more parallelization
  • Benchmarks and optimizations for Graviton
  • Bitwise Builtin
  • Cairo Verifier
    • Batch verifier / For trees and N proofs
  • Chiplet support
  • Cuda with Icicle for FTT/NTT
  • Different layouts
  • DSL Plonk
  • Extension fields in Starks
  • Fix "enforce selector" security bug
  • Fix benches against other Field libraries, so results are more stable
  • HyperPlonk - Ultraplonk
  • Improve profiling with multithread
  • JSON serialization for proofs
  • Optimizations
  • Skip layers
  • Stop FRI
  • Batch FRI queries (improves proof size)
  • Others
  • Optimized backend for mini goldilocks
  • Pedersen Builtin
  • Pick hash configuration with ProofOptions
  • Poseidon Builtin
  • Poseidon Hash
    • Poseidon Tree
    • Poseidon Batch Tree
  • Proof of concept of Wasm application running the verifier
  • Quality of life functions (to_decimal_string, from_decimal_string)
  • Sha256 Builtin
  • Sharp compatibility
  • Solidity Verifier
  • Support FFTx for CUDA
  • Tracing tools
  • Virtual columns
  • Vulkan support for FFT
  • Winterfell compatible API

Requirements

  • Cargo 1.69+

How to try it

For the moment, only programs in Cairo 0 with no arguments and contracts in Cairo 1 with no arguments are supported.

πŸš€ Prove and verify

To prove Cairo programs you can use:

make prove PROGRAM_PATH=<compiled_program_path> PROOF_PATH=<output_proof_path>

To verify a proof you can use:

make verify PROOF_PATH=<proof_path>

For example:

make prove PROGRAM_PATH=fibonacci.json PROOF_PATH=fibonacci_proof
make verify PROOF_PATH=fibonacci_proof

To prove and verify with a single command you can use:

make run_all PROGRAM_PATH=<proof_path>

Using Docker compiler for Cairo 0 programs

Build the compiler image with:

make docker_build_cairo_compiler

Then for example, if you have a Cairo program in the project folder, you can use:

make docker_compile_and_run_all PROGRAM=program_name.cairo

Or

make docker_compile_and_prove PROGRAM=program_name.cairo PROOF_PATH=proof_path

Using cairo-compile for Cairo 0 programs

If you have cairo-lang installed, you can use it instead of the Dockerfile

Then for example, if you have some Cairo program in the project folder, you can use:

make compile_and_run_all PROGRAM=program_name.cairo

Or

make compile_and_prove PROGRAM=program_name.cairo PROOF_PATH=proof_path

Compiling Cairo 1 contracts

Clone cairo repository:

git clone https://github.com/starkware-libs/cairo

Checkout version 1.1.0 (corresponding to that tag of the repository). In the cairo folder, run:

git checkout v1.1.0
  • To create json file from Cairo contract:

    cargo run --bin starknet-compile -- /path/to/input.cairo /path/to/output.json
  • To create casm file from json file:

    cargo run --bin starknet-sierra-compile -- /path/to/input.json /path/to/output.casm

Using WASM verifier

To use the verifier in WASM, generate a npm package using wasm-pack

As a shortcut, you can call make build_wasm

Running tests

To run tests, simply use

make test

If you have the cairo-lang toolchain installed, this will compile the Cairo programs needed for tests. If you have built the cairo-compile docker image, that will be used for compiling instead.

Be sure to build the docker image if you don't want to install the cairo-lang toolchain:

make docker_build_cairo_compiler

Running fuzzers

To run a fuzzer, simply use

make fuzzer <name of the fuzzer>

if you donΒ΄t have the tools for fuzzing installed use

make fuzzer_tools

πŸ“š References

The following links, repos and projects have been important in the development of this library and we want to thank and acknowledge them.

🌞 Related Projects

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.