Giter Club home page Giter Club logo

rpgf-parsing's Introduction

zk-rpgf-ballots

Setup

  1. Install Rust
  2. Install Risc0 toolchain:
cargo install cargo-binstall
yes | cargo binstall cargo-risczero
cargo risczero install
  1. Install GNU Time:

for Linux:

sudo apt-get install time

for MacOS:

brew install gnu-time
  1. Add wasm32-unknown-unknown target:
rustup target add wasm32-unknown-unknown
  1. Add rust-src:
rustup component add rust-src --toolchain nightly-2024-01-16
  1. Install Node version 18.12.1

Build the project

cargo build --release

Generate sample ballot data

target/release/ballot_generator --badgeholder_count <usize> --ballot_count <usize>

Run private pre-processing step on the ballot data.

target/release/ballot_preprocess --badgeholder_count <uszie> --processed_inputs <path_to_output_file>

Generate the proof (aka receipt) by running the Guest and verifying it in the Host.

This command will run the guest code that hashes vote amounts for the specified project id, commiting the single hash.

cargo run --release --bin op-rpgf -- --project_id <hex_string>
--receipt <path_to_store_receipt_file> --image_id <path_to_store_image_file> --votes_table <path_to_votes_table_file>

Pass the --aggregate flag to hash the vote amounts for all of the projects, commiting to a vector of hashes.

cargo run --release --bin op-rpgf -- --aggregate --receipt <path_to_receipt_file> --votes_table <path_to_votes_table_file>

Test in-browser verification and receipt instances parsing.

npm test -- --<BROWSER>

Run benchmarks (with WASM testing)

 cargo nextest run benchmarking_tests::run_rpgf_ballots_benchmarks_wasm_ --no-capture

Run benchmarks (without WASM testing)

 cargo nextest run benchmarking_tests::run_rpgf_ballots_benchmarks_native_ --no-capture

Profiling the guest code (projects.rs)

Make sure to install go first before running the following command:

RISC0_PPROF_OUT=op_rpgf.pb RISC0_DEV_MODE=1 cargo run --release -F metal --bin op-rpgf -- --aggregate
go tool pprof -http 127.0.0.1:8000 op_rpgf.pb

Stark to groth16 proof conversion (This feat is only for x86 architecture. For Mac you will need to run the following commands in a Rosetta 2 terminal)

First, build the prover image:

cd compact_proof
bash ./scripts/install_prover.sh

Then, generate the groth16 proof by passing the --groth16 flag to the op-rpgf command:

cargo run --release --bin op-rpgf -- --aggregate --groth16 --receipt <path_to_receipt_file> --votes_table <path_to_votes_table_file>

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.