-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: first version of command line interface (#36)
* wip on prover cli * wip on networking * wip on co-circom binary * feat: improve configuration for mpc-net * fix: re-write sharedwitness to also include public values * feat: working witness splitting and proof gen + verification * fix: cleanup + clippy fixes * ci: add deny.toml * docs: update package keys for crates * chore: split-witness command now takes witness as argument instead of input --------- Co-authored-by: Franco Nieddu <[email protected]>
- Loading branch information
Showing
43 changed files
with
735 additions
and
222 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -75,3 +75,4 @@ tokio = { version = "1.34.0", features = [ | |
"io-util", | ||
"macros", | ||
] } | ||
toml = "0.8.13" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,31 @@ | ||
[package] | ||
name = "collaborative-circom" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
publish.workspace = true | ||
authors.workspace = true | ||
edition.workspace = true | ||
repository.workspace = true | ||
homepage.workspace = true | ||
license.workspace = true | ||
rust-version.workspace = true | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[dependencies] | ||
ark-bn254.workspace = true | ||
bincode.workspace = true | ||
circom-types = { version = "0.1.0", path = "../circom-types" } | ||
clap.workspace = true | ||
collaborative-groth16 = { version = "0.1.0", path = "../collaborative-groth16" } | ||
color-eyre.workspace = true | ||
thiserror.workspace = true | ||
mpc-core = { version = "0.1.0", path = "../mpc-core" } | ||
mpc-net.workspace = true | ||
rand.workspace = true | ||
serde.workspace = true | ||
toml = "0.8.13" | ||
thiserror.workspace = true | ||
toml.workspace = true | ||
tracing-subscriber = { workspace = true, features = ["env-filter"] } | ||
tracing.workspace = true | ||
serde_json.workspace = true | ||
ark-groth16.workspace = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
*.json | ||
**/*.shared |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,15 @@ | ||
my_id = 0 | ||
bind_addr = "0.0.0.0:8000" | ||
|
||
bind_addr = "0.0.0.0:10000" | ||
key_path = "data/key0.der" | ||
[[parties]] | ||
party_id = 0 | ||
addr = "localhost:8000" | ||
|
||
id = 0 | ||
dns_name = "localhost:10000" | ||
cert_path = "data/cert0.der" | ||
[[parties]] | ||
party_id = 1 | ||
addr = "localhost:8001" | ||
|
||
id = 1 | ||
dns_name = "localhost:10001" | ||
cert_path = "data/cert1.der" | ||
[[parties]] | ||
party_id = 2 | ||
addr = "localhost:8002" | ||
id = 2 | ||
dns_name = "localhost:10002" | ||
cert_path = "data/cert2.der" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,15 @@ | ||
my_id = 1 | ||
bind_addr = "0.0.0.0:8001" | ||
|
||
bind_addr = "0.0.0.0:10001" | ||
key_path = "data/key1.der" | ||
[[parties]] | ||
party_id = 0 | ||
addr = "localhost:8000" | ||
|
||
id = 0 | ||
dns_name = "localhost:10000" | ||
cert_path = "data/cert0.der" | ||
[[parties]] | ||
party_id = 1 | ||
addr = "localhost:8001" | ||
|
||
id = 1 | ||
dns_name = "localhost:10001" | ||
cert_path = "data/cert1.der" | ||
[[parties]] | ||
party_id = 2 | ||
addr = "localhost:8002" | ||
id = 2 | ||
dns_name = "localhost:10002" | ||
cert_path = "data/cert2.der" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,15 @@ | ||
my_id = 2 | ||
bind_addr = "0.0.0.0:8002" | ||
|
||
bind_addr = "0.0.0.0:10002" | ||
key_path = "data/key2.der" | ||
[[parties]] | ||
party_id = 0 | ||
addr = "localhost:8000" | ||
|
||
id = 0 | ||
dns_name = "localhost:10000" | ||
cert_path = "data/cert0.der" | ||
[[parties]] | ||
party_id = 1 | ||
addr = "localhost:8001" | ||
|
||
id = 1 | ||
dns_name = "localhost:10001" | ||
cert_path = "data/cert1.der" | ||
[[parties]] | ||
party_id = 2 | ||
addr = "localhost:8002" | ||
id = 2 | ||
dns_name = "localhost:10002" | ||
cert_path = "data/cert2.der" |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
cargo run --bin co-circom -- split-witness --input test_vectors/poseidon/witness.wtns --r1cs test_vectors/poseidon/poseidon.r1cs --protocol bla --out-dir test_vectors/poseidon | ||
cargo run --bin co-circom -- generate-proof --witness test_vectors/poseidon/witness.wtns.0.shared --r1cs test_vectors/poseidon/poseidon.r1cs --zkey test_vectors/poseidon/circuit_0000.zkey --protocol bla --config configs/party1.toml --out proof.0.json & | ||
cargo run --bin co-circom -- generate-proof --witness test_vectors/poseidon/witness.wtns.1.shared --r1cs test_vectors/poseidon/poseidon.r1cs --zkey test_vectors/poseidon/circuit_0000.zkey --protocol bla --config configs/party2.toml --out proof.1.json & | ||
cargo run --bin co-circom -- generate-proof --witness test_vectors/poseidon/witness.wtns.2.shared --r1cs test_vectors/poseidon/poseidon.r1cs --zkey test_vectors/poseidon/circuit_0000.zkey --protocol bla --config configs/party3.toml --out proof.2.json | ||
cargo run --bin co-circom -- verify --proof proof.0.json --vk test_vectors/poseidon/verification_key.json --public-inputs test_vectors/poseidon/witness.wtns.0.shared |
Binary file not shown.
Binary file not shown.
94 changes: 94 additions & 0 deletions
94
collaborative-circom/examples/test_vectors/poseidon/verification_key.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
{ | ||
"protocol": "groth16", | ||
"curve": "bn128", | ||
"nPublic": 1, | ||
"vk_alpha_1": [ | ||
"20491192805390485299153009773594534940189261866228447918068658471970481763042", | ||
"9383485363053290200918347156157836566562967994039712273449902621266178545958", | ||
"1" | ||
], | ||
"vk_beta_2": [ | ||
[ | ||
"6375614351688725206403948262868962793625744043794305715222011528459656738731", | ||
"4252822878758300859123897981450591353533073413197771768651442665752259397132" | ||
], | ||
[ | ||
"10505242626370262277552901082094356697409835680220590971873171140371331206856", | ||
"21847035105528745403288232691147584728191162732299865338377159692350059136679" | ||
], | ||
[ | ||
"1", | ||
"0" | ||
] | ||
], | ||
"vk_gamma_2": [ | ||
[ | ||
"10857046999023057135944570762232829481370756359578518086990519993285655852781", | ||
"11559732032986387107991004021392285783925812861821192530917403151452391805634" | ||
], | ||
[ | ||
"8495653923123431417604973247489272438418190587263600148770280649306958101930", | ||
"4082367875863433681332203403145435568316851327593401208105741076214120093531" | ||
], | ||
[ | ||
"1", | ||
"0" | ||
] | ||
], | ||
"vk_delta_2": [ | ||
[ | ||
"10857046999023057135944570762232829481370756359578518086990519993285655852781", | ||
"11559732032986387107991004021392285783925812861821192530917403151452391805634" | ||
], | ||
[ | ||
"8495653923123431417604973247489272438418190587263600148770280649306958101930", | ||
"4082367875863433681332203403145435568316851327593401208105741076214120093531" | ||
], | ||
[ | ||
"1", | ||
"0" | ||
] | ||
], | ||
"vk_alphabeta_12": [ | ||
[ | ||
[ | ||
"2029413683389138792403550203267699914886160938906632433982220835551125967885", | ||
"21072700047562757817161031222997517981543347628379360635925549008442030252106" | ||
], | ||
[ | ||
"5940354580057074848093997050200682056184807770593307860589430076672439820312", | ||
"12156638873931618554171829126792193045421052652279363021382169897324752428276" | ||
], | ||
[ | ||
"7898200236362823042373859371574133993780991612861777490112507062703164551277", | ||
"7074218545237549455313236346927434013100842096812539264420499035217050630853" | ||
] | ||
], | ||
[ | ||
[ | ||
"7077479683546002997211712695946002074877511277312570035766170199895071832130", | ||
"10093483419865920389913245021038182291233451549023025229112148274109565435465" | ||
], | ||
[ | ||
"4595479056700221319381530156280926371456704509942304414423590385166031118820", | ||
"19831328484489333784475432780421641293929726139240675179672856274388269393268" | ||
], | ||
[ | ||
"11934129596455521040620786944827826205713621633706285934057045369193958244500", | ||
"8037395052364110730298837004334506829870972346962140206007064471173334027475" | ||
] | ||
] | ||
], | ||
"IC": [ | ||
[ | ||
"1655549413518972190198478012616802994254462093161203201613599472264958303841", | ||
"21742734017792296281216385119397138748114275727065024271646515586404591497876", | ||
"1" | ||
], | ||
[ | ||
"16497930821522159474595176304955625435616718625609462506360632944366974274906", | ||
"10404924572941018678793755094259635830045501866471999610240845041996101882275", | ||
"1" | ||
] | ||
] | ||
} |
Binary file not shown.
Oops, something went wrong.