This is a developer tool that's intended to help with developing zero knowledge circuits within EVM smart contracts.
Bun is super fast - I reckon use it to manage dependencies:
bun install
but you can use npm
, yarn
, whatever floats your boat.
You will also need:
- nargo (version >= 0.33.0)
- bb (version >= 0.47.1)
You can read more about installing them here:
Note: versions of BB and Noir have to be somewhat micro managed to get the circuits + proofs to run happily. There's is a normally list of equivalencies here that explain which is which, i.e:
To change these versions once you have them installed, you can run:
## change bb version
bbup -v <VERSION>
## change noir version
nargo --version <VERSION>
From root, this is a hardhat project. That means that you just run:
bun hardhat test
to run tests, or
bun hardhat <whatever_hardhat_command>
for any other hardhat commands.
The Noir project is located at circuits/
. You can read more about Noir project structure in their docs.
For this template, it's assumed that you will have nargo >= 0.33.0
installed. You can find installation instructions here.
Noir allows you to test your circuit within the circuits/src/main.nr
file, and those tests can be ran within noir by running:
cd circuits
nargo test
Any time that you change your circuit in circuits/src/main.nr
, chances are that you'll need to rebuild your Solidity verifier contract. This can be done with:
bun build:circuit
This will generate the Verifier contract and place it in contracts/circuits/UltraVerifier.sol
You can also build and then run the hardhat tests by running:
bun build:circuit:test
Note
Only single circuit is supported at the moment. If you have multiple circuits, you will need to manually combine the generated verifier contracts yourself. Multiple circuit support should be coming soon 👀
If you have any issues or questions please reach out here or @ me on twitter @0xbenhooper
happy hacking
This code is not audited and I only have pretty rudimentary knowledge of the moon maths at hand. If you're serious about deploying this - please get this looked at by someone who knows what an UltraPLONK is.