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
foundryupInstall foundry dependencies.
forge installInstall nargo and switch to latest nightly version.
curl -L https://raw.githubusercontent.com/noir-lang/noirup/main/install | bash
noirup -nNavigate to the circuits directory.
cd circuitsRun the tests in circuits/src/main.nr.
nargo testCompile the main circuit.
nargo compileCreate a proof with dummy public & private data from Prover.toml.
nargo proveThis 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 verifyA proof for the circuit can be verified in Solidity.
nargo codegen-verifierThis 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 testImportant
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.