Home

Awesome

efficient-zk-ecdsa

⚠️ This repo is no longer maintained⚠️

We recommend spartan-ecdsa as a replacement

The code in this repo is unaudited and not recommended for production use.

Please refer to this blog post for details. The circuits in this repo uses circuits from circom-ecdsa.

Install dependencies

yarn

Compile the circuit and generate the zkey

yarn run build:ecdsaverify

Run proof generation

yarn run run:ecdsaverify

Run benchmarks

cd ./bench
open ./index.html

The full proof and the proving time will be displayed in the browser console.

Benchmarks

Disclaimer: the following benchmarks are to give an intuition about the proving time of this method. We hope to run a more comprehensive benchmark across many devices soon.

Circuit info

We include details on the circuit implementing the rearranged formula without precomputed multiples for comparison. The more precomputed multiples one uses, the larger the input size but the fewer the # of constraints. This tradeoff is relevant for any on-chain applications of this work:

CircuitConstraintszKey size
ecdsa_verify163,239119MB
ecdsa_verify_pubkey_to_addr315,175197MB
ecdsa_verify_no_precompute1,401,956874MB

Browser proving

The setup:

CircuitProving time
ecdsa_verify39.4s
ecdsa_verify_pubkey_to_addr58.2s

Command line proving

The setup:

CircuitProving time
ecdsa_verify18s
ecdsa_verify_pubkey_to_addr30s