Welcome to the Vocdoni Circuit Artifacts repository! This repository houses the zkSNARK circuit artifacts essential for the new Vocdoni DaVinci Protocol. These artifacts are crucial for ensuring secure and efficient operations within the Vocdoni ecosystem.
The Vocdoni Circuit Artifacts repository contains the generated zkSNARK circuit artifacts for the Vote Verifier and Aggregator components of the Vocdoni DaVinci Protocol. These artifacts are utilized by the Vocdoni Sequencer backend to validate and aggregate votes securely.
All artifact files and their corresponding SHA256 hash files are organized within the ./voteverifier
and ./aggregator
directories in the root folder.
Before generating the circuit artifacts, ensure you have the following installed on your system:
- Go (version 1.22 or later): Download Go
- GNARK Library: A high-performance zkSNARK library for Go.
- promptui: A library for building interactive command-line prompts in Go.
git clone https://github.com/vocdoni/vocdoni-circuit-artifacts.git
cd vocdoni-circuit-artifacts
Ensure you're within the project directory and initialize Go modules:
go mod tidy
Compile the CLI tool to create an executable:
go build -o davinci-artifacts-cli
This command generates an executable named davinci-artifacts-cli
in your current directory.
The davinci-artifacts-cli
tool facilitates the generation of zkSNARK circuit artifacts for the Vocdoni DaVinci Protocol. It offers an interactive menu for selecting the desired operation.
Run the CLI tool with the --destination flag to specify the output directory for the generated artifacts.
./davinci-artifacts-cli
Upon running, you'll encounter an interactive menu with the following options:
? Select an option ›
▸ Generate Vote Verifier Artifacts
Generate Aggregator Artifacts
Generate Both
Exit
Use the up and down arrow keys to navigate through the options and press Enter to select.
-
Select "Generate Vote Verifier Artifacts"
-
Provide Ballot Proof Verification Key Path: You'll be prompted to enter the path to the Ballot Proof Verification Key. A default value is provided, which you can accept by pressing Enter or modify as needed.
? Enter Ballot Proof Verification Key path › ballotproof/ballot_proof_vkey.json
- Artifact Generation: The tool will compile the Vote Verifier circuit, generate the necessary artifacts, compute their SHA256 hashes, and log these hashes into
voteverifier_hashes.txt
within the./voteverifier
directory.
Vote Verifier circuit compiled successfully.
voteverifier.ccs hash: <hash_value>
voteverifier.pk hash: <hash_value>
voteverifier.vk hash: <hash_value>
Vote Verifier hashes logged successfully in ./voteverifier/voteverifier_hashes.txt
- Select "Generate Aggregator Artifacts"
- Artifact Generation: The tool ensures that Vote Verifier artifacts exist before proceeding. It then compiles the Aggregator circuit, generates the necessary artifacts, computes their SHA256 hashes, and logs these hashes into
aggregator_hashes.txt
within the./aggregator
directory.
Aggregator circuit compiled successfully.
aggregator.ccs hash: <hash_value>
dummy.ccs hash: <hash_value>
dummy.pk hash: <hash_value>
aggregator.pk hash: <hash_value>
aggregator.vk hash: <hash_value>
Aggregator hashes logged successfully in ./aggregator/aggregator_hashes.txt
- Select "Generate Both"
- Sequential Artifact Generation: The tool will sequentially generate artifacts for both Vote Verifier and Aggregator, along with their respective hash log files.
Vote Verifier circuit compiled successfully.
voteverifier.ccs hash: <hash_value>
voteverifier.pk hash: <hash_value>
voteverifier.vk hash: <hash_value>
Vote Verifier hashes logged successfully in ./voteverifier/voteverifier_hashes.txt
Aggregator circuit compiled successfully.
aggregator.ccs hash: <hash_value>
dummy.ccs hash: <hash_value>
dummy.pk hash: <hash_value>
aggregator.pk hash: <hash_value>
aggregator.vk hash: <hash_value>
Aggregator hashes logged successfully in ./aggregator/aggregator_hashes.txt
If there's an updated version of the vocdoni-z-sandbox repository (e.g., a new commit or a different branch), you'll need to update the dependency in your project and regenerate the artifacts to incorporate the latest changes.
- Update the Dependency: Use go get to fetch the latest version or switch to a specific branch of the vocdoni-z-sandbox repository.
- To update to the latest commit on the default branch:
go get -u github.com/vocdoni/vocdoni-z-sandbox
- To switch to a specific branch (e.g., new-feature-branch):
go get github.com/vocdoni/vocdoni-z-sandbox@new-feature-branch
- To update to a specific commit (e.g., abcdef123456):
go get github.com/vocdoni/vocdoni-z-sandbox@abcdef123456
- To update to the latest commit on the default branch:
- Verify the Update: Ensure that the
go.mod
andgo.sum
files reflect the updated dependency version:go mod tidy
- Regenerate Artifacts: After updating the dependency, rerun the CLI tool to regenerate the artifacts with the latest changes. Ensure that the artifacts have been updated in their respective directories (
./voteverifier
and./aggregator
) and that the corresponding hash log files have been refreshed with the new SHA256 hashes.
All generated artifacts and their corresponding hash files are stored within the ./voteverifier
directory. Below is an overview of the included files:
voteverifier.ccs
: Constraint System file.voteverifier.pk
: Proving Key.voteverifier.vk
: Verifying Key.voteverifier_hashes.txt
: SHA256 hashes of the above artifacts.
aggregator.ccs
: Constraint System file.dummy.ccs
: Dummy Constraint System file.dummy.pk
: Dummy Proving Key.aggregator.pk
: Proving Key.aggregator.vk
: Verifying Key.aggregator_hashes.txt
: SHA256 hashes of the above artifacts.
-
DaVinci Sequencer Repository: vocdoni-sequencer - This repository utilizes the artifacts generated in this repository to validate and aggregate votes within the Vocdoni DaVinci Protocol.
-
Circom Circuits Repository: z-ircuits - Contains the Circom circuits for generating the Ballot Proof used by the Vote Verifier.