Before you begin, ensure you have met the following requirements:
- Docker: Make sure Docker is installed on your machine. You can download it from here.
Follow these steps to run the project:
- Setup running environment
- Using docker
- Build the docker file:
Open your terminal and navigate to the directory containing the Docker file. Run the following command to build the image:
docker build -t zkp_ckb_tool .
- Spawn the container:
Run the following command to spawn and then access its terminal:
docker run -d --name=zkp_ckb_tool_container zkp_ckb_tool docker exec -it zkp_ckb_tool_container /bin/bash
- Build the docker file:
Open your terminal and navigate to the directory containing the Docker file. Run the following command to build the image:
- Using local
- Install offckb:
npm install -g @offckb/cli
- Run offckb:
offckb node
- Install CLI tools:
cargo install --git https://github.com/VanhGer/plonk_ckb/ cli --branch main
- Download and set permissions for the script:
curl -o ./script.sh https://raw.githubusercontent.com/VanhGer/plonk_ckb/main/script.sh chmod 755 ./script.sh
- Install offckb:
- Using docker
- The full flow contains 3 phases:
- Generate trusted setup: this will generate common parameters that both prover and verifier need to know about.
./script.sh gen-srs <size-of-srs>
- Generate the verifier contract and then deploy it.
./script.sh gen-verifier <contract-name> <equation> [optional] <rpc-ckb>
- Generate ZK proof and submit the proof to the verifier contract to verify it.
Where:./script.sh prover <contract-name> <equation> <witnesses> [optional] <rpc-ckb>
size-of-srs
: The size of the SRS (Structured Reference String)
contract-name
: The name of the crate
equation
: The equation to use
witnesses
: The witnesses to use
rpc
: (optional) The RPC URL of the CKB node\
Here is an example of how to run the verifier script inside the Docker container:
- Run the Verifier with parameters:
This command will run the script.sh with the provided parameters, which will configure the verifier to check the equation x^3 + x + 5 = 35 with x = 3 and connect to the specified URL.
./script.sh gen-srs 1024 ./script.sh gen-verifier plonk_verifier "x^3 + x + 5 = 35" "x=3" ./script.sh prover plonk_verifier "x^3 + x + 5 = 35" "x=3"
- Ensure you have an active internet connection while building and running the Docker container as it requires downloading dependencies and scripts.
- You can modify the parameters passed to the
script.sh
to suit your specific use case. - For more details on how to use offckb, refer to its official documentation.
If you encounter any issues:
- Docker Issues: Refer to the official Docker documentation for troubleshooting Docker-related problems.
- Script Issues: Ensure that the URL and parameters provided to the script are correct and accessible.