Skip to content
This repository was archived by the owner on Sep 9, 2024. It is now read-only.

alxkzmn/mopro_flutter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Warning

This code was submitted as an internal PSE hackathon project and is not maintained anymore. The development continues here in the official mopro org repo.

Cross-Platform Mobile ZKPs

Flutter, now the most popular cross-platform framework, has surpassed React Native in popularity over the past few years. Mopro Flutter shows an example of integrating the mobile ZK-proving into a Flutter app, allowing to streamline the creation of ZK-enabled mobile apps.

Running The Example App

  • Open the project in VS Code
  • Open "Run and Debug"
  • Start an emulator (iOS/Android) or connect your phone
  • Select "example" in the run menu and press run

Integrating Your ZKP

The example app comes with a simple prover generated from a Circom circuit. To integrate your own prover, follow the steps below.

Setup

Copying The Generated Libraries

iOS

Android

zKey

  • Put your zKey file in your app assets. For example, to run the included example app, you need to replace the zKey at example/assets/multiplier2_final.zkey with your file. If you change the zKey file name, don't forget to change the asset definition in your app's pubspec.yaml. For example, here: example/pubspec.yaml
assets:
  - assets/multiplier2_final.zkey

If you have changed the zKey asset name, don't forget to also correctly load it. For example, here: example/lib/main.dart

var inputs = <String, List<String>>{};
inputs["a"] = ["3"];
inputs["b"] = ["5"];
proofResult = await _moproFlutterPlugin.generateProof("assets/multiplier2_final.zkey", inputs);

Don't forget to modify the input values for your specific case!