This project generates an execution trace using the Plonky 3 ZKP system and provides a web-based visualizer to inspect the relevant constraints. The project is sourced from Plonky3_Fibonacci. For further information on the respective protocol, please refer to the original repository.
1. In src/, run the Rust program which will generate the trace data as a JSON file (web/trace_data.json).
cargo runpython3 -m http.server 80003. Visit http://localhost:8000 in your browser.
To suspend the local host server from running, use
Ctrl + Z
4. You may modify the sequence length by changing the value of the variables in src/main.rs (lines 138-139):
let num_steps = 8; // Choose the number of Fibonacci steps in powers of 2^n
let final_value = 21; // Expected result of final Fibonacci value-
Cache: If you change the value of
num_stepsin Rust and successfully run once again, but do not see changes in the browser, please perform a Hard Refresh to clear the browser's cache:- Mac:
Cmd + Shift + R - Windows:
Ctrl + F5
- Mac:
-
Port Already in Use: If you get an "Address already in use" error, it means a previous server used is still running. You can force kill any process (on port 8000 for instance) with the following:
lsof -ti:8000 | xargs kill -9
Rust & File Handling
- Serde Serializing/Deserializing Rust data structures.
- Serde JSON Converting serialized data into JSON (String) (Note: This video helped a lot).
- std::fs::File & std::io::Write Filesystem operations, specifically used for creating the output file and writing the JSON byte buffer.
- Vec used to dynamically construct the
trace_matrix(Vec<Vec<String>>).
Plonky3 & Matrix Logic
- Plonky3_Fibonacci
- "Getting Started with Plonky3: Build, Prove, & Verify in ZK"
- Mersenne31 & "31 and Mersenne Primes - Numberphile"
- p3_matrix::Matrix
Web Technologies