Halo2 Guide
In this guide we'll talk about how to run Halo2 (PLONK) Circuits on your iOS/Android devices. We won't go in details about how to setup and build your Halo2 Circuits or how to make an Expo App.
Quickstart
Prepping the Project
Let's get started with a blank expo project, you can also use any existing expo app, adding zk-proofs requires only a couple of lines really.
and then add our expo module and relevant libs.
We won't go in details about how to setup and build your Halo2 Circuits or how to make an Expo App. You can find a tutorial on that here and here.
We already have some sample files ready for you that you'll need to get your circuits running, create a directory /public
in the project root and put these files in it.
Next, create a file in the root called metro.config.js
so that expo can pick up the wasm
extension.
Running the circuits
Make the Proof
Voila 🥳 You just made a Halo2 proof.
On-chain Verification
- Tutorial on On-chain Verification
API Reference
ZkExpo.halo2Prove
Some Gotchas
- Make sure to update your dependencies, also use
npx expo install --fix
. - Running Halo2 circuits in a WASM runtime using
zk-expo
requires some simple C glue, read about this in the Halo2 tutorial here. - We are following the PSE's fork of Halo2 v3 which has excellent support for on-chain proof verification.
- Use Development Client Builds, this won't work on Expo Go as it requires native code.
- iOS has memory restrictions of around 2-3GB imposed on each app. If your circuits are really large you might run into issues, consider splitting the circuits.
- If your iOS app runs into any linking issues on developement when using
eas build
, do anbun expo prebuild
and open theios
folder in XCode. XCode GUI uses certain Apple internals that perform better than eas builds that usexcodebuild
under the hood.