This plonk_cpp_example
project is a C++ implementation of the zero-knowledge proof protocol known as PLONK. It is based on the Ethereum Research py_plonk project and translates the original Python implementation into C++. With this project, you can generate and verify zero-knowledge proofs using the PLONK protocol in C++.
To compile and run this project, you will need the following key dependencies:
- nlohmann/json: A JSON handling library (used for proof serialization and deserialization).
- libff: A C++ library for finite fields and elliptic curves, which is essential for the PLONK implementation.
nlohmann/json is a lightweight JSON library that supports modern C++ standards. It is used in the project for proof serialization and network communication.
You can install it as follows:
-
Clone the source code:
git clone https://github.com/nlohmann/json
-
Or install it using a package manager (for example, on Ubuntu):
sudo apt-get install nlohmann-json3-dev
-
Include it in the compilation process by using the
-I
flag:g++ -I/path/to/nlohmann/json -o plonk_example plonk_client.cpp plonk_lib.cpp -L/usr/local/lib -lff -lgmp -lcrypto -lpthread
libff is a C++ library for elliptic curve and finite field arithmetic, commonly used in cryptographic protocols like zero-knowledge proofs.
Steps for installation:
-
Clone the repository:
git clone https://github.com/scipr-lab/libff
-
Install required dependencies: Ensure that
gmp
andcmake
are installed by running:sudo apt-get install libgmp-dev cmake
-
Build and install
libff
:cd libff mkdir build cd build cmake .. make sudo make install
-
During compilation, include the
libff
library using the-I
and-L
flags:g++ -I/usr/local/include -L/usr/local/lib -lff -lgmp -lcrypto -lpthread -o plonk_example plonk_client.cpp plonk_lib.cpp
Once the dependencies are installed, you can compile the project with the following command:
g++ -o plonk_client plonk_client.cpp plonk_lib.cpp \
-I/usr/local/include -I/path/to/nlohmann/json \
-L/usr/local/lib -lff -lgmp -lcrypto -lpthread -static -s
Run the plonk_client
and plonk_server
programs, passing the IP address, port, and path to the ptau
file as command-line arguments.
Example command to run:
./plonk_client 192.168.180.130 55554 /path/to/powersOfTau28_hez_final_11.ptau
- py_plonk: This project is based on the Ethereum Research implementation of the PLONK protocol in Python.
- nlohmann/json: A modern C++ JSON library used for handling JSON data in the project.
- libff: A C++ library for working with elliptic curves and finite fields, crucial for implementing cryptographic proofs.
This project follows the license and usage guidelines of the Ethereum Research project. Please refer to the upstream project's LICENSE for more details.