Skip to content

tudorpintea999/mopro

 
 

Repository files navigation

mopro

Making client-side proving on mobile simple (and fast).

Overview

  • mopro-core - core mobile Rust library.
  • mopro-ffi - wraps mopro-core and exposes UniFFI bindings.
  • mopro-ios - iOS CocoaPod library exposing native Swift bindings.
  • mopro-android - Android library exposing native Kotlin bindings.
  • mopro-example-app - example iOS app using mopro-ios.
  • ark-zkey - helper utility to make zkey more usable and faster in arkworks.

Architecture

The following illustration shows how mopro and its components fit together into the wider ZKP ecosystem:

mopro architecture (full)

Zooming in a bit:

mopro architecture

How to use

Prepare circuits

  • Install circom and snarkjs
  • Run ./scripts/prepare.sh to check all prerequisites are set.

iOS

Prepare

Build Bindings

To build bindings for iOS simulator debug mode, run

./scripts/build_ios.sh simulator debug

Open the mopro-ios/MoproKit/Example/MoproKit.xcworkspace in Xcode.

Update Bindings

To update bindings, run ./scripts/update_bindings.sh simulator|device debug|release.

  • simulator is for building library to run on iOS simulator, device is for running on a real device
  • debug is for Rust library to be in debug mode and release for release mode

Android

Prepare

  • Install Android Studio
  • Open Android Studio, and navigate to SDK Manager > SDK Tools > NDK (Side by Side) as laid out on the Android Developer site.
  • Export $ANDROID_HOME and change {USER_NAME} to your username
    export ANDROID_HOME="/Users/{USER_NAME}/Library/Android/sdk"
  • Locate which NDK version you have by
    ls $ANDROID_HOME/ndk
    # 26.1.10909125
    and set it to your NDK_PATH environment variable. e.g.
    NDK_PATH=$ANDROID_HOME/ndk/26.1.10909125

    Reference: Running Rust on Android with UniFFI

Build and Update Bindings

To build bindings for android simulator, run

./scripts/build_android.sh

Community and Talks

Join the Telegram group here.

Talk by @oskarth at ProgCrypto/Devconnect (Istanbul, November 2023): Slides (video pending)

Performance

Preliminary benchmarks on an iPhone 14 Max Pro:

  • Keccak256 (150k constraints): 1.5s
    • ~x10-20 faster vs comparable circuit in browser
  • anon-aadhaar / RSA Verify: ~6.5s
    • ~5s for witness generation (still in WASM), ~2s prover time
    • 80% of time on witness generation
    • ~x10 faster vs browser on phone
  • Bottlenecks: loading zkey and wasm witness generation

Acknowledgements

This work is sponsored by a joint grant from PSE and 0xPARC.

About

Making client-side proving on mobile simple.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Swift 40.1%
  • Circom 19.8%
  • Rust 18.0%
  • Shell 5.6%
  • C 4.9%
  • Kotlin 4.3%
  • Other 7.3%