This project demonstrates how to integrate a Noir circuit with the mopro CLI to generate platform bindings. See how to install mopro CLI: Getting started.
-
Compile your circuit using the Noir compiler to generate the bytecode and SRS files.
-
Replace the existing
srs.local
and bytecode file in the example app with the newly generated ones.
Warning
The bytecode file only needs to be updated once in src/lib.rs
.
The srs.local file must be updated separately for each platform:
- iOS: ios/MoproApp/ContentView.swift
- Android: android/app/src/main/assets/srs.local
- React Native: react-native/app/(tabs)/index.tsx
- Flutter: flutter/assets/srs.local
Run
mopro build
and select aarch64-apple-ios
Activate android-compat
feature in Cargo.toml.
- noir = { git = "https://github.com/zkmopro/noir-rs", features = ["barretenberg"] }
+ noir = { git = "https://github.com/zkmopro/noir-rs", features = ["barretenberg", "android-compat"] }
Run
mopro build
and select aarch64-linux-android
Copy the generated MoproiOSBindings
directory into your iOS project:
cp -r MoproiOSBindings ios
Copy the generated files into your Android project:
cp -r MoproAndroidBindings/uniffi android/app/src/main/java && \
cp -r MoproAndroidBindings/jniLibs android/app/src/main
Copy the generated files into your React Native project:
cp -r MoproiOSBindings react-native/modules/mopro/ios && \
cp -r MoproAndroidBindings/uniffi react-native/modules/mopro/android/src/main/java && \
cp -r MoproAndroidBindings/jniLibs react-native/modules/mopro/android/src/main
Copy the generated files into your Flutter project:
cp -r MoproiOSBindings flutter/mopro_flutter_plugin/ios && \
cp -r MoproAndroidBindings/uniffi flutter/mopro_flutter_plugin/android/src/main/kotlin && \
cp -r MoproAndroidBindings/jniLibs flutter/mopro_flutter_plugin/android/src/main
Follow the instructions to open the development tools
open ios/MoproApp.xcodeproj
open android -a Android\ Studio
cd react-native && npm install
For iOS simulator:
npm run ios
For iOS device:
npm run ios:device
For Android device/simulator:
npm run android
-
Go to
flutter
directorycd flutter
-
Check flutter environment
flutter doctor
-
Install Flutter Dependencies
flutter pub get
-
Run the app (Please turn on emulators before running the command)
flutter run
The following benchmarks were conducted on Apple M3 chips in release mode:
zkEmail Operation | iOS, Time (ms) | Android, Time (ms) |
---|---|---|
Proof Generation | 1309 | 3826 |
Verification | 962 | 2857 |