mopro-ffi 0.3.3

Mopro is a toolkit for ZK app development on mobile. Mopro makes client-side proving on mobile simple.
Documentation

Mopro FFI

What is MoPro?

MoPro stands for Mobile Prover — a framework designed to simplify the development of client-side zero-knowledge (ZK) proof systems on mobile platforms.

MoPro FFI is a core component of this framework. It generates platform-specific bindings from Rust code, originally using UniFFI to support Swift (iOS) and Kotlin (Android). MoPro FFI abstracts away the complexity of UniFFI setup, as well as integration with Xcode and Android Studio. It provides ready-to-use frameworks and packages that you can simply drag and drop into your Xcode or Android Studio project.

Now, MoPro FFI also support additional FFI tools such as wasm-bindgen, flutter_rust_bridge, and uniffi-bindgen-react-native — eliminating the need for developers to configure each tool manually.

To get the most out of MoPro FFI, we recommend using the companion tool mopro-cli. It offers:

  • Built-in support for various ZK proof systems (e.g., Circom, Halo2, and Noir)
  • Project templates for platforms like Xcode, Android Studio, React Native, Flutter, and the Web

With MoPro CLI, you can scaffold and build a privacy-preserving mobile app in minutes.

👉 Visit zkmopro.org to learn more about using MoPro and MoPro FFI.

Usage

We recommend using mopro-cli to generate project templates for a smoother experience. However, you can also use the mopro-ffi package directly to generate bindings by following the setup instructions below. You can also refer to Rust Setup for more details.

Install mopro-ffi through cargo add mopro-ffi or add mopro-ffi in Cargo.toml

[dependencies]
mopro-ffi = "0.3"

Define the crate-type for the UniFFI build process configuration.

[lib]
crate-type = ["lib", "cdylib", "staticlib"]

iOS

Create a file src/bin/ios.rs in your rust project

fn main() {
    mopro_ffi::app_config::ios::build();
}

Execute the process using the defined binaries. For example

cargo run --bin ios # Debug mode for iOS
CONFIGURATION=release cargo run --bin ios # Release mode for iOS
IOS_ARCHS=aarch64-apple-ios,aarch64-apple-ios-sim cargo run --bin ios # Build for iOS aarch64-apple-ios and aarch64-apple-ios-sim architecture

or

mopro build --platforms ios # with mopro CLI

It will generate bindings for the function you defined with #[uniffi::export]. Please checkout UniFFI | Procedural Macros: Attributes and Derives for more details.

Android

Create a file src/bin/android.rs in your rust project

fn main() {
    mopro_ffi::app_config::android::build();
}

Execute the process using the defined binaries. For example

cargo run --bin android # Debug mode for Android
CONFIGURATION=release cargo run --bin android # Release mode for Android
ANDROID_ARCHS=x86_64-linux-android cargo run --bin android # Build for Android x86_64-linux-android architecture

or

mopro build --platforms android # with mopro CLI

It will generate bindings for the function you defined with #[uniffi::export]. Please checkout UniFFI | Procedural Macros: Attributes and Derives for more details.

Flutter

Create a file src/bin/flutter.rs in your rust project

fn main() {
    mopro_ffi::app_config::flutter::build();
}

Execute the process using the defined binaries. For example

cargo run --bin flutter --no-default-features --features flutter # Debug mode for Flutter
CONFIGURATION=release cargo run --bin flutter --no-default-features --features flutter # Release mode for Flutter

or

mopro build --platforms flutter # with mopro CLI

It will generate bindings for the function you defined with pub fn in src/lib.rs.

React Native

Create a file src/bin/react_native.rs in your rust project

fn main() {
    mopro_ffi::app_config::react_native::build();
}

Execute the process using the defined binaries. For example

cargo run --bin react_native # Debug mode for react native
CONFIGURATION=release cargo run --bin react_native # Release mode for react native

or

mopro build --platforms react-native # with mopro CLI

It will generate bindings for the function you defined with #[uniffi::export]. Please checkout UniFFI | Procedural Macros: Attributes and Derives for more details.

WASM

Create a file src/bin/web.rs in your rust project

fn main() {
    mopro_ffi::app_config::web::build();
}

Execute the process using the defined binaries. For example

cargo run --bin web --no-default-features --features wasm # Debug mode for wasm
CONFIGURATION=release cargo run --bin web --no-default-features --features wasm # Release mode for wasm

or

mopro build --platforms web # with mopro CLI

It will generate bindings for the function you defined with #[wasm_bindgen]. Please checkout The wasm-bindgen Guide for more details.

Integration

Community

Acknowledgements

This work was initially sponsored by a joint grant from PSE and 0xPARC. It is currently incubated by PSE.