You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I'm a student trying to write zkSNARKs for a project of mine. I just learned about Arkworks -- thanks for the very cool stuff -- and would like to use it with Spartan (https://github.com/microsoft/Spartan) to produce and verify zkSNARKS.
However, it seems like Arkworks doesn't readily interface with Spartan. I explored the spartan repository in arkworks-rs but it didn't seem too integrated with Arkworks.
Does anyone have more insight on using Arkworks with Spartan? In particular, after writing R1CS constraints using crypto-primitives, I don't know how to turn these constraints into an R1CS instance that interface with Spartan's API like verify or prove.
For example, from Spartan's README, this is how to use libspartan to create and verify a SNARK proof. How can I turn an Arkworks R1CS constraints into the (inst, vars, inputs) that Spartan seems to require?
# externcrate libspartan;
# externcrate merlin;
# use libspartan::{Instance,SNARKGens,SNARK};
# use merlin::Transcript;
# use ark_bls12_381::{G1Projective,Fr};
#
# fnmain(){// specify the size of an R1CS instancelet num_vars = 1024;let num_cons = 1024;let num_inputs = 10;let num_non_zero_entries = 1024;// produce public parameterslet gens = SNARKGens::<G1Projective>::new(num_cons, num_vars, num_inputs, num_non_zero_entries);// ask the library to produce a synthentic R1CS instancelet(inst, vars, inputs) = Instance::produce_synthetic_r1cs(num_cons, num_vars, num_inputs);// create a commitment to the R1CS instancelet(comm, decomm) = SNARK::encode(&inst,&gens);// produce a proof of satisfiabilityletmut prover_transcript = Transcript::new(b"snark_example");let proof = SNARK::prove(&inst,&comm,&decomm, vars,&inputs,&gens,&mut prover_transcript);// verify the proof of satisfiabilityletmut verifier_transcript = Transcript::new(b"snark_example");assert!(proof
.verify(&comm,&inputs,&mut verifier_transcript,&gens).is_ok());println!("proof verification successful!");
# }
What are some detailed steps or caveats if anyone has tried wiring these up before?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi, I'm a student trying to write zkSNARKs for a project of mine. I just learned about Arkworks -- thanks for the very cool stuff -- and would like to use it with Spartan (https://github.com/microsoft/Spartan) to produce and verify zkSNARKS.
However, it seems like Arkworks doesn't readily interface with Spartan. I explored the
spartan
repository inarkworks-rs
but it didn't seem too integrated with Arkworks.Does anyone have more insight on using Arkworks with Spartan? In particular, after writing R1CS constraints using
crypto-primitives
, I don't know how to turn these constraints into an R1CS instance that interface with Spartan's API likeverify
orprove
.For example, from Spartan's README, this is how to use libspartan to create and verify a SNARK proof. How can I turn an Arkworks R1CS constraints into the (inst, vars, inputs) that Spartan seems to require?
What are some detailed steps or caveats if anyone has tried wiring these up before?
Thank you!
Beta Was this translation helpful? Give feedback.
All reactions