zkmopro / mopro

Making client-side proving on mobile simple.
https://zkmopro.org
Apache License 2.0
131 stars 35 forks source link

feat: load zkey from a file path, add file downloader in swift #69

Closed vivianjeng closed 5 months ago

vivianjeng commented 10 months ago

Research for #65

TODO

  1. load from a fixed path e.g. "mopro-core/examples/circom/keccak256/target/keccak256_256_test_final.arkzkey" proving time in swift

    
    Time to deserialize proving key: 9.177727583s
    Time to deserialize matrices: 70.397416ms
    Initializing arkzkey took: 9.25s

Generating proof 2 Witness generation took: 423.89ms Loading arkzkey took: 26.66ms

proof generation took: 1.36s

> there is no much difference between using `ARKZKEY` and `.arkzkey`
> Using `ARKZKEY` is even slightly slower than loading from a `.arkzkey` file

2. 
download from a server `e.g. "https://mopro.vivianjeng.xyz/keccak256_256_test_final.arkzkey"`
```js
Download ark key took: 0.021011948585510254

Time to deserialize proving key: 8.894824041s
Time to deserialize matrices: 26.038125ms
Initializing arkzkey took: 8.92s

Generating proof 2
Witness generation took: 410.84ms

// TODO: should be done in initialization
Time to deserialize proving key: 8.895085333s
Time to deserialize matrices: 24.071833ms
Loading arkzkey took: 8.94s
proof generation took: 979.47ms

3. Init with arkzkey initialization

Time to deserialize proving key: 8.930367541s
Time to deserialize matrices: 24.104291ms

Generating proof 2
Witness generation took: 429.28ms
Loading arkzkey took: 208.00ns
proof generation took: 963.43ms

Verification time 2: 3.227791ms
oskarth commented 9 months ago

What's needed for this PR to be ready for review/merge? Can we gate this feature behind a feature flag maybe? So existing flow works but this can be toggled. Also basic docs in README or so would be great

oskarth commented 9 months ago

@vivianjeng can this PR be closed with #75 merged?