Skip to content

zkSNARK circuit artifacts essential for the new Vocdoni DaVinci Protocol

Notifications You must be signed in to change notification settings

vocdoni/vocdoni-circuits-artifacts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Vocdoni Circuit Artifacts

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.

Table of Contents

Overview

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.

Prerequisites

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.

Installation

Clone the Repository

git clone https://github.com/vocdoni/vocdoni-circuit-artifacts.git
cd vocdoni-circuit-artifacts

Initialize Go Modules

Ensure you're within the project directory and initialize Go modules:

go mod tidy

Build the CLI Tool

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.

Usage

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.

Generating Artifacts

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.

Generate Vote Verifier Artifacts

  1. Select "Generate Vote Verifier Artifacts"

  2. 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
  1. 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

Generate Aggregator Artifacts

  1. Select "Generate Aggregator Artifacts"
  2. 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

Generate Both Artifacts

  1. Select "Generate Both"
  2. 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

Updating Dependencies

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.

Steps to Update Dependency and Regenerate Artifacts

  1. 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
  2. Verify the Update: Ensure that the go.mod and go.sum files reflect the updated dependency version: go mod tidy
  3. 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.

Artifacts

All generated artifacts and their corresponding hash files are stored within the ./voteverifier directory. Below is an overview of the included files:

Vote Verifier Artifacts

Aggregator Artifacts

References

  • 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.

About

zkSNARK circuit artifacts essential for the new Vocdoni DaVinci Protocol

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages