Zero-knowledge circuits for the ZeroLedger protocol, implementing privacy-preserving deposit and spend operations using PLONK proving system.
This repository contains zero-knowledge circuits that enable private transactions in the ZeroLedger protocol. The circuits implement:
- Deposit operations: Private deposit of funds with commitment generation
- Spend operations: Private spending with various input/output configurations (1-1, 1-2, 1-3, 2-1, 2-2, 2-3, 3-1, 3-2, 3-3, 1-6-1, 8-1)
- Poseidon hashing: Efficient zero-knowledge friendly hash function
- Commitment schemes: Cryptographic commitments for privacy
circuits/
├── circuits/ # Circom circuit definitions
│ ├── deposit/ # Deposit circuit
│ ├── spend_*/ # Various spend circuit configurations
│ └── libs/ # Shared circuit libraries
├── contracts/ # Solidity verifier contracts
├── artifacts/ # Compiled artifacts
├── test/ # Test suites
└── utils/ # Build and utility scripts
- Circom 2.1.4: Circuit definition language
- PLONK: Zero-knowledge proof system
- Poseidon: ZK-friendly hash function
- Hardhat: Ethereum development framework
- TypeScript: Development language
- SnarkJS: JavaScript library for zk-SNARKs
- Node.js (v16+)
- Circom compiler
- PLONK trusted setup files (automatically downloaded)
This project uses the PSE Perpetual Powers of Tau trusted setup ceremony for PLONK proving. The trusted setup file is automatically downloaded from:
- Source: PSE Perpetual Powers of Tau
- URL:
https://pse-trusted-setup-ppot.s3.eu-central-1.amazonaws.com/pot28_0080/ppot_0080_14.ptau - File:
pot14_final.ptau(2^14 constraints)
The trusted setup ceremony involves multiple participants contributing randomness to generate secure proving parameters. This particular setup (contribution 0080) provides a high level of security for circuits with up to 2^14 constraints.
npm installnpm run compileCompiles all circuits and generates:
- R1CS constraint systems
- Witness generators (WASM)
- Proving keys (.zkey)
- Solidity verifiers
npm run testExecutes circuit tests and verifier contract tests.
npm run commitmentGenerates Poseidon commitments for testing.
npm run lint # Check for issues
npm run lint:fix # Auto-fix issuesnpm run deployDeploys verifier contracts to the network.
- Add new circuits in
circuits/directory - Use shared libraries from
circuits/libs/ - Follow naming convention:
circuit_name.circom - Test thoroughly with various input combinations
- Update build scripts if needed
- Circuit compilation with Circom
- R1CS generation
- Witness generation
- Proving key generation
- Solidity verifier generation
- Fork the repository
- Create a feature branch:
git checkout -b feature/your-feature - Make your changes
- Run tests:
npm test - Run linting:
npm run lint - Commit your changes:
git commit -m "Add your feature" - Push to your fork:
git push origin feature/your-feature - Create a Pull Request
- Use GitHub Issues for bug reports
- Include reproduction steps
- Provide relevant logs and error messages
- Tag issues appropriately
This project is licensed under the GNU General Public License v3.0 - see the LICENSE file for details.
For questions and support:
- Open an issue on GitHub
- Check existing documentation
- Review test cases for usage examples