Noir Android
May 8, 2026 ยท View on GitHub
Description
This library lets you generate and verify proofs with Noir on Android.
Installation
In your settings.gradle file or in your root build.gradle file, add the following in your repositories block:
maven { url 'https://jitpack.io' }
Then, in your app level build.gradle file, add the following in your dependencies block:
implementation("com.github.madztheo:noir_android:1.0.0-beta.20-2")
After this your project should be able to use the library.
Usage
Initialize your circuit
To start generating proofs, you first need to initialize your circuit. You can do this by creating a new instance of the Circuit class, using the fromJsonManifest function and passing it the stringified JSON of the compiled circuit (obtained by running nargo compile).
import com.noirandroid.lib.Circuit
val path = "path/to/compiled/circuit.json"
val circuitData = File(path).readText()
val circuit = Circuit.fromJsonManifest(circuitData)
Note: You can also specify the circuit size if you already know it. This will speed up the setup process (and consume less memory), by skipping the construction of the circuit from the bytecode.
// Assuming the circuit has 40 constraints
val circuit = Circuit.fromJsonManifest(circuitData, 40)
Setup the SRS
Before you can generate proofs, you need to setup the SRS for the circuit. You can do so by calling the setupSrs function.
circuit.setupSrs()
This will download the SRS from Aztec's server and initialize the SRS for the circuit.
If you want to use a local SRS, you can pass a path to a local SRS file as an argument to the setupSrs function.
val srsPath = "path/to/local/srs"
circuit.setupSrs(srsPath)
Generate a proof
To generate a proof, you can call the prove method and pass in the inputs for the proof and the proof type. It will return the proof with its public inputs.
import com.noirandroid.lib.Proof
import java.util.HashMap
import android.util.Log
val inputs: HashMap<String, Any> = HashMap()
inputs["a"] = 5
inputs["b"] = 3
inputs["result"] = 15
val proof: String = circuit.prove(inputs)
Log.d("Proof", proof)
Verify a proof
To verify a proof, you can call the verify method and pass in the proof. It will return a boolean indicating whether the proof is valid or not.
val isValid = circuit.verify(proof)