mirror of
https://github.com/personaelabs/spartan-ecdsa.git
synced 2026-01-09 14:07:54 -05:00
90a8ad3b83bb00bbb20c125c14cfde4a86e88f72
spartan-ecdsa
Efficient in-browser zero-knowledge ECDSA membership proving
What we use
Spartan
- We use a fork of Spartan that operates over the secq256k1 curve.
Nova-Scotia
- We use a fork of Nova-Scotia to compile Circom circuits into a binary format that Spartan can process. We slightly modify Nova-Scotia to be compatible with secq256k1.
About proving
Witness generation
- We use the wasm witness generator generated by Circom to compute the witness. More specifically, the witness generation is done by running
snarkJs.wtns.calculate(the actual code here).
Proof generation
- The prover is a SpartanNIZK prover in wasm, which reads a circuit compiled by Nova-Scotia.
Development
Compile prover to wasm
Install wasm-pack
curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
Run compile script
sh ./scripts/build_wasm.sh
Compile Circom R1CS to serialized Spartan circuit instance
cargo run --release --bin gen_spartan_inst
Run compiled wasm in browser
Get into browser_benchmark dir
cd ./packages/browser_benchmark
Install dependencies
yarn
Start server
yarn dev
Build
Switch to nightly Rust using rustup:
rustup default nightly
build
cargo build
Run Circom circuit tests
Install this fork of Circom that supports compiling to the secp256k1 base field.
git clone https://github.com/DanTehrani/circom-secq
cd circom && cargo build --release && cargo install --path circom
(In this repo) Install dependencies and run tests
cd packages/circuits
yarn
yarn jest
Description
Languages
Rust
70.2%
Circom
11.6%
TypeScript
8.8%
Sage
4.8%
JavaScript
4.4%
Other
0.2%