codeesura / zerosync-verifier

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ZeroSync Verifier

A Rust library to verify a ZeroSync proof.

Example

main.rs

use zerosync_verifier::verify;

const ZEROSYNC_URL: &str = "https://zerosync.org/demo/proofs/latest/";

fn main() {
   // Fetch proof and public_inputs
   let public_input_bytes = &reqwest::blocking::get(ZEROSYNC_URL.to_owned() + "air-public-input.json").unwrap().bytes().unwrap();
   let proof_bytes = &reqwest::blocking::get(ZEROSYNC_URL.to_owned() + "aggregated_proof.bin").unwrap().bytes().unwrap();

   // Verify proof
   let chain_state = verify(public_input_bytes.to_vec(), proof_bytes.to_vec());

   println!("ChainState: {}", serde_json::to_string(&chain_state.unwrap()).unwrap());
}

Cargo.toml

[dependencies]
zerosync_verifier = { git = "https://github.com/ZeroSync/zerosync-verifier" }
serde_json = "1.0"
reqwest = { version = "0.11.22", features = ["blocking"] }

About


Languages

Language:Rust 100.0%