Skip to content

Commit

Permalink
v0.1.1-alpha.0
Browse files Browse the repository at this point in the history
  • Loading branch information
vivianjeng committed Feb 6, 2025
1 parent 5239431 commit 41ef4e8
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 39 deletions.
38 changes: 34 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 5 additions & 3 deletions mopro-ffi/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "mopro-ffi"
version = "0.1.0"
version = "0.1.1-alpha.0"
edition = "2021"
description = "Mopro is a toolkit for ZK app development on mobile. Mopro makes client-side proving on mobile simple."
license = "MIT OR Apache-2.0"
Expand Down Expand Up @@ -29,7 +29,9 @@ uniffi = { version = "=0.28.0", features = ["cli", "build"] }
serde = { version = "1.0", features = ["derive"] }
anyhow = "1.0.86"
bincode = "1.3.3"
num-bigint = { version = "0.4.3", default-features = false, features = ["rand",] }
num-bigint = { version = "0.4.3", default-features = false, features = [
"rand",
] }

# Error handling
thiserror = "=2.0.3"
Expand All @@ -38,7 +40,7 @@ color-eyre = "=0.6.2"
# circom deps
rust-witness = { version = "0.1.1", optional = true }
ark-ff = { version = "0.4.0", optional = true }
circom-prover = {path = "../circom-prover", optional = true}
circom-prover = { version ="0.1.0", optional = true }

# ZKP generation
ark-bn254 = { version = "=0.4.0", optional = true }
Expand Down
64 changes: 32 additions & 32 deletions mopro-ffi/README.md
Original file line number Diff line number Diff line change
@@ -1,47 +1,47 @@
# mopro-ffi
# Mopro FFI

Mopro is a toolkit for ZK app development on mobile. Mopro makes client-side proving on mobile simple.
`mopro-ffi` is a tool designed to assist programmable cryptography application or rust application developers in efficiently creating bindings for client-side targets.

## Getting started
Key features include:

- Make sure you've installed the [prerequisites](https://zkmopro.org/docs/prerequisites).
- Getting started with this [tutorial](https://zkmopro.org/docs/getting-started).
- **Function Serialization and Export:** Enables serialization and export of functions within each proving system. To generate FFI bindings for different targets, inputs and outputs must conform to the specific types defined in [uniffi](https://mozilla.github.io/uniffi-rs/latest/udl/builtin_types.html).
- Supported proving systems: `circom`, `halo2`.
- **Executable Binaries:** Provides pre-built binaries, allowing developers to generate bindings for various targets effortlessly.
- Supported targets: `swift`, `kotlin`.
- **Customize Exported Functions:** Supports the ability to customize the exported functions. Users can define the functions in the `src/mopro.udl` file.

## Run tests
## Usage

- circom
```sh
cargo test --features circom
```
- halo2
```sh
cargo test --features halo2
```
- Please check the [Manual Setup for Android/iOS Bindings](https://zkmopro.org/docs/setup/rust-setup) for integrating `mopro-ffi` into your project.

## Bindings
## Usage for general Rust application

- `SwiftBindings`
- `KotlinBindings`
- Integrate the `mopro-ffi` like the above tutorial.
- Update the `src/mopro.udl` file to add the functions you want to export. Check out how to define the functions in UDL file: [UniFFI: The UDL file](https://mozilla.github.io/uniffi-rs/0.28/udl_file_spec.html)

The uniffi bindings are precompiled and committed here for a specifically named crate. This avoids the complexity of building/invoking the uniffi cli by dependent packages. Note that dependent crates _must_ have the library name `mopro_bindings`, or rebuild the binding themselves.
- E.g.
export Rust function like
```rust
pub fn hello_world() -> String {
"Hello World!".to_string()
}
```
and define the function in the UDL file like:
```udl
namespace mopro {
// ...
string hello_world();
}
```

## Modules

The root module exports functions for generating proofs. It also exports a macro that can be used to setup uniffi from our provided udl file. User modification to the UDL file is not supported at this time.

### `circom`

Includes all proving and serialization logic for circom proofs. Does _not_ include logic for witness generation.

### `halo2`

Includes all proving logic for halo2.
- Run `cargo run --bin ios` or `cargo run --bin android` again.

## Community

- X account: <a href="https://twitter.com/zkmopro"><img src="https://img.shields.io/twitter/follow/zkmopro?style=flat-square&logo=x&label=zkmopro"></a>
- Telegram group: <a href="https://t.me/zkmopro"><img src="https://img.shields.io/badge/[email protected]?style=flat-square&logo=telegram"></a>
- X account: <a href="https://twitter.com/zkmopro"><img src="https://img.shields.io/twitter/follow/zkmopro?style=flat-square&logo=x&label=zkmopro"></a>
- Telegram group: <a href="https://t.me/zkmopro"><img src="https://img.shields.io/badge/[email protected]?style=flat-square&logo=telegram"></a>
- Mopro Documentation: https://zkmopro.org

## Acknowledgements

This work was initially sponsored by a joint grant from [PSE](https://pse.dev/) and [0xPARC](https://0xparc.org/). It is currently incubated by PSE.
This work was initially sponsored by a joint grant from [PSE](https://pse.dev/) and [0xPARC](https://0xparc.org/). It is currently incubated by PSE.

0 comments on commit 41ef4e8

Please sign in to comment.