This repository contains the implementation of SpaZK.
We prepare the benchmarks for some basic blocks
- Sumcheck benchmarks. (
sumcheck
is migrated from Arkworks)
- Run
cargo bench -p sumcheck > logs/sc.txt
. - To convert it into a table, run
cat logs/sc.txt | python3 scripts/bench_info.py
.
- PCS benchmarks. (
pcs
is migrated from Jolt)
- Run
cargo bench -p pcs > logs/pcs.txt
. - To convert it into a table, run
cat pcs.txt | python3 scripts/bench_info.py
.
We also prepare the examples for linear layer implementations.
- Ternary matrix vector multiplication.
- Run
cargo run --release -p gkr --example ternary_matrix --features ark-std/print-trace > logs/ternary_matrix.txt
. - To convert it into a table, run
cat logs/ternary_matrix.txt | python3 sc_info.py
- Normal matrix vector multiplication.
- Run
cargo run --release -p gkr --example normal_matrix --features ark-std/print-trace > logs/normal_matrix.txt
. - To convert it into a table, run
cat logs/normal_matrix.txt | python3 sc_info.py
.
- Ternary matrix vector multiplication implemented by GKR circuit.
- Run
cargo run --release -p gkr --example ternary_matrix_circuit --features ark-std/print-trace > logs/ternary_matrix_circuit.txt
. - To convert it into a table, run
cat logs/ternary_matrix_circuit.txt | python3 sc_info.py
.
- Normal matrix vector multiplication implemented by GKR circuit.
- Run
cargo run --release -p gkr --example normal_matrix_circuit --features ark-std/print-trace > logs/normal_matrix_circuit.txt
. - To convert it into a table, run
cat logs/normal_matrix_circuit.txt | python3 sc_info.py
We implement a simple example containing the linear layer, relu layer and ternary sparse linear layer. Run the following command to run the example:
cargo run -r -p zkml --example zkml --features ark-std/print-trace
The sumcheck package is modified from arkworks-rs/sumcheck and PCS is modified from a16z/jolt.