Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add prover gnark example #751

Draft
wants to merge 10 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[workspace]

members = ["math", "crypto", "gpu", "benches", "provers/plonk", "provers/stark", "provers/cairo", "provers/groth16", "provers/groth16/arkworks-adapter", "examples/merkle-tree-cli", "examples/prove-miden", "winterfell_adapter"]
members = ["math", "crypto", "gpu", "benches", "provers/plonk", "provers/stark", "provers/cairo", "provers/groth16", "provers/groth16/arkworks-adapter", "examples/merkle-tree-cli", "examples/prove-miden", "examples/prove-gnark-plonk", "winterfell_adapter"]
exclude = ["ensure-no_std"]
resolver = "2"

Expand All @@ -18,6 +18,8 @@ lambdaworks-math = { path = "./math", version = "0.5.0", default-features = fals
stark-platinum-prover = { path = "./provers/stark" }
cairo-platinum-prover = { path = "./provers/cairo" }
lambdaworks-winterfell-adapter = { path = "./winterfell_adapter"}
lambdaworks-plonk = { path = "./provers/plonk"}

[patch.crates-io]
winter-air = { git = "https://github.com/lambdaclass/winterfell-for-lambdaworks.git", branch = "derive-clone-v6.4"}
winter-prover = { git = "https://github.com/lambdaclass/winterfell-for-lambdaworks.git", branch = "derive-clone-v6.4"}
Expand Down
1 change: 1 addition & 0 deletions examples/prove-gnark-plonk/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.json
17 changes: 17 additions & 0 deletions examples/prove-gnark-plonk/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[package]
name = "prove-gnark-example"
version.workspace = true
edition.workspace = true
license.workspace = true
repository.workspace = true

[[bin]]
name = "prove-gnark-example"
path = "src/main.rs"

[dependencies]
lambdaworks-crypto = { workspace = true }
lambdaworks-math = { workspace = true, features = ["lambdaworks-serde-string"] }
lambdaworks-plonk = { workspace = true }
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
8 changes: 8 additions & 0 deletions examples/prove-gnark-plonk/README copy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<div align="center">

# Lambdaworks Polygon Miden Proving example

This programs compiles and executes a miden fibonacci programs, obtains the trace, and then proves it and verifies it with lambdaworks Stark Platinum Prover.

Special thanks to Polygon Miden team for providing the open source VM used here, the prover, and documenting the project.

3 changes: 3 additions & 0 deletions examples/prove-gnark-plonk/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Example of how to use Gnark frontend with lambdaworks

Gnark version needs to be v0.9.1 for the gnark exporter to work (latest as of jan 2024)
71 changes: 71 additions & 0 deletions examples/prove-gnark-plonk/frontend_precomputed_values.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
{
"N": 4,
"N_Padded": 4,
"Omega": "8d51ccce760304d0ec030002760300000001000000000000",
"Input": [
"3",
"9"
],
"Ql": [
"73eda753299d7d483339d80809a1d80553bda402fffe5bfeffffffff00000000",
"73eda753299d7d483339d80809a1d80553bda402fffe5bfeffffffff00000000",
"0",
"1"
],
"Qr": [
"0",
"0",
"0",
"73eda753299d7d483339d80809a1d80553bda402fffe5bfeffffffff00000000"
],
"Qm": [
"0",
"0",
"1",
"0"
],
"Qo": [
"0",
"0",
"73eda753299d7d483339d80809a1d80553bda402fffe5bfeffffffff00000000",
"0"
],
"Qc": [
"0",
"0",
"0",
"0"
],
"A": [
"3",
"9",
"3",
"9"
],
"B": [
"3",
"3",
"3",
"9"
],
"C": [
"3",
"3",
"9",
"3"
],
"Permutation": [
11,
3,
0,
1,
2,
4,
5,
10,
6,
8,
7,
9
]
}
Loading
Loading