2023-01-12 17:06:34 +09:00
2022-12-11 14:56:43 +01:00
2022-12-11 14:56:43 +01:00
2023-01-11 21:30:40 +09:00
2022-12-11 14:56:43 +01:00
2023-01-11 21:30:14 +09:00
2022-12-11 14:56:43 +01:00
2023-01-11 21:30:14 +09:00
2023-01-11 21:30:14 +09:00
2023-01-11 22:14:51 +09:00
2023-01-02 15:16:32 +01:00

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
No description provided
Readme 32 MiB
Languages
Rust 70.2%
Circom 11.6%
TypeScript 8.8%
Sage 4.8%
JavaScript 4.4%
Other 0.2%