patrickbiel01 / Cairo_Verifier

Apache License 2.0
36 stars 6 forks source link

Cairo Verifier

A STARK Verifier for Cairo programs, written in Rust. For use in the Open Libra Blockchain as a Zero-Knowledge Verification mechanism. Cairo Programs serve as a flexible, robust alternative to manually designing polynomial constraints, which are difficult and can be error-prone.

For a more detailed explanation check out my Medium post.

Based off of STARKWare's Soldity Implementation available at: github/starkware-libs/starkex-contracts/evm-verifier/

Use

Include in your project's cargo.toml:

[dependencies]
cairo-verifier = { git = "https://github.com/patrickbiel01/Cairo_Verifier", branch = "main" }

Call:

use cairo_verifier;

cairo_verifier::verify_proof(
    proof_params, proof, task_meta_data,  cairo_aux_input, cairo_verifier_id
);

verify_proof Definition:

fn verify_proof(
    proof_params: Vec<Uint256>,
    proof: Vec<Uint256>,
    task_meta_data: Vec<Uint256>,
    cairo_aux_input: Vec<Uint256>,
    cairo_verifier_id: Uint256,
)

Note: Uint256 is the num256::uint256::Uint256 crate

Goals:

Currently this verifier only supports Cairo Programs that use Layout 1

Resources:

Papers

      Cairo Whitepaper\       Scalable, transparent, and post-quantum secure computational integrity\       ethSTARK Documentation

STARKWare Articles

      StarkDEX Deep Dive: the STARK Core Engine\       STARK Math Series\       Using SHARP (Shared Prover)\       Cairo for Blockchain Developers

Vitalik Buterin Articles

      STARKs, Part I: Proofs with Polynomials\       STARKs, Part II: Thank Goodness It's FRI-day\       STARKs, Part 3: Into the Weeds

Misc. Articles

      A Hands-On Tutorial for Zero-Knowledge Proofs Series\       Cryptography Stack Exchange Answer

Ropsten Addresses

      0x2886D2A190f00aA324Ac5BF5a5b90217121D5756\       0xe74999fbc71455462c8143b56797d3bb84c1064b