Noir Guide
In this guide we'll talk about how to run Noir (PLONK & HONK, UltraHonk[soon]) Circuits on your iOS/Android devices. We won't go in details about how to setup and build your Noir 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 already have some sample files ready for you that you'll need to get your circuits running.
- srs.dat
- Bytecode
Next, create a file in the root called metro.config.js
so that expo can pick up the dat
extension.
Running the circuits
Setup SRS
SRS (Structured Reference String) is a large file (~300MB). We need this for making our circuits work. This file can be downloaded once and stored locally for future use.
The entire ~300MB SRS is to support circuits of maximum size 33. You won't need all of it if your circuits are small, this file can be trimmed. More here for later.
- You should now be able to download and cache the SRS file locally.
- You should now be able to click "Setup Noir SRS" and setup the srs.
noirSetupSrs
only needs to be called once throughout your app, you can do this in the background when you app opens.
Make the Proof
Voila 🥳 You just made a Noir proof.
On-chain Verification
- Tutorial on On-chain Verification
API Reference
ZkExpo.noirSetupSrs
ZkExpo.noirProve
Some Gotchas
- Make sure to update your dependencies, also use
npx expo install --fix
. - Use Development Client Builds, this won't work on Expo Go as it requires native code.
- When using Development Client for testing, if you do
bunx expo run ios
and push an updated build of your app, AsyncStorage will remember your cached file but iOS would've removed it. In this case, clear your srs file from AsyncStorage and download it again. This is only for development versions of your app, updates on prod will be fine. - 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.
More Reading
- Noir Lang Documentation - https://noir-lang.org/docs