Skip to content

zkmopro/react-native-app

Repository files navigation

Mopro React Native App with Expo framework

This is a sample Expo app that demonstrates how mopro can be used to prove a multiplier2 circuit.

Learn more about Mopro: https://zkmopro.org.

Get started

Prerequisites

Use node.js >= 20

nvm use 20

1. Install dependencies

npm install

2. Start the app

  • setup the ANDROID_HOME environment

    export ANDROID_HOME=~/Library/Android/sdk

    start an android emulator/device

    npm run android
  • start an iOS simulator

    npm run ios

    To run the app on a real iOS device, open the Xcode workspace:

    open ios/MyTestLibraryExample.xcworkspace

    Then, in Xcode, select your project in the sidebar, go to Signing & Capabilities → Signing, and choose your Apple account (team) under Team.

  • start a web app

    npm run web

3. Update Mopro Bindings

  • Get MoproReactNativeBindings through Getting Started
  • Update the MoproReactNativeBindings folder

5. Use the React Native Module

  • For example, in src/App.tsx

    import {
        CircomProofResult,
        generateCircomProof,
        ProofLib,
        verifyCircomProof,
    } from 'mopro-ffi';
    
    const circuitInputs = {
        a: ["3"],
        b: ["5"],
    };
    
    const res: CircomProofResult = await generateCircomProof(
        zkeyPath.replace("file://", ""),
        JSON.stringify(circuitInputs),
        ProofLib.Arkworks
    );
    
    const res: boolean = await verifyCircomProof(
        zkeyPath.replace("file://", ""),
        res,
        ProofLib.Arkworks
    );

Screenshots

iOS

Android

About

React Native template for Mopro

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •