ZK privacy pools written in Noir and Solidity.
Project layout:
.
├── README.md
├── circuits - "Noir circuits"
│ ├── Nargo.toml
│ ├── contract
│ │ └── ZeroLink
│ │ └── plonk_vk.sol - "Generated UltraPlonk Solidity verifier"
│ └── src
│ └── main.nr - "ZeroLink Noir circuit"
├── foundry.toml
├── src
│ └── ZeroLink.sol - "ZeroLink Solidity contract"
└── test
└── ZeroLink.t.sol - "Solidity tests"
Install foundry.
curl -L https://foundry.paradigm.xyz | bash
foundryup
Install foundry dependencies.
forge install
Install nargo and switch to latest nightly version.
curl -L https://raw.githubusercontent.com/noir-lang/noirup/main/install | bash
noirup -n
Navigate to the circuits directory.
cd circuits
Run the tests in circuits/src/main.nr.
nargo test
Compile the main circuit.
nargo compile
Create a proof with dummy public & private data from Prover.toml
.
nargo prove
This creates the proof file circuits/proofs/ZeroLink.proof.
The verification of the proof (ZeroLink.proof) and the verifier public input (Verifier.toml
) can be tested.
nargo verify
A proof for the circuit can be verified in Solidity.
nargo codegen-verifier
This creates the Solidity Ultra Plonk verifier (circuits/contract/ZeroLink/plonk_vk.sol) specific to the circuit.
Navigate to the project's root directory.
Run the tests in ZeroLink.t.sol.
forge test
Important
The tests in ZeroLink.t.sol contain hardcoded proofs (for efficiency) that need to be updated in the case that the verification key (plonk_vk.sol) changes.