A from-scratch zero-knowledge mixer built for learning purposes only. Demonstrates how privacy-preserving protocols can break on-chain links between deposits and withdrawals using ZK proofs.
Important Disclaimer
This project is educational only. It is not secure for real use, has no production hardening, and should never be used with real funds or for actual privacy/anonymity needs. Inspired by classic mixer designs (e.g., Tornado Cash mechanics), but implemented simply to explore ZK concepts.
- Deposit: User provides a secret + nullifier → computes Poseidon commitment → inserts into on-chain Merkle tree
- Withdraw: User reveals secret + nullifier + ZK proof → contract verifies:
- Commitment exists in Merkle tree (via root + proof)
- Nullifier not previously used (prevents double-spend)
- Proof is valid → releases funds to specified address without linking back to deposit
- ZK-friendly Poseidon commitment scheme
- Merkle tree for scalable commitment storage & inclusion proofs
- Full zero-knowledge circuit ensuring privacy
- ZK Circuit Language: Noir (by Aztec)
- Hashing: Poseidon (optimized for ZK)
- Proof System: Barretenberg (via noir.js + bb.js)
- Frontend/Backend: noir.js for proof generation, TypeScript scripts for witness/proof handling
- Smart Contracts: Solidity verifier + Mixer contract (using Foundry)
- Merkle Tree: On-chain Incremental Merkle Tree (IMT) + off-chain reconstruction support
nargo version = 1.0.0-beta.18 | bb --version= 3.0.0-nightly.20260102git clone https://github.com/Ubaid-ch/zk_Mixer.gitnpm install && cd contracts && forge installforge testThis step is needed if you modify the circuit logic at all.
- Navigate inside the circuits folder and compile the circuit
nargo compile- Generate the verifiaction key
bb write_vk --oracle_hash keccak -b ./target/circuits.json -o ./target- Generate the verifier
bb write_solidity_verifier -k ./target/vk -o ./target/Verifier.sol- Delete your old
Verifier.solfrom insidecontracts/srcand replay with the new one!
npm run dev