This zk-differential privacy repository provides an E2E pipeline, supported by picozk, to test differential privacy under Zero-Knowledge Proof.
This project implements the mechanism described in this paper , using a zero-knowledge proof scheme to show that the noise added to census data is appropriately computed. It utilizes a pseudo-random generator and follows the Laplacian Distribution.
Run this line of code in the command line:
docker run --platform linux/amd64 -it hicsail/zk-dp:main
Run the following in the command line to get the container up and running:
git clone https://github.com/hicsail/zk-DP.git # Clone the repository
cd zk-DP # Move into the root directory of the project
docker-compose up -d --build # Inside the root directory, run the build image:
Since you have a running container, you can subsequently run the following command in your terminal to start Docker Shell:
docker exec -it <containerID> bash
You can get a container-ID from the docker desktop app by clicking the small button highlighted in the red circle
If you see something like the following in your command line, you are successfully inside the docker shell
We are using Fire Alarm, one of wiztoolkit packages. After entering the container, clone wiztoolkit repo and run the following commands to install wiztoolkit:
(* You might need to set up ssh key - Follow the instruction )
git clone [email protected]:sieve-all/wiztoolkit.git
cd wiztoolkit
make
make install
Now all setups are done for you to run your Python script inside the docker shell. Run the following command in the docker shell, and you will see the Python script, differential_privacy.py, generating zk statements and fire-alarm checks the format of the statements:
/bin/bash ./run_IR0.sh -f differential_privacy
👨💻 Run Locally
This option doesn't require Docker, while it focuses on running the Python scripts, skipping setting Fire Alarm.
Run this in the command line:
git clone [email protected]:hicsail/zk-DP.git
Move into the root directory of the project and install dependencies
cd zk-DP
git clone https://github.com/uvm-plaid/picozk.git
cp ./consts/poseidon_hash.py ./picozk/picozk/poseidon_hash/poseidon_hash.py
python3 -m venv venv # or pypy3 -m venv myenv
source venv/bin/activate # or source myenv/bin/activate
pip install --upgrade pip # or pypy3 -m pip install --upgrade pip
pip install -r requirements.txt # or pypy3 -m pip install -r requirements.txt
pip install picozk/. # or pypy3 -m pip install picozk/.
The following will run the main file:
python3 differential_privacy.py # or pypy3 differential_privacy.py
This system utilizes a Pseudorandom Function (PRF) as an integral part of the noise addition process. The current file employs AES as the default PRF. However, you can switch to Triple DES or Poseidon Hash PRF as well in differential_privacy.py .
