The Zero Knowledge Whitelist Tool is a powerful utility for managing an address whitelist using Zero-Knowledge (ZK) proofs.

Overview

zk_whitelist: A Zero Knowledge Whitelist Tool

Test GitHub Latest Release)

The Zero Knowledge Whitelist Tool is a powerful utility for managing an address whitelist using Zero-Knowledge (ZK) proofs. With this tool, you can effortlessly generate the necessary Solidity code for maintaining a secure and effective whitelist for your decentralized application.

DISCLAIMER: This code and presentation is preliminary, unaudited and subject to revision. THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND.

Benefits

  • No On-chain Updates Required: Whitelisting new addresses does not require any on-chain updates. Just run the proofs command with the new addresses file.
  • Constant Proof Size: The proof size remains constant regardless of the number of addresses, ensuring efficiency and scalability.

Requirements

To utilize this tool, ensure that the following are installed on your system:

Recommended Usage

  1. Download, extract and set as executable the binary for your OS from release page:

  2. Create a text file named addresses.txt and list the addresses you want to whitelist, one address per line.

0xdeadbeef...
0xbadcoffee...
  1. Run the command zk_whitelist all. This will generate two Solidity files verifier.sol and zkToken.sol, alongside a addresses.txt.proof.json file.
./zk_whitelist all
  1. Deploy your contracts and use the proofs file from your frontend to call the contract.
  2. Whenever you need to whitelist additional addresses in the future, simply add them to a new file (e.g., new_addresses.txt), and run the command zk_whitelist proofs --input-file "your_new_addresses_file". This will generate the necessary proofs for the new addresses and you can use them without any on-chain changes
./zk_whitelist proofs --input-file "your_new_addresses_file"

Note: Besides verifier.sol, zkToken.sol, and ..proof.json, all other generated files should be kept private and secure. Failing to secure these files could allow others to generate proofs on their own.

Demo

Watch the video

Alternative: Build from source

  1. clone repo
git clone https://github.com/SpiralOutDotEu/zk_whitelist
  1. Create a text file named addresses.txt and list the addresses you want to whitelist, one address per line.
0xdeadbeef...
0xbadcoffee...
  1. Run the command cargo run all. This will generate two Solidity files verifier.sol and zkToken.sol, alongside a ..proof.json file.
cargo run all
  1. Deploy your contracts and use the proofs file from your frontend to call the contract.
  • If you need to whitelist additional addresses in the future, simply add them to a new file (e.g., new_addresses.txt), and run the command cargo run proofs --input-file "your_new_addresses_file". This will generate the necessary proofs for the new addresses and you can use them without any on-chain changes
cargo run proofs --input-file "your_new_addresses_file"

Note: Besides verifier.sol, zkToken.sol, and ..proof.json, all other generated files should be kept private and secure. Failing to secure these files could allow others to generate proofs on their own.

Commands

Here are the available commands provided by this tool::

  • zk_whitelist --help: show help docs
  • zk_whitelist circuit: Creates a circuit file that controls the whitelisting to the current directory.
  • zk_whitelist compile: Compiles the circuit file.
  • zk_whitelist setup: Executes the setup ceremony to generate a secure setup.
  • zk_whitelist verifier: Exports a Solidity verifier.
  • zk_whitelist movejs: Moves the contents of circuit_js to the parent directory for convenience reasons.
  • zk_whitelist token: Generates a sample token Solidity contract to be used together with the verifier.
  • zk_whitelist proofs --input-file "<input_file>": Generates proofs for a new set of addresses specified in <input_file>. Defaults to addresses.txt if no file is specified.
  • zk_whitelist all --input-file "<input_file>": Runs all the commands (circuit, compile, setup, verifier, movejs, token, proofs) one after the other. Defaults to addresses.txt if no file is specified.

Contributing

Contributions are welcome! Feel free to submit a Pull Request or open an Issue for any bugs, enhancements, or new features.


Leverage the power of zero-knowledge proofs to efficiently manage and update your address whitelist while ensuring the scalability and security of your decentralized application.

Comments
  • Migrate CLI Argument Parsing to Clap

    Migrate CLI Argument Parsing to Clap

    This Pull Request introduces a migration of the CLI argument parsing to use the Clap library. The motivation behind this migration is to enhance the CLI's usability and maintainability, providing a structured and extensible approach to handling command-line arguments and subcommands.

    Key Changes:

    • Implemented a Cli struct and a SubCommand enum to represent the available command-line arguments and subcommands in a structured manner.
    • Updated the main function to use Clap for parsing command-line arguments and dispatching subcommands.
    • Replaced manual argument parsing with Clap's automatic parsing, streamlining the argument handling process.
    • Improved error messages and help output by leveraging Clap's built-in functionalities.

    Benefits:

    • Usability: Users now have access to more informative help messages and a clearer command-line interface.
    • Maintainability: The new structured approach makes the code easier to read, understand, and extend with new features in the future.
    • Error Handling: Better error handling with clear error messages when incorrect arguments or subcommands are used.

    This migration alters the way command-line arguments are parsed and handled, marking a significant improvement in the CLI's usability and code maintainability. Users now have access to more informative help messages and a clearer command-line interface.

    opened by SpiralOutDotEu 1
  • refactor(cli): :recycle: Remove tempfile usage for better CI compatib…

    refactor(cli): :recycle: Remove tempfile usage for better CI compatib…

    Summary

    Refactored the test files to remove the usage of the tempfile crate, addressing the failure in GitHub Actions. The tests now utilize the current working directory for file operations, ensuring better compatibility with CI environments.

    Changes

    • Removed tempfile usage in compile_command_tests.rs and circuit_command_tests.rs.
    • Removed tempfile dependency from Cargo.toml and Cargo.lock
    • Utilized the current working directory for file operations in tests.
    • Added cleanup functions to remove any files and directories created during tests.

    Check

    • [x] Tests pass in the CI environment.
    • [x] No leftover files after tests are executed.
    opened by SpiralOutDotEu 1
  • refactor(cli): :recycle: restructure CLI commands, improve testability

    refactor(cli): :recycle: restructure CLI commands, improve testability

    • Split CLI command handling into separate functions for each subcommand (e.g., handle_verifier_subcommand, handle_compile_subcommand, etc.), to improve modularity and testability.
    • Refactor execute_setup_command to accept random strings as arguments, facilitating testing.
    • Introduce MockCommandRunner and RealCommandRunner to abstract command execution, enabling better unit and integration testing.
    • Refactor integration tests to ensure preliminary commands are executed as needed, and to verify the generation of expected output files.
    • Add comprehensive comments and Rust documentation for functions, tests, and modules, enhancing code readability and maintainability.
    opened by SpiralOutDotEu 0
  • Migrate CLI Argument Parsing to Clap

    Migrate CLI Argument Parsing to Clap

    This Pull Request introduces a migration of the CLI argument parsing to use the Clap library. The motivation behind this migration is to enhance the CLI's usability and maintainability, providing a structured and extensible approach to handling command-line arguments and subcommands.

    Key Changes:

    • Implemented a Cli struct and a SubCommand enum to represent the available command-line arguments and subcommands in a structured manner.
    • Updated the main function to use Clap for parsing command-line arguments and dispatching subcommands.
    • Replaced manual argument parsing with Clap's automatic parsing, streamlining the argument handling process.
    • Improved error messages and help output by leveraging Clap's built-in functionalities.

    Benefits:

    • Usability: Users now have access to more informative help messages and a clearer command-line interface.
    • Maintainability: The new structured approach makes the code easier to read, understand, and extend with new features in the future.
    • Error Handling: Better error handling with clear error messages when incorrect arguments or subcommands are used.

    This migration alters the way command-line arguments are parsed and handled, marking a significant improvement in the CLI's usability and code maintainability.

    opened by SpiralOutDotEu 0
  • Feature/compile command

    Feature/compile command

    Summary

    Implemented the compile command to execute the circom compilation process for the generated circuit.circom file. This PR includes tests, command implementation, and refactoring for better code organization and readability.

    Changes

    • Added tests for compile command.
    • Implemented compile command.
    • Refactored circuit command for improved readability.
    • Other minor refactoring in test files.
    opened by SpiralOutDotEu 0
Releases(v1.9.10)
Owner
Nikos Koumbakis
Nikos Koumbakis
Noir is a domain specific language for zero knowledge proofs

The Noir Programming Language Noir is a Domain Specific Language for SNARK proving systems. It has been designed to use any ACIR compatible proving sy

null 404 Jan 1, 2023
Safeguard your financial privacy with zero-knowledge proofs.

Spinner The Spinner project (https://spinner.cash) takes a privacy first approach to protect users crypto assets. It is a layer-2 protocol built on th

Spinner 21 Dec 28, 2022
STARK - SNARK recursive zero knowledge proofs, combinaison of the Winterfell library and the Circom language

STARK - SNARK recursive proofs The point of this library is to combine the SNARK and STARK computation arguments of knowledge, namely the Winterfell l

Victor Colomb 68 Dec 5, 2022
RISC Zero is a zero-knowledge verifiable general computing platform based on zk-STARKs and the RISC-V microarchitecture.

RISC Zero WARNING: This software is still experimental, we do not recommend it for production use (see Security section). RISC Zero is a zero-knowledg

RISC Zero 653 Jan 3, 2023
A fast, simple and powerful open-source cross platform utility tool for generating strong, unique and random passwords

password-generator-pro A fast, simple and powerful open-source cross platform utility tool for generating strong, unique and random passwords. Feature

Sebastien Rousseau 3 Dec 16, 2022
Thaler's Proofs, Args, and ZK Implemented in Rust using arkworks

rthaler • Dr. Thaler's book Proofs, Args, and ZK implemented in rust using the arkworks cryptographic rust toolset. Various Zero Knowledge Protocols a

null 4 Jun 19, 2022
A Software Development Kit (SDK) for Zero-Knowledge Transactions

Aleo SDK The Aleo SDK is a developer framework to make it simple to create a new account, craft a transaction, and broadcast it to the network. Table

Aleo 270 Jan 5, 2023
Zerocaf: A library built for EC operations in Zero Knowledge.

Dusk-Zerocaf WARNING: WIP Repo. Fast, efficient and bulletproof-friendly cryptographic operations. This repository contains an implementation of the S

Dusk Network 50 Oct 31, 2022
Zero-Knowledge Assembly language and compiler

zkAsm A Zero-Knowledge circuit assembly language, designed to represent Zero-Knowledge circuits in a compressed format, to be stored on blockchains. I

null 1 Dec 30, 2021
OpenZKP - pure Rust implementations of Zero-Knowledge Proof systems.

OpenZKP OpenZKP - pure Rust implementations of Zero-Knowledge Proof systems. Overview Project current implements ?? the Stark protocol (see its readme

0x 529 Jan 5, 2023
Vector OLE and zero-knowledge for Z2k.

Mozzarella Benchmarking Code This repository contains the code developed for the benchmarking experiments in our paper: "Moz $\mathbb{Z}_{2^k}$ arella

null 7 Dec 20, 2022
Zero Knowledge Light Client Implementation by Zpoken team.

zkp for chain state Prerecusites This project requires using the nightly Rust toolchain, which can be used by default in this way: rustup default nigh

Zpoken 40 Mar 6, 2023
A fast zero-knowledge proof friendly Move language runtime environment.

zkMove Lite zkMove Lite is a lightweight zero-knowledge proof friendly Move language virtual machine. Move bytecode is automatically "compiled" into c

YoungRocks 43 May 20, 2023
Spartan2: High-speed zero-knowledge SNARKs.

Spartan2: High-speed zero-knowledge SNARKs. Spartan is a high-speed zkSNARK, where a zkSNARK is type cryptographic proof system that enables a prover

Microsoft 7 Jul 28, 2023
Implementation of zero-knowledge proof circuits for Tendermint.

Tendermint X Implementation of zero-knowledge proof circuits for Tendermint. Overview Tendermint X's core contract is TendermintX, which stores the he

Succinct 3 Nov 8, 2023
ZKP fork for rust-secp256k1, adds wrappers for range proofs, pedersen commitments, etc

rust-secp256k1 rust-secp256k1 is a wrapper around libsecp256k1, a C library by Peter Wuille for producing ECDSA signatures using the SECG curve secp25

null 53 Dec 19, 2022
Bulletproofs and Bulletproofs+ Rust implementation for Aggregated Range Proofs over multiple elliptic curves

Bulletproofs This library implements Bulletproofs+ and Bulletproofs aggregated range proofs with multi-exponent verification. The library supports mul

[ZenGo X] 62 Dec 13, 2022
P2P Network to verify authorship & ownership, store & deliver proofs.

Anagolay Network Node Anagolay is a next-generation framework for ownerships, copyrights and digital licenses. ?? Local Development The installation a

Anagolay Network 5 May 30, 2022
The Light Protocol program verifies zkSNARK proofs to enable anonymous transactions on Solana.

Light Protocol DISCLAIMER: THIS SOFTWARE IS NOT AUDITED. Do not use in production! Tests cd ./program && cargo test-bpf deposit_should_succeed cd ./pr

null 36 Dec 17, 2022