/zk-copyright

Primary LanguagePythonMIT LicenseMIT

zk-copyright

zk-copyright repository provides an E2E pipeline, supported by picozk, to test differential privacy under Zero-Knowledge Proof.


Project Objective

This software is designed to demonstrate two simplified court cases of copy-right infringement discussed in this paper . Both cases either prove or disprove the similarity of the processes to produce outputs, over which two parties - termed as the ’producer’ and ’reproducer’ in our program - are disputing. The first program, which we refer to ’mad-libs example’, is inspired by the Proctor-Gamble case in the paper. It is a ’mad-libs’ style program that uses a hardcoded, short string to choose between a limited number of permutations of a set of text strings.

Only the producer is given pre-filled mad-libs, wherein only the last few words differ from the actual output. Following different steps, both the producer and the reproducer output filled madlibs.

The second program is a toy version of Feist’s case regarding telephone directories in the paper. The dictionary consists of names and phone numbers, including honey entries, and both the producer and the reproducer output lexicographically ordered dictionary by phone numbers in their respective ways. Only the producer possesses a dictionary that is pre-sorted alphabetically by name

Quick Navigation

🚧 Build Docker Image and Run Container

Option A Use published docker image

Run this line of code in the command line:

docker run --platform linux/amd64 -it hicsail/zk-copyright:main   
Option B Clone Repo

Run the following in the command line to get the container up and running:

git clone https://github.com/hicsail/zk-copyright.git # Clone the repository
cd zk-copyright                                       # Move into the root directory of the project
docker-compose up -d --build                          # Inside the root directory, run the build image:

🖥️ Getting started

Step1: Enter Docker Shell

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

    image

If you see something like the following in your command line, you are successfully inside the docker shell

    image
Step2: Install wiztoolkit

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 git@github.mit.edu:sieve-all/wiztoolkit.git
cd wiztoolkit
make
make install

🏋️‍♀️ Run shell script

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 your choice of the Python scripts, copyright_madlibs.py or copyright_phonebook.py, generating zk statements and fire-alarm checks the format of the statements:

/bin/bash ./run_IR0.sh -f copyright_madlibs
/bin/bash ./run_IR0.sh -f copyright_phonebook

👨‍💻 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 git@github.com:hicsail/zk-copyright.git

Move into the root directory of the project and install dependencies

cd zk-copyright
git clone https://github.com/uvm-plaid/picozk.git
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/. 

Run either of these lines in the command line:

python3 copyright_madlibs.py.py
python3 copyright_phonebook.py.py

Both of the current files generate synthetic inputs: one creates a dictionary of names and phone numbers, and the other generates Mad Libs.

You can change the size of these inputs by modifying a variable called 'scale' in copyright_madlibs.py and copyright_phonebook.py , which defaults to 5.

image

For the phonebook system, generates a dictionary with a number of entries equal to the 'scale' value and a max(1, 10%) of honey entries. This means that the default configuration returns a dictionary with 5 entries and 1 honey entry.

The Mad Libs system, on the other hand, produces a Mad Libs statement of 'scale' length with half of the words being blanks. Unless the scale value is changed, it will generate 5-word length Mad Libs with 2 blanks.