A project integrating pSymm contract with Noir ZK circuits for enhanced privacy.
- ATC (address to custody) - deposit funds to pSymm.
- CTC (custody to custody) - split/anonymize funds between pSymm custodies (without disclosing original commitment)
- Current problem: mismatch of merkle tree root between Noir and Solidity, fixed temporarily with
setRoot
.
- Current problem: mismatch of merkle tree root between Noir and Solidity, fixed temporarily with
- CTA (custody to address) - withdraw funds from pSymm. Currently not implemented.
-
Install JavaScript dependencies:
yarn install
-
Install Noir and the Barretenberg (BB) proving backend by following official documentation.
Run the test suite with:
yarn hardhat test contracts/test/noirPsymm
To create a new circuit (e.g., CTA based on ATC):
-
Copy an existing circuit as a template:
cp -r noir/pSymmATC noir/pSymmCTA cd noir/pSymmCTA
-
Modify the circuit:
- Update the circuit name in
Nargo.toml
- Make necessary modifications to
src/main.nr
- Update the circuit name in
-
Compile the circuit:
nargo compile
This will generate
target/pSymmCTA.json
-
Generate the verifier contract:
bb write_vk -b target/pSymmCTA.json bb contract
The contract will be generated at
target/contract.sol
-
Copy the verifier contract to the contracts directory:
cp target/contract.sol ../../contracts/src/noirPsymm/VerifierCTA.sol
The merkle root generated by the Noir CTC circuit and JavaScript doesn't match the one generated in Solidity contract.