arnaucube
arnaucube/davinci-paperPublic Self-hosted repository
changes and fixes
bellesmarta belles.mm@gmail.com
Thu, 26 Mar 2026 22:57:53 +0100
commit

cd91de41e90b8e156fb434c47b4d9d9e102f45be

parent

193b1f5c9b86f115a7a1891837134587b83474d0

M v2/build/main.tex → v2/build/main.tex

@@ -2,6 +2,12 @@ \documentclass[runningheads, draft]{llncs}

%\documentclass{llncs} %\documentclass{article} +% CONSIDERATIONS +% - From \textit{address} to \textit{nullifier} (if you think of an address as a token that allows voters to vote). +% - From \textit{aggregation or accumulation} (in aggregation circuit) to \textit{batching}. +% - Add a section with vulnerabilities. +% - Include the role of the \textit{workers} as \textit{sequencer} helpers? + \input{preamble-packages} \input{preamble-macros} \input{acronyms.tex}

@@ -15,19 +21,22 @@ \title{\Davinci: Decentralized autonomous vote integrity network \texorpdfstring{\\ with cryptographic inference}{}}

\author{ Pau Escrich\inst{1} \and - Marta Bellés\inst{2} \and + Marta Bellés-Muñoz\inst{2} \and Jordi Piñana\inst{1} \and - Lucas Menéndez\inst{1} \and + Lucas Menéndez\inst{1} \and + Alex Kampa\inst{1} \and \linebreak %Alex Kampa (AZKR) Roger Baig\inst{3} \and Jose Luis~Muñoz-Tapia\inst{3} } \institute{ - Vocdoni Association -- \email{\{pau,painan,lucas\}@vocdoni.org} + Vocdoni Association \and - Pompeu Fabra University -- \email{marta.belles@upf.edu} + Pompeu Fabra University \and - Polytechnic University of Catalonia -- \email{\{roger.baig,jose.luis.munoz\}@upc.edu} + Polytechnic University of Catalonia\\ \vspace{0.2cm} + \email{\{pau,painan,lucas,alex\}@vocdoni.org}, \email{marta.belles@upf.edu} \\ + \email{\{roger.baig,jose.luis.munoz\}@upc.edu} } \date{Last update: \today}

@@ -49,21 +58,6 @@ %

Finally, the design of \davinci is grounded in practicality; All components are implemented using current technologies and have undergone proof-of-concept testing. %This ensures that In sum, the proposed architecture is not merely theoretical, but a viable solution ready for short-term deployment. The source code has been made open source, allowing practitioners and researchers to further investigate its details and potential for future uses. \end{abstract} - -{\color{blue}\fbox{\parbox{0.93\textwidth}{ - -\vspace{0.2cm} -\noi Pieces of text marked in \textbf{blue} are heavily work in progress. In addition, there are these general tasks: -\begin{itemize} - \item Notation considerations: - \begin{itemize} - \item From \textit{address} to \textit{nullifier} (if you think of an address as a token that allows voters to vote). - \item From \textit{aggregation or accumulation} (in aggregation circuit) to \textit{batching}. - \end{itemize} - \item Add a section with vulnerabilities. - \item Include the role of the \textit{workers} as \textit{sequencer} helpers? -\end{itemize} -}}} \setcounter{tocdepth}{3} \makeatletter

@@ -116,7 +110,7 @@ \section*{Acknowledgments}

\addcontentsline{toc}{section}{\protect\numberline{}Acknowledgments} \label{sec:acknowledgments} -The authors would like to thank the following reviewers and contributors for their valuable feedback and support: all team members from the Vocdoni association, Jordi Baylina (Iden3 and Polygon), Adrià Massanet (Privacy Scaling Explorations, Ethereum Foundation), Arnaucube (0xPARC), Alex Kampa (AZKR), Javier Herranz (Polytechnic University of Catalonia), Jordi Puiggali (Secrets Vault), and Carla Ràfols (Pompeu Fabra University). +The authors would like to thank the following reviewers and contributors for their valuable feedback and support: all team members from the Vocdoni association, Jordi Baylina (Iden3 and Polygon), Adrià Massanet (Privacy Scaling Explorations, Ethereum Foundation), Arnaucube (0xPARC), Javier Herranz (Polytechnic University of Catalonia), Jordi Puiggali (Secrets Vault), and Carla Ràfols (Pompeu Fabra University). % ---- Bibliography ----
M v2/sections/background.tex → v2/sections/background.tex

@@ -33,7 +33,7 @@ A \ac{SMT} represents a key-value map where each leaf is the hash of a (key, value) pair and each parent node is the hash of its two children. In an \ac{SMT}, every possible key maps to a unique leaf position (with empty slots defaulting to a zero value), yielding a fixed-height binary tree. This property is circuit-friendly, since the proof of a leaf’s membership or non-membership has a consistent length and can be efficiently verified inside a \ac{ZK-SNARK} circuit using a SNARK-optimized hash. In \davinci, the state tree is implemented as an \ac{SMT} of fixed depth. In particular, configuration parameters occupy reserved leaf addresses, each voter’s encrypted ballot is stored at a leaf indexed by their unique identifier, and each one-time vote identifier is recorded at a dedicated leaf path. Because the \ac{SMT} covers a vast key space, a user or sequencer can prove that a given key is present in the state (or conversely, that it remains empty) by providing a short Merkle proof against the tree’s root, rather than revealing the entire state. This enables compact proofs of state correctness. For instance, showing in ZK that a vote identifier has not appeared before or that a new ballot’s ciphertext is correctly inserted into the state. The \ac{SMT} used in \davinci follows the circomlib Merkle tree specification (Poseidon-based)~\cite{todocitation}, ensuring that state updates can be verified succinctly on-chain via the Merkle root and proof.

\paragraph{Incremental Merkle trees.} -The census (voter registry) is maintained with an \ac{IMT}, a binary Merkle tree designed for efficient sequential updates~\cite{todocitation}. Unlike a sparse tree, the \ac{IMT} grows in height only as needed with the number of leaves and eliminates the overhead of hashing dummy ``zero'' siblings. In this scheme, voters are assigned sequential leaf indices in a continuously evolving tree, rather than being placed at cryptographic key-derived positions. In \davinci, the census Merkle tree is built as an \ac{IMT}: each eligible voter’s identifier (or a commitment to it) and voting weight are stored in the next available leaf, and only the Merkle root of this tree (the \censusroot) is published on-chain. This design makes membership updates and proof generation extremely low-cost for the census. Appending a new voter requires recomputing hashes only along the single path from the new leaf to the root, and the tree’s depth adjusts optimally (e.g. a tree of N voters has height $\approx \log_2{N}$, instead of a fixed large height). Consequently, proving one’s inclusion in the voter list is more efficient than it would be with an SMT: the Merkle proof is shorter and involves no unnecessary default nodes. A voter can thus obtain a small proof of their membership in the census (their leaf’s existence under the known root) without revealing their index or identity, and include this in a \ac{ZK-SNARK} to demonstrate eligibility. In summary, the \ac{IMT}’s focus on sequential insertion and minimal hashing overhead makes it well-suited for the frequently-updated census tree, offering better update performance and smaller circuits for verification than a traditional \ac{SMT} structure in this context. +The census (voter registry) is maintained with an \ac{IMT}, a binary Merkle tree designed for efficient sequential updates~\cite{todocitation}. Unlike a sparse tree, the \ac{IMT} grows in height only as needed with the number of leaves and eliminates the overhead of hashing dummy ``zero'' siblings. In this scheme, voters are assigned sequential leaf indices in a continuously evolving tree, rather than being placed at cryptographic key-derived positions. In \davinci, the census Merkle tree is built as an \ac{IMT}: each eligible voter’s identifier (or a commitment to it) and voting weight are stored in the next available leaf, and only the Merkle root of this tree (the \censusroot) is published on-chain. This design makes membership updates and proof generation extremely low-cost for the census. Appending a new voter requires recomputing hashes only along the single path from the new leaf to the root, and the tree’s depth adjusts optimally (e.g. a tree of $N$ voters has height $\approx \log_2{N}$, instead of a fixed large height). Consequently, proving one’s inclusion in the voter list is more efficient than it would be with an SMT: the Merkle proof is shorter and involves no unnecessary default nodes. A voter can thus obtain a small proof of their membership in the census (their leaf’s existence under the known root) without revealing their index or identity, and include this in a \ac{ZK-SNARK} to demonstrate eligibility. In summary, the \ac{IMT}’s focus on sequential insertion and minimal hashing overhead makes it well-suited for the frequently-updated census tree, offering better update performance and smaller circuits for verification than a traditional \ac{SMT} structure in this context. \subsection{Zero-knowledge proofs} \label{sec:background:zkp}

@@ -47,7 +47,7 @@ Informally, while a \ac{ZK} proof convinces the verifier that a valid witness exists, an argument of knowledge additionally ensures that the prover actually knows such a witness, except with negligible probability. \acsp{ZK-SNARK} extend this notion with two crucial properties: they are non-interactive, requiring only a single message from prover to verifier, and succinct, meaning that proof size and verification cost remain small regardless of the size of the underlying statement. For instance, Groth16 proofs~\cite{groth2016size}, which rely on pairing-based cryptography over elliptic curves, %to achieve short proofs and fast verification [Gro16, GWC19].

are only about 200 bytes long and can be verified in a few milliseconds. These properties make \acsp{ZK-SNARK} particularly well-suited for blockchain applications, where verification cost and data size are critical. In \davinci, \acsp{ZK-SNARK} are used at multiple stages of the protocol: voters generate proofs to show that their encrypted ballots are correct and sequencers use recursive \acsp{ZK-SNARK} to allow multiple proofs to be aggregated efficiently and generate proofs to attest to valid state transitions. In essence, \acsp{ZK-SNARK} enable both voters and sequencers to produce compact proofs that can be checked on-chain, ensuring that all protocol rules are followed without requiring trust in any party. \paragraph{Trusted setup.} -A limitation of some \ac{ZK-SNARK} protocols is their reliance on a \ac{CRS} generated during a so-called trusted setup. The \ac{CRS} is built from random values that must not be known to either the prover or the verifier. To achieve this, the \ac{CRS} can be created by a trusted third party or, more robustly, via a secure \ac{MPC} protocol \cite{canetti2001universally}. In an MPC setup, it suffices that at least one participant discards their secret contribution to ensure the integrity of the whole ceremony. {\color{blue}For \davinci, we run an \ac{MPC} for each of the circuits, see Section~\ref{sec:analysis:implementation} and Appendix~\ref{sec:cryptographic-primitives:zkp}.} +A limitation of some \ac{ZK-SNARK} protocols is their reliance on a \ac{CRS} generated during a so-called trusted setup. The \ac{CRS} is built from random values that must not be known to either the prover or the verifier. To achieve this, the \ac{CRS} can be created by a trusted third party or, more robustly, via a secure \ac{MPC} protocol \cite{canetti2001universally}. In an MPC setup, it suffices that at least one participant discards their secret contribution to ensure the integrity of the whole ceremony. {\color{blue}For \davinci, we run an \ac{MPC} for each of the circuits, see Section~\ref{sec:analysis:implementation} and Section~\ref{sec:cryptographic-primitives:zkp}.} % By anchoring these proofs on Ethereum, the protocol ensures that every step of the voting process is publicly verifiable, while preserving voter privacy. %In general, zk-SNARKs for circuit satisfiability (CSAT) require arithmetic circuits to be expressed in a more algebraic form. A common representation is the rank-1 constraint system (R1CS) [GGPR13], which encodes computations as a set of quadratic constraints. A zk-SNARK proof then demonstrates, without revealing any private values, that the prover knows an assignment to all wires of the circuit that satisfies the R1CS. Tooling such as circom provides a high-level language to write arithmetic circuits while still exposing full control over the signals and constraints of the resulting R1CS.
M v2/sections/ballot-protocol.tex → v2/sections/ballot-protocol.tex

@@ -4,7 +4,7 @@ The ballot protocol provides a unified and parametric way to represent a wide range of voting systems within \davinci. Instead of designing a separate circuit for each voting rule, the protocol defines ballots as fixed-length arrays of integers, subject to a small set of configurable parameters. These parameters constrain the values that can appear in each field of the ballot and the aggregate properties of the ballot as a whole. By adjusting these parameters, the same circuit can implement approval voting, ranking, quadratic voting, multiple choice, and many other schemes. In the protocol we refer to the different configurations as the \emph{ballot mode} ($\ballotmode$). This abstraction has two key advantages. First, it allows a broad variety of voting systems to be supported with a minimal circuit design, avoiding conditional logic that would otherwise increase constraint counts. Second, it provides a common interface for tallying, since all ballots are aggregated into a single results array regardless of the voting mode.

\paragraph{Definition of parameters.} %Each ballot is defined as an array of integer values subject to the following configurable parameters: -Each ballot is defined as an array of integer values subject to a set of configurable parameters, illustrated in Figure~\ref{fig:ballot-variables}. These parameters are defined as follows: +Each ballot is defined as an array of integer values subject to a set of configurable parameters, illustrated in Fig.~\ref{fig:ballot-variables}. These parameters are defined as follows: \begin{itemize} \item \numfields: the maximum number of fields (i.e., options) in the ballot. \item \minvalue: the minimum value that each field in the ballot can take.

@@ -32,7 +32,7 @@ \label{fig:ballot-variables}

\end{figure} \vspace{-1cm} -\paragraph{Definition of constraints.} Given a ballot with $n$ fields and each field filled with a value $v_i$ for $i = 1, \dots, n$, we enforce the following constraints (captured in Figure~\ref{fig:ballot-variables}): +\paragraph{Definition of constraints.} Given a ballot with $n$ fields and each field filled with a value $v_i$ for $i = 1, \dots, n$, we enforce the following constraints (captured in Fig.~\ref{fig:ballot-variables}): \begin{itemize} \item $\numfields = n$,

@@ -45,7 +45,7 @@ \paragraph{General mechanism.}

A ballot is valid if and only if all the above constraints are satisfied. Invalid ballots are rejected at the circuit level and do not contribute to the tally. Valid ballots are aggregated into a results array, where each entry is the sum of all votes cast for the corresponding field across all voters. Voter weights, defined in the census tree (see Section~\ref{sec:vocdoni-protocol:census}), are taken into account when computing these sums. By default, all voters have the same weight, but the protocol also supports weighted voting, where different participants may contribute proportionally to their assigned voting power. In this case, \maxvaluesum\ reflects the maximum weight assigned to each voter, and the ballot and verifier circuits enforce that the correct weight is being used (see Sections~\ref{sec:vocdoni-protocol:circuits:ballot} and~\ref{sec:vocdoni-protocol:circuits:verifier} for further details). \paragraph{Ballot modes.} -Ballot modes correspond to different voting systems, each adjusted with the variables above ballot configurations. For usability, the organizer does not need to set every parameter manually: instead, they simply select one of the predefined ballot modes (e.g., quadratic voting, ranking, approval), each corresponding to a fixed parameter configuration. Some representative modes are shown in Figure~\ref{fig:ballot-modes}, which illustrate the expressiveness of the ballot protocol. For example, in \emph{approval voting}, each field is binary and voters can approve or reject multiple options simultaneously. In \emph{ranking}, fields must form a permutation of the integers from $1$ to $N$, enforcing uniqueness of values. In \emph{quadratic voting}, voters allocate credits across options, and the cost is quadratic in the number of credits used, captured by setting \costexponent$=2$. Other systems such as single-choice or multiple-choice elections are special cases of the same framework. The figure also illustrates examples of voters' ballots, with the last column indicating whether each ballot is valid or invalid under the rules of the selected mode. +Ballot modes correspond to different voting systems, each adjusted with the variables above ballot configurations. For usability, the organizer does not need to set every parameter manually: instead, they simply select one of the predefined ballot modes (e.g., quadratic voting, ranking, approval), each corresponding to a fixed parameter configuration. Some representative modes are shown in Fig.~\ref{fig:ballot-modes}, which illustrate the expressiveness of the ballot protocol. For example, in \emph{approval voting}, each field is binary and voters can approve or reject multiple options simultaneously. In \emph{ranking}, fields must form a permutation of the integers from $1$ to $N$, enforcing uniqueness of values. In \emph{quadratic voting}, voters allocate credits across options, and the cost is quadratic in the number of credits used, captured by setting \costexponent$=2$. Other systems such as single-choice or multiple-choice elections are special cases of the same framework. The figure also illustrates examples of voters' ballots, with the last column indicating whether each ballot is valid or invalid under the rules of the selected mode. %\begin{landscape} \begin{figure}[h]
M v2/sections/census.tex → v2/sections/census.tex

@@ -1,18 +1,19 @@

% !TeX root = ../build/main.tex -{\color{blue}\textbf{INDEX is missing!}}\\ - -The census defines the set of eligible voters and their associated voting weights. At its core, a census is simply a dataset that, for each voter, contains a unique identifier (typically an Ethereum address), a voting weight, and a means to produce a membership proof that can be verified inside a \ac{ZK} circuit. \Davinci supports two mechanisms for generating such proofs: +The census defines the set of eligible voters and their associated voting weights. At its core, a census is simply a dataset that, for each voter, contains a unique identifier (typically an Ethereum address), a sequential index, a voting weight, and a means to produce a membership proof that can be verified inside a \ac{ZK} circuit. \Davinci supports two mechanisms for generating such proofs: \begin{itemize} - \item \textit{Credential-based membership proofs}: eligibility is certified by a digital signature issued by a \ac{CSP}. - \item \textit{Merkle-tree-based membership proofs}: the census is organized as an incremental Merkle tree (see Section~\ref{sec:cryptographic-primitives:merkle-trees}) and denoted by $\hlset{\censusTree}$. Each voter is assigned a sequential index in the tree, and their identifier and weight are stored in the corresponding leaf. Only the Merkle root is kept on-chain, and sequencers supply Merkle proofs to attest membership. + \item \textit{Credential-based membership proofs}: eligibility is certified by a digital signature issued by a \ac{CSP}. The CSP assigns a unique index ($\idx$) to each voter and includes it in the signed credential alongside the voter's identifier (\address) and weight (\weight). + \item \textit{Merkle-tree-based membership proofs}: the census is organized as an incremental Merkle tree (see Appendix~\ref{sec:cryptographic-primitives:merkle-trees}) and denoted by $\hlset{\censusTree}$. Each voter is assigned a unique sequential index ($\idx$) in the tree, and their identifier and weight are stored in the corresponding leaf. Only the Merkle root is kept on-chain, and sequencers supply Merkle proofs to attest membership. Each voter is assigned a unique sequential index ($\idx$) at the time of registration, and their identifier ($\address$) and weight ($\weight$) are stored as a leaf at position $\idx$ in the tree. A membership proof ($\censuspf$) for voter $i$ is a Merkle path attesting that the tuple $(\address_i,\weight_i)$ is stored at position $\idx$ under the committed census tree root. + Sequencers supply these Merkle proofs to attest voters' membership to the census and the index $\idx$ is used to derive the voter's reserved storage slot in the state tree (see Section~\ref{sec:vocdoni-protocol:state-tree}). + + \end{itemize} % To support different census models, the \hlget{\electionregistry} smart contract stores the following three parameters: \begin{itemize} \item \censusorigin: the deployment model (off-chain static, off-chain dynamic, on-chain dynamic, or \ac{CSP}). \item \censusuri: a \ac{URI} pointing to an external reference (URL, GraphQL endpoint, CDN path, IPFS/IPNS, etc.) from which sequencers can download or query the census data. - \item \censusroot: the on-chain commitment used for membership verification. Its interpretation depends on the \censusorigin. In the \ac{CSP} model, this parameter corresponds to the \textbf{hash of the \ac{CSP}’s public key}, and in the case of Merkle trees, it corresponds to a Merkle root (off-chain static/dynamic) or a census contract address (on-chain dynamic). + \item \censusroot: the on-chain commitment used for membership verification. Its interpretation depends on the \censusorigin. In the \ac{CSP} model, this parameter corresponds to the hash of the \ac{CSP}’s public key, and in the case of Merkle trees, it corresponds to a Merkle root (off-chain static/dynamic) or a census contract address (on-chain dynamic). \end{itemize} % Organizers are free to construct the census from various data sources, such as private membership registries, self-sovereign identity credentials, or Ethereum-based tokens (e.g. ERC-20 or NFTs) whose balances define eligibility.

@@ -22,14 +23,6 @@ This flexibility supports a broad range of use cases and governance scenarios.

% The supported census models are summarized in Table~\ref{tab:census-models} and described in detail below. -\paragraph{Credential service provider.} Voter eligibility is certified by a digital signature issued by a \ac{CSP}. A voter obtains a signed credential from the \ac{CSP}, and sequencers verify the signature inside the \ac{ZK} circuits. In this case, \censusroot stores the \ac{CSP}’s public key, and \censusuri specifies the endpoint where voters obtain their credential. This model is suitable when eligibility is managed externally through attested identities rather than by maintaining a Merkle-tree dataset. - -\paragraph{Off-chain static census.} The organizer constructs a fixed census prior to the election. The Merkle tree is built locally, its root is stored in \censusroot, and \censusuri specifies the endpoint from which sequencers can retrieve the full tree. Since the census is static, no updates occur during the voting period. - -\paragraph{Off-chain dynamic census.} The Merkle tree remains off-chain, but the organizer may append new voters during the voting period (never deleting voters or modifying weights, as this would enable double voting). Each new insertion produces a new Merkle root, which the organizer must publish to the \hlget{\electionregistry} contract by updating the \censusroot parameter. As in the static model, \censusuri provides the endpoint from which sequencers download the current version of the tree. Sequencers verify membership proofs against the most recently published root. - -\paragraph{On-chain dynamic census.} In this configuration, the census is managed by a dedicated on-chain contract (\hlget{\censusmanagement}) that supports adding new members during the voting period. The address of this contract is stored in \censusroot, while \censusuri points to an external representation of the tree. The \hlget{\censusmanagement} contract maintains a history of valid Merkle roots. Sequencers may therefore generate membership proofs using older roots, and during state transitions the \hlget{\electionregistry} contract queries the \hlget{\censusmanagement} contract to verify that the root used in the proof is still valid. As in all dynamic models, only additions to the census are permitted during the voting period. - \begin{table}[H] \centering \renewcommand{\arraystretch}{1.25}

@@ -43,7 +36,7 @@ Membership proof \\

\hline \multicolumn{2}{|P{3.5cm}|}{Credential service provider (\ac{CSP})} - & \textbf{Hash of the {\ac{CSP}'s public key}} + & Hash of the {\ac{CSP}'s public key} & Endpoint to obtain an eligibility credential & \multirow{2}{*}{Digital signature verification}\\ \hline

@@ -54,18 +47,18 @@ & \multirow{2}{*}{Fixed Merkle root}

& Endpoint to obtain the census tree & Merkle proof verified against the fixed Merkle root \\ \cline{2-5} - + & \centering Dynamic (add-only) & \multirow{2}{*}{Latest Merkle root} & Endpoint to obtain the latest version of the tree & Merkle proof verified against the latest Merkle root\\ \hline - + \multirow{2}{*}{On-chain} & \centering Dynamic (add-only) & \censusmanagement contract address & Endpoint to obtain the latest version of the tree - & Merkle proof verified against most recent roots \\ + & Merkle proof verified against most recent Merkle roots \\ \hline \end{tabular}

@@ -73,6 +66,14 @@ \vspace{0.5cm}

\caption{Summary of census configurations supported by the \davinci protocol.} \label{tab:census-models} \end{table} + +\paragraph{Credential service provider.} Voter eligibility is certified by a digital signature issued by a \ac{CSP}. A voter obtains a signed credential from the \ac{CSP}, and sequencers verify the signature inside the \ac{ZK} circuits. The credential is issued over the tuple $(\processid,\idx,\address,\weight)$ where $\idx$ is a unique index assigned by the CSP to each voter. This index plays the same role as in the Merkle-tree census models: it is used by the state transition circuit to derive the voter's reserved storage slot in the state tree (see Section~\ref{sec:vocdoni-protocol:state-tree}). In this case, \censusroot stores the hash of the \ac{CSP}’s public key, and \censusuri specifies the endpoint where voters obtain their credential. This model is suitable when eligibility is managed externally through attested identities rather than by maintaining a Merkle-tree dataset. + +\paragraph{Off-chain static census.} The organizer constructs a fixed census prior to the election. The Merkle tree is built locally and the resulting root is stored in \censusroot, and \censusuri specifies the endpoint from which sequencers can retrieve the full tree. Since the census is static, no updates occur during the voting period. + +\paragraph{Off-chain dynamic census.} The Merkle tree remains off-chain, but the organizer may append new voters during the voting period (never deleting voters or modifying weights, as this would enable double voting). Each new insertion produces a new Merkle root, which the organizer must publish to the \hlget{\electionregistry} contract by updating the \censusroot parameter. As in the static model, \censusuri provides the endpoint from which sequencers can download the current version of the tree. Sequencers verify membership proofs against the most recently published root. + +\paragraph{On-chain dynamic census.} In this configuration, the census is managed by a dedicated on-chain contract (\hlget{\censusmanagement}) that supports adding new members during the voting period. The address of this contract is stored in \censusroot, while \censusuri points to an external representation of the tree. The \hlget{\censusmanagement} contract maintains a history of valid Merkle roots. Sequencers may therefore generate membership proofs using older roots, and during state transitions the \hlget{\electionregistry} contract queries the \hlget{\censusmanagement} contract to verify that the root used in the proof is still valid. As in all dynamic models, only additions to the census are permitted during the voting period. %CENSUS ORIGIN %MerkleTreeOffchainStaticV1
M v2/sections/circuits.tex → v2/sections/circuits.tex

@@ -1,6 +1,6 @@

% !TeX root = ../build/main.tex -At the core of \davinci lie a set of arithmetic circuits that enforce the correctness of every step of the election. Each circuit corresponds to a distinct task and, taken together, they guarantee that all protocol rules are satisfied without revealing any private information. Specifically, the \emph{ballot circuit} (Section~\ref{sec:vocdoni-protocol:circuits:ballot}) ensures that encrypted votes are valid and well-formed, the \emph{verifier circuit} (Section~\ref{sec:vocdoni-protocol:circuits:verifier}) verifies the voter's proof; the \emph{aggregation circuit} (Section~\ref{sec:vocdoni-protocol:circuits:aggregation}) combines multiple authenticated votes into a single proof; the \emph{state transition circuit} (Section~\ref{sec:vocdoni-protocol:circuits:state-transition}) updates the global state root and produces the \ac{ZK-SNARK} proof that is verified on-chain; and the \textit{results circuit} (Section~\ref{sec:vocdoni-protocol:circuits:results}) proves that the election results were computed correctly. The flow of these circuits and their interactions is shown in Figure~\ref{fig:circuits-flow}. +At the core of \davinci lie a set of arithmetic circuits that enforce the correctness of every step of the election. Each circuit corresponds to a distinct task and, taken together, they guarantee that all protocol rules are satisfied without revealing any private information. Specifically, the \emph{ballot circuit} (Section~\ref{sec:vocdoni-protocol:circuits:ballot}) ensures that encrypted votes are valid and well-formed, the \emph{verifier circuit} (Section~\ref{sec:vocdoni-protocol:circuits:verifier}) verifies the voter's proof; the \emph{aggregation circuit} (Section~\ref{sec:vocdoni-protocol:circuits:aggregation}) combines multiple authenticated votes into a single proof; the \emph{state transition circuit} (Section~\ref{sec:vocdoni-protocol:circuits:state-transition}) updates the global state root and produces the \ac{ZK-SNARK} proof that is verified on-chain; and the \textit{results circuit} (Section~\ref{sec:vocdoni-protocol:circuits:results}) proves that the election results were computed correctly. The flow of these circuits and their interactions is shown in Fig.~\ref{fig:circuits-flow}. \begin{figure}[h] \centerline{\includegraphics[width=\linewidth,draft=false]{\figs/circuits-flow.pdf}} \caption{

@@ -8,14 +8,16 @@ Overview of the circuit flow in \davinci. {\color{blue}\textit{Results circuit} is missing.}}

\label{fig:circuits-flow} \end{figure} -For clarity, the circuits are described in this section with their full set of public inputs explicitly listed. In the actual implementation, however, we apply an optimization: rather than exposing all public inputs $\publicinputs$ individually, we compute a single commitment $h = \hlget{\Mimc}(\publicinputs)$ and use $h$ as the only public input. The proof verifier then checks that $\hlget{\Mimc}(\publicinputs) = h$, ensuring that the original public inputs are consistent while reducing both proof size and verification cost. Note that this optimization does not alter the semantics of the circuits but significantly reduces verifier complexity and on-chain verification costs. Other implementation aspects such as the exact number of constraints and the proving frameworks used are deferred to Section~\ref{sec:analysis:implementation}. +\begin{remark} +For clarity, the circuits are described in this section with their full set of public inputs explicitly listed. In the actual implementation, however, we apply an optimization: rather than exposing all public inputs $\publicinputs$ individually, we compute a single commitment $h = \hlget{\Poseidon}(\publicinputs)$ and use $h$ as the only public input. The proof verifier then checks that $\hlget{\Poseidon}(\publicinputs) = h$, ensuring that the original public inputs are consistent while reducing both proof size and verification cost. Note that this optimization does not alter the semantics of the circuits but significantly reduces verifier complexity and on-chain verification costs. Other implementation aspects such as the exact number of constraints and the proving frameworks used are deferred to Section~\ref{sec:analysis:implementation}. +\end{remark} % Old text: By structuring the process this way, we ensure that voting can be performed from any device-including smartphones and web browsers-while keeping the sequencer's computational requirements within the capabilities of accessible, CPU-based machines with 64 GiB of memory. \subsubsection{Ballot circuit} \label{sec:vocdoni-protocol:circuits:ballot} -The ballot circuit (\hlset{\ballotcircuit}), illustrated in Figure~\ref{fig:circuit-ballot}, is generated locally by the voter at the time of casting a ballot. Its purpose is twofold: first, to prove that the encrypted ballot is valid and complies with the protocol rules defined by the organizer; and second, to prove that the vote identifier (\voteid) has been correctly derived. The correctness of this circuit is attested by a \ac{ZK} proof generated using the \ac{ZK-SNARK} protocol described in Section~\ref{sec:cryptographic-primitives:zkp}, instantiated over the BN254 curve. We call the resulting proof \textit{ballot proof} and denote it as $\hlset{\ballotproof}$. We detail below the inputs and constraints of the ballot circuit. +The ballot circuit (\hlset{\ballotcircuit}), illustrated in Fig.~\ref{fig:circuit-ballot}, is generated locally by the voter at the time of casting a ballot. Its purpose is twofold: first, to prove that the encrypted ballot is valid and complies with the protocol rules defined by the organizer; and second, to prove that the vote identifier (\voteid) has been correctly derived. The correctness of this circuit is attested by a \ac{ZK} proof generated using the \ac{ZK-SNARK} protocol described in Appendix~\ref{sec:cryptographic-primitives:zkp}, instantiated over the BN254 curve. We call the resulting proof \textit{ballot proof} and denote it as $\hlset{\ballotproof}$. We detail below the inputs and constraints of the ballot circuit. \begin{spacing}{1.25} \vspace{0.3cm}

@@ -54,7 +56,7 @@

\subsubsection{Verifier circuit} \label{sec:vocdoni-protocol:circuits:verifier} -The verifier circuit (\hlset{\verifiercircuit}), illustrated in Figure~\ref{fig:circuit-verifier}, is generated by the sequencer when processing a vote. This circuit verifies the ballot's proof generated by the voter and the correctness of their digital signature. The correctness of this circuit is attested by a ZK proof generated using the ZK-SNARK protocol described in Section~\ref{sec:cryptographic-primitives:zkp}, instantiated over the BLS12-377 curve. We call the resulting proof the \textit{authentication proof} and denote it as $\hlset{\authenticationproof}$. We detail below the inputs and constraints of this circuit. {\color{blue}-- Authentication of verification proof?} +The verifier circuit (\hlset{\verifiercircuit}), illustrated in Fig.~\ref{fig:circuit-verifier}, is generated by the sequencer when processing a vote. This circuit verifies the ballot's proof generated by the voter and the correctness of their digital signature. The correctness of this circuit is attested by a ZK proof generated using the ZK-SNARK protocol described in Section~\ref{sec:cryptographic-primitives:zkp}, instantiated over the BLS12-377 curve. We call the resulting proof the \textit{authentication proof} and denote it as $\hlset{\authenticationproof}$. We detail below the inputs and constraints of this circuit. {\color{blue}-- Authentication of verification proof?} \begin{spacing}{1.25} \vspace{0.3cm}

@@ -109,7 +111,7 @@

\subsubsection{Aggregation circuit} \label{sec:vocdoni-protocol:circuits:aggregation} -The aggregation circuit (\hlset{\aggregationcircuit}), illustrated in Figure~\ref{fig:circuit-aggregate}, is generated by the sequencer to combine multiple authenticated votes into a single proof. Its purpose is to reduce verification overhead by recursively aggregating individual authentication proofs, while ensuring that all aggregated votes belong to the same election. The batch size ($\batchsize$), i.e., the maximum number of proofs aggregated in a single execution, is a fixed parameter (currently set to 60). If fewer proofs are available, the sequencer pads the batch with dummy proofs so that the circuit always operates on a fixed-size input. The correctness of this circuit is attested by a ZK proof generated using the \ac{ZK-SNARK} protocol described in Section~\ref{sec:cryptographic-primitives:zkp}, instantiated over the BW6-761 curve. We call the resulting proof the \textit{aggregation proof} and denote it as $\hlset{\aggregationproof}$. We detail below the inputs and constraints of the aggregation circuit. +The aggregation circuit (\hlset{\aggregationcircuit}), illustrated in Fig.~\ref{fig:circuit-aggregate}, is generated by the sequencer to combine multiple authenticated votes into a single proof. Its purpose is to reduce verification overhead by recursively aggregating individual authentication proofs, while ensuring that all aggregated votes belong to the same election. The batch size ($\batchsize$), i.e., the maximum number of proofs aggregated in a single execution, is a fixed parameter (currently set to 60). If fewer proofs are available, the sequencer pads the batch with dummy proofs so that the circuit always operates on a fixed-size input. The correctness of this circuit is attested by a ZK proof generated using the \ac{ZK-SNARK} protocol described in Appendix~\ref{sec:cryptographic-primitives:zkp}, instantiated over the BW6-761 curve. We call the resulting proof the \textit{aggregation proof} and denote it as $\hlset{\aggregationproof}$. We detail below the inputs and constraints of the aggregation circuit. \begin{spacing}{1.25} \vspace{0.3cm}

@@ -153,7 +155,7 @@ \vspace{-0.5cm}

\subsubsection{State transition circuit} \label{sec:vocdoni-protocol:circuits:state-transition} -The state transition circuit (\hlset{\statetransitioncircuit}), illustrated in Figure~\ref{fig:circuit-state-transition-v2}, is generated by the sequencer to update the global state of the election. Its purpose is to verify that a batch of aggregated votes has been correctly incorporated into the state Merkle tree, that overwrites and vote identifiers are handled consistently, that the accumulators of encrypted results are updated accordingly, that each included vote corresponds to an eligible voter included in the census, and that the state transition data used by the sequencer matches the data made available through Ethereum data blobs. The correctness of this circuit is attested by a \ac{ZK} proof generated using the \ac{ZK-SNARK} protocol described in Section~\ref{sec:cryptographic-primitives:zkp}, instantiated over the BN254 curve, which is supported by Ethereum’s native precompiles for proof verification. We call the resulting proof the \textit{state proof} and denote it as $\hlset{\stateproof}$. This proof is submitted on-chain and verified by the process management smart contract, ensuring that every accepted state transition complies with the protocol rules. +The state transition circuit (\hlset{\statetransitioncircuit}), illustrated in Fig.~\ref{fig:circuit-state-transition-v2}, is generated by the sequencer to update the global state of the election. Its purpose is to verify that a batch of aggregated votes has been correctly incorporated into the state Merkle tree, that overwrites and vote identifiers are handled consistently, that the accumulators of encrypted results are updated accordingly, that each included vote corresponds to an eligible voter included in the census, and that the state transition data used by the sequencer matches the data made available through Ethereum data blobs. The correctness of this circuit is attested by a \ac{ZK} proof generated using the \ac{ZK-SNARK} protocol described in Appendix~\ref{sec:cryptographic-primitives:zkp}, instantiated over the BN254 curve, which is supported by Ethereum’s native precompiles for proof verification. We call the resulting proof the \textit{state proof} and denote it as $\hlset{\stateproof}$. It is submitted on-chain and verified by the process management smart contract, ensuring that every accepted state transition complies with the protocol rules. To formalize the setting, let the sequencer collect a batch of $N$ votes ($N\leq60$), of which $n$ are new vote submissions and $m = N-n$ are overwrites of previously cast ballots. Without loss of generality, we assume that the batch is ordered such that the first $n$ votes correspond to new submissions, and the remaining $m$ votes correspond to overwrites. In the following, we describe the inputs and constraints of the state transition circuit in detail.

@@ -226,19 +228,18 @@ \[

\hlget{\censusTree}.\hlget{\MTVerify}\big((\address_i, \weight_i), \censuspf_i, \censusroot\big) = \true. \] \end{itemize} - - %%%%% + % \item \emph{Transition verification.} Verify that the initial state and the state transition updates are applied correctly. \begin{itemize} \renewcommand{\labelitemii}{$\circ$} - \item Verify that the inputs $\processid$, $\censusorigin$, $\ballotmode$, $\epk$, $\addaccumulator^\old$, and $\substractaccumulator^\old$ correspond to the content of the first state tree leaves. + \item Verify that the inputs $\processid$, $\ballotmode$, $\epk$, $\addaccumulator^\old$, $\substractaccumulator^\old$, and $\censusorigin$ correspond to the content of the first state tree leaves. \begin{align*} &\hlget{\stateTree}.\hlget{\MTVerify}(\processid, \texttt{0x0}, \merkleInclusionPf^{\processid}, \stateroot^\old). \\ - &\hlget{\stateTree}.\hlget{\MTVerify}(\censusorigin, \texttt{0x1}, \merkleInclusionPf^{\censusorigin}, \stateroot^\old). \\ &\hlget{\stateTree}.\hlget{\MTVerify}(\ballotmode, \texttt{0x2}, \merkleInclusionPf^{\ballotmode}, \stateroot^\old). \\ &\hlget{\stateTree}.\hlget{\MTVerify}(\epk, \texttt{0x3}, \merkleInclusionPf^{\epk}, \stateroot^\old). \\ &\hlget{\stateTree}.\hlget{\MTVerify}(\addaccumulator^\old, \texttt{0x4}, \merkleInclusionPf^{\addaccumulator}, \stateroot^\old). \\ - &\hlget{\stateTree}.\hlget{\MTVerify}(\substractaccumulator^\old, \texttt{0x5}, \merkleInclusionPf^{\substractaccumulator}, \stateroot^\old). + &\hlget{\stateTree}.\hlget{\MTVerify}(\substractaccumulator^\old, \texttt{0x5}, \merkleInclusionPf^{\substractaccumulator}, \stateroot^\old). \\ + &\hlget{\stateTree}.\hlget{\MTVerify}(\censusorigin, \texttt{0x6}, \merkleInclusionPf^{\censusorigin}, \stateroot^\old). \end{align*} \item Verify that none of the $\voteid_i$ for all $i\in\{1,\dots,N\}$ are initially part of the tree: \[\hlget{\stateTree}.\hlget{\MTVerify}(\voteid_i, \merkleNInclusionPf^{\voteid}_i, \stateroot^\old).\]
M v2/sections/cryptographic-primitives.tex → v2/sections/cryptographic-primitives.tex

@@ -166,7 +166,7 @@ \paragraph{Keccak256.} Keccak256 is the standard hash function used by Ethereum and is employed in \davinci to compress messages for signing and deriving Ethereum addresses from public keys over $\SEC{\G}$. Keccak256 takes arbitrary-length bitstrings and outputs 256-bit digests: $\hlset{\Keccak} : \{0,1\}^* \rightarrow \{0,1\}^{256}$. This function is not SNARK-friendly and it is used exclusively in the authentication circuit, where the verification of Ethereum-compatible signatures requires reproducing the original message hash computed by Ethereum clients (see Section~\ref{sec:vocdoni-protocol:circuits:verifier}).

\paragraph{Poseidon.} Poseidon is a SNARK-optimized hash function designed for efficient implementation inside arithmetic circuits. It is used in \davinci for computing commitments, nullifiers, and the state Merkle tree roots. Poseidon is used as $\hlset{\Poseidon} : \mathfrak{F}_s \rightarrow \F_s$, where $\mathfrak{F}_s$ is the set of tuples of $\F_s$-elements of any length, and $\F_s$ is the field described in Section~\ref{sec:cryptographic-primitives:elliptic-curves}. -{\color{blue} \paragraph{MiMC-7.} Finally, we use functions from the MiMC family. On the one side, MiMC-7 hash function $\hlset{\Mimc} : \F_p \rightarrow \F_p$, where $\F_p$ is the set of tuples of $\F_p$-elements of any length, and $\F_p$ is the field described in Section~\ref{sec:cryptographic-primitives:elliptic-curves}. This hash is used to hash the public inputs of the different circuits and verify the associated proofs more efficiently (see Section~\ref{sec:vocdoni-protocol:circuits} for further details). On the other side, $\hlset{\Multimimc}$. Different curves.} +%{\color{blue} \paragraph{MiMC-7.} Finally, we use functions from the MiMC family. On the one side, MiMC-7 hash function $\hlset{\Mimc} : \F_p \rightarrow \F_p$, where $\F_p$ is the set of tuples of $\F_p$-elements of any length, and $\F_p$ is the field described in Section~\ref{sec:cryptographic-primitives:elliptic-curves}. This hash is used to hash the public inputs of the different circuits and verify the associated proofs more efficiently (see Section~\ref{sec:vocdoni-protocol:circuits} for further details). On the other side, $\hlset{\Multimimc}$. Different curves.} %MiMC-7~\cite{mimc} is another hash function optimized for zero-knowledge circuits, with extremely low multiplicative complexity. It is used in \davinci for hashing public inputs inside zkSNARKs, especially when generating a unique identifier for a vote (see Section~\ref{sec:vocdoni-protocol:circuits}). %We use the cubic S-box S(x)=x7S(x)=x7, and instantiate MiMC-7 over the same field FpFp​ as the SNARK circuit:

@@ -174,7 +174,7 @@ %MiMC7:Fpt→Fp

%MiMC7:Fpt​→Fp​ %This function is denoted Hash3Hash3 in our implementation. -{\color{blue} For the sake of clarity, in our notation we admit anything as an input of the above hash functions, although it might not be parsed as a sequence of field elements. Any bitstring can be converted to a tuple of field elements, so this does not change the actual working of the hash computation. In this document, it is implied that the proper conversion happens before feeding the input into the actual hash function.} +%{\color{blue} For the sake of clarity, in our notation we admit anything as an input of the above hash functions, although it might not be parsed as a sequence of field elements. Any bitstring can be converted to a tuple of field elements, so this does not change the actual working of the hash computation. In this document, it is implied that the proper conversion happens before feeding the input into the actual hash function.} %\subsection{Commitment schemes} %\label{sec:cryptographic-primitives:commitments}

@@ -204,13 +204,13 @@ \end{itemize}

These functions are used by sequencers to construct proofs that certify the validity of state transitions. In particular, they allow for off-chain state evolution that is independently verifiable on-chain and within ZK circuits. Additional details on the structure of the census and state trees, as well as the encoding of their leaves, are provided in Sections~\ref{sec:vocdoni-protocol:census} and~\ref{sec:vocdoni-protocol:state-tree}. -\subsection{Commitment schemes} +\subsection{Commitment scheme} \label{sec:cryptographic-primitives:commitments} {\color{blue} Description of KZG~\cite{kate2010constant} with SRS \textbf{[add link to Ethereum's BLS12-381 SRS]}, $\hlset{\CCommit}()$, and $\hlset{\CVerify}()$.}\\ Original methods: \hlset{\CSetup}, \hlset{\COpen}, \hlset{\CVerifyPoly}, \hlset{\CCreateWitness}, \hlset{\CVerifyEval}, \hlset{\CProve}, \hlset{\CVerify}. -\subsection{Digital signature schemes} +\subsection{Digital signature scheme} \label{sec:cryptographic-primitives:signatures} {\color{blue}{\textbf{TODO}: add \hlset{\SPubKey} that extracts $\pk$ from $\signature$ (in Ethereum it's called \texttt{ECRecover}).}}\\

@@ -261,7 +261,7 @@ \end{itemize}

\end{minipage} \end{mdframed} -\subsection{Encryption schemes} +\subsection{Encryption scheme} \label{sec:cryptographic-primitives:encryption} To preserve ballot secrecy while enabling tallying, \davinci employs a threshold variant of the ElGamal cryptosystem instantiated over the BabyJubjub curve~\cite{sutikno1998implementation}. This scheme offers two properties crucial for the protocol: \emph{additive homomorphism}, which allows the aggregation of encrypted votes without decryption, and \emph{re-encryption}, which enables ciphertext randomization without altering the underlying plaintext. Together, these properties allow sequencers to tally votes while preventing voters from producing receipts that could be used for coercion or vote selling. The corresponding public key is generated collectively by the sequencers via the distributed key generation protocol described in Section~\ref{sec:cryptographic-primitives:dkg}, ensuring that no single entity can decrypt ballots unilaterally.

@@ -325,7 +325,7 @@ \end{mdframed}

In the protocol, re-encryption is applied not only to newly submitted ballots but also to ballots already stored in the state tree. By refreshing the randomness of both new and existing ciphertexts, sequencers ensure that it is indistinguishable whether a ballot has been overwritten or merely re-randomized. This mechanism is essential for guaranteeing receipt-freeness: voters cannot produce a verifiable receipt of their choice, and adversaries cannot detect or prove whether a particular vote has been replaced (see Section~\ref{sec:analysis}). -\subsection{Key generation schemes} +\subsection{Distributed key generation scheme} \label{sec:cryptographic-primitives:dkg} To ensure that no single entity controls the decryption key, DAVINCI employs a \ac{DKG} protocol to jointly derive the ElGamal encryption key pair used for ballots encryption~\cite{todocitation}. Participants who contribute to the \ac{DKG} ceremony are called \emph{\keywardens}, and they are each identified by a unique index~$i$. The outcome is a collective public key (\epk) that is published on-chain and used by voters to encrypt their ballots, while the corresponding private key is secret-shared among the \keywardens. Only a threshold number $t$ out of $n$ \keywardens can later collaborate to decrypt the tally. Unlike classical \ac{DKG} protocols where shares are exchanged in the clear, our construction uses encrypted shares and \ac{ZK-SNARK} proofs of correctness. This allows the Ethereum smart contract to verify compliance without learning any of the underlying secrets, ensuring both security and verifiability in a fully decentralized setting.

@@ -398,4 +398,4 @@ \label{sec:cryptographic-primitives:zkp}

{Zero-knowledge succinct non-interactive arguments of knowledge (ZK-SNARKs)} are a crucial component in ensuring the integrity of the election. Voters generate ZK-SNARK proofs to demonstrate that their encrypted ballots comply with the rules and constraints defined by the election parameters, without revealing any information about their choices. Similarly, sequencers produce proofs to certify the correctness of vote aggregation and state transitions throughout the protocol. {\color{blue}\hlset{\PProve}(), \hlset{\PVerify}(proof, PI) -- pkey, vkey.} -All ZK circuits in \davinci are compiled using the Groth16 proof system~\cite{groth2016size}, a widely adopted ZK-SNARK construction known for its succinctness, efficient verification, and minimal proof size. Although all circuits rely on the same proving system, they are instantiated with different elliptic curves depending on the cryptographic requirements of each phase. Specifically, the vote validity circuit is compiled over the BN254 curve, the census-related circuit uses BLS12-377, and the aggregation circuit is instantiated over BW6-761. Finally, the last circuit used by the sequencer—responsible for generating the final proof of correct tallying and result—is compiled over BN254 as well, since this is the proof that is verified on-chain by the smart contract using Ethereum’s native precompiles. Further details on the circuits are provided in Section~\ref{sec:vocdoni-protocol:circuits} and a summary of the instantiations can be found in Figure~\ref{fig:circuits-flow}. +All ZK circuits in \davinci are compiled using the Groth16 proof system~\cite{groth2016size}, a widely adopted ZK-SNARK construction known for its succinctness, efficient verification, and minimal proof size. Although all circuits rely on the same proving system, they are instantiated with different elliptic curves depending on the cryptographic requirements of each phase. Specifically, the vote validity circuit is compiled over the BN254 curve, the census-related circuit uses BLS12-377, and the aggregation circuit is instantiated over BW6-761. Finally, the last circuit used by the sequencer—responsible for generating the final proof of correct tallying and result—is compiled over BN254 as well, since this is the proof that is verified on-chain by the smart contract using Ethereum’s native precompiles. Further details on the circuits are provided in Section~\ref{sec:vocdoni-protocol:circuits} and a summary of the instantiations can be found in Fig.~\ref{fig:circuits-flow}.
M v2/sections/parties.tex → v2/sections/parties.tex

@@ -4,7 +4,7 @@ An election involves four types of participants: organizer, \keywardens, voters, and sequencers.

\paragraph{Organizer.} The organizer is the entity responsible for defining and setting up the election. Its key responsibilities include defining the voting parameters and gathering the census data. The organizer ensures that the election is structured correctly but does not participate in vote collection or tallying. -\paragraph{\Keywardens.} \Keywardens are a set of decentralized parties that collaboratively generate a public encryption key that voters use to encrypt their votes. The corresponding secret key is secret-shared among them so that only a threshold of key wardens can later collaborate to decrypt the final tally. %Individual ballots remain private because the protocol only invokes threshold decryption on the final aggregate, not on each ballot separately. +\paragraph{\Keywardens.} \Keywardens are a set of decentralized parties that collaboratively generate a public encryption key that voters use to encrypt their votes. The corresponding secret key is secret-shared among them so that a threshold of key wardens can later collaborate to decrypt the final tally. %Individual ballots remain private because the protocol only invokes threshold decryption on the final aggregate, not on each ballot separately. \paragraph{Voters.} Voters are the participants that belong the census and are allowed to cast their votes in the election. \\
M v2/sections/protocol-flow.tex → v2/sections/protocol-flow.tex

@@ -1,36 +1,66 @@

% !TeX root = ../build/main.tex -In this section we describe the overall flow of the \davinci voting protocol. An election is structured into five main phases: election setup, encryption key generation, voting period, decryption key generation, and tally finalization. Each phase specifies the interactions between the organizer, \keywardens, voters, sequencers, and the smart contracts that coordinate the election. An overview of the complete process is shown in Figure~\ref{fig:protocol-flow}. +In this section we describe the overall flow of the \davinci voting protocol. An election is structured into five main phases: election setup, encryption key generation, voting period, tally decryption, and election finalization. Each phase specifies the interactions between the organizer, \keywardens, voters, sequencers, and the smart contracts that coordinate the election. An overview of the complete process is shown in Fig.~\ref{fig:protocol-flow}. \subsubsection{Election setup} -\label{sec:vocdoni-protocol:setup} +\label{sec:election-setup} -In this phase, sequencers register and the organizer sets the election up.\\ +Before any election can begin, sequencers must register by staking \token tokens in the +{\color{blue}sequencer-registry} smart contract (see Section~\ref{sec:token}). This registration +is a one-time operation per sequencer and is independent of any particular election; only +registered sequencers are eligible to participate in the \ac{DKG} phase and to process votes. +% +For each new election, the organizer performs the following steps: -\rogeri{I'd put this outside of the "voting process". I think adding a section "System setup and operation"-like before this one and rename this one as "voting process flow" (or simply "voting process") could ease the explanation.} - -%\noi \sequencers -%Sequencers must first register in the sequencer registry smart contract, a process that remains open continuously. Registration involves publishing their identity, network endpoint (e.g., URI), and a collateral deposit to ensure honest participation. The collateral can later be slashed in case of misbehavior. \\ - -\noi For each new election, the organizer performs the following steps: \begin{enumerate} - \item Prepare the census data \censusdata\ and generate the census Merkle tree $\censusTree$ with that data. + + \item Prepare the census data \censusdata\ and build the incremental Merkle tree + $\censusTree$ from it. Publish the full tree to IPFS, and record the resulting URI as $\censusuri$. + \item Compute the census commitment $\censusroot = \censusTree.\hlget{\MTRoot}()$. - \item Prepare the voting form (ballot / set of questions), upload it to IPFS, compute commitment. - \item Define the election details, including duration, options, and the ballot rules $\ballotmode$ (see Section~\ref{sec:ballot-protocol}). - \item Compute a unique process identifier $\processid$, which is a 32-byte number derived from the organizer’s Ethereum address, nonce, and the chain ID. - \item Set security parameters for the %forthcoming - \ac{DKG} ceremony (e.g. timeout, minimum number of sequencers). - \item Submit all this information in a transaction to the \hlget{\electionregistry} smart contract {\color{blue}(pay tx fees)}: - \[ tx_{org} = (\censusroot, ballotCommitment, \ballotmode, electionMetadata, \processid, dkgParameters).\] + + \item Define the election details, including duration, the census model $\censusorigin$ + (see Section~\ref{sec:vocdoni-protocol:census}), and the ballot rules $\ballotmode$ + (see Section~\ref{sec:ballot-protocol}). + + \item Upload the election metadata (questions, options, description, etc.)\ to IPFS to obtain {\color{blue}electionMetadata}. + + \item Compute a unique process identifier $\processid$, which is a 32-byte number derived + from the organizer's Ethereum address, nonce, and the chain ID. + + \item Initialize the state Merkle tree $\stateTree$ by inserting the election configuration + parameters into the reserved configuration namespace (see Section~\ref{sec:vocdoni-protocol:state-tree}): + $\processid$ at leaf $\mathtt{0x0}$, $\ballotmode$ at leaf $\mathtt{0x2}$, + $\censusorigin$ at leaf $\mathtt{0x6}$, and zero-valued accumulators $\addaccumulator$ and + $\substractaccumulator$ at leaves $\mathtt{0x4}$ and $\mathtt{0x5}$, respectively. {\color{blue}Compute the + initial state root -- is this done by the SC?} + \[ + \stateroot = \stateTree.\hlget{\MTRoot}(). + \] + + \item Set security parameters for the \ac{DKG} ceremony (e.g.\ timeout, minimum number + of sequencers) {\color{blue}DKG}. + + \item Submit all this information in a transaction to the \hlget{\electionregistry} smart + contract: + \begin{align*} + tx_{\mathit{org}} = \big( + &\processid,\ \censusroot,\ \censusorigin,\ \censusuri, \\ + &\ballotmode,\ {\color{blue}electionMetadata},\ \stateroot,\ {\color{blue}dkgParameters} + \big). + \end{align*} + \end{enumerate} +% +Once this transaction is accepted, the election is publicly registered on-chain and the +\ac{DKG} phase can begin. \subsubsection{Encryption key generation} \label{sec:vocdoni-protocol:keygen} In this phase, \keywardens collectively generate the public encryption key.\\ -\noi \Keywardens fetch the process parameters ($\processid$, $\ballotmode$, $\censusroot$) from the process management smart contract and participate in a \ac{DKG} protocol before the timeout set by the organizer expires. If the minimum number of contributions is reached, the public encryption key $\epk$ is derived and made available on-chain. This ensures that no single party controls the secret key, and that decryption later requires threshold participation {\color{blue}(give more details)}.\\ +\noi \Keywardens fetch the process parameters ($\processid$, $\ballotmode$, $\censusroot$) from the \hlget{\electionregistry} smart contract and participate in a \ac{DKG} protocol before the timeout set by the organizer expires. If the minimum number of contributions is reached, the public encryption key $\epk$ is derived and made available on-chain. This ensures that no single party controls the secret key, and that decryption later requires threshold participation {\color{blue}(give more details)}.\\ \noi {\color{blue} Alternatively, generate a SNARK proving the EPK has been generated correctly and the contract verifies it.}

@@ -49,16 +79,16 @@ \item Select their ballot choice $\ballot$ according to the rules of $\ballotmode$.

\item Sample fresh randomness $k \in \F$ and encrypt the ballot using $\epk$: \begin{equation} \label{eq-ciphertext} - \encryptedballot = \hlget{\Enc}_{\epk}(\ballot; k). + \encryptedballot ={ }\hlget{\Enc}_{\epk}(\ballot; k). \end{equation} \item Use their Ethereum address $\address$ and the previous $k$ to compute a unique vote identifier: \begin{equation} \label{eq-voteid} - \voteid = \hlget{\Multimimc}(\processid \conc \address \conc k). + \voteid ={ }\hlget{\Poseidon}(\processid \conc \address \conc k). \end{equation} \item Use the \ballotcircuit from Section~\ref{sec:vocdoni-protocol:circuits:ballot} to generate a ZK-SNARK proof to prove that Eqs.~\labelcref{eq-ciphertext,eq-voteid} are correctly computed and that $\ballot$ satisfies the ballot protocol rules according to $\ballotmode$: \begin{align*} - \voteproof = & \hlget{\PProve}( + \voteproof ={ } & \hlget{\PProve}( \hlget{\ballotcircuit}, \witness = (\ballot, k), \publicinputs = (\processid, \ballotmode,\\

@@ -85,7 +115,7 @@ \[\vote_i = [\processid, \voteid, \encryptedballot, \censusproof, \voteproof, \signature],\]

extract the voter's public key $\pk_i = \hlget{\SPubKey}(\signature)$. \item For each $\vote_i$ received, use \verifiercircuit from Section~\ref{sec:vocdoni-protocol:circuits:verifier} to generate a proof \begin{align*} - \authenticationproof_i = & \hlget{\PProve}(\hlget{\verifiercircuit}, + \authenticationproof_i ={ } & \hlget{\PProve}(\hlget{\verifiercircuit}, \witness = (\ballotproof, \weight, \censusproof, \signature),\\ & \publicinputs = (\processid, \ballotmode, \epk, \encryptedballot, \voteid, \\ & \censusroot, \pk)).

@@ -93,7 +123,7 @@ \end{align*}

This proof ensures that the voter’s \voteproof, the \signature, and the \censusproof are all valid. \item Batch a set of $n$ proofs $\{\authenticationproof_i\}_{i = 1}^n$ and batch verify them together using \aggregationcircuit from Section~\ref{sec:vocdoni-protocol:circuits:aggregation}: \begin{align*} - \aggregationproof = &\hlget{\PProve}(\hlget{\aggregationcircuit}, + \aggregationproof = { } &\hlget{\PProve}(\hlget{\aggregationcircuit}, \witness = (\{\authenticationproof_i\}_{i = 1}^n),\\ &\publicinputs = (\encryptedballot, \{\voteid_i\}_{i = 1}^n), \{\pk_i\}_{i = 1}^n,

@@ -122,7 +152,7 @@ \item Finally, prove that all transitions are correct .... with circuit from Section~\ref{sec:vocdoni-protocol:circuits:state-transition}.

consistency between data blobs and the on-chain state: \begin{align*} - \stateproof = \hlget{\PProve}(\hlget{\statetransitioncircuit}, + \stateproof ={ } \hlget{\PProve}(\hlget{\statetransitioncircuit}, \witness = (), \publicinputs = ()). \end{align*}

@@ -140,7 +170,7 @@ Sequencers repeat this process until the voting deadline set by the organizer.

Upon receiving a valid transaction, the \electionregistry smart contract does the following checks: -\subsubsection{Decryption key generation} +\subsubsection{Tally decryption} \label{sec:vocdoni-protocol:deckey-gen} {\color{blue} After the voting period expires, $t$ out of $n$ sequencers publish their decryption shares of the election private key. Once the threshold is reached, the election secret key can be reconstructed (on-chain or off-chain), enabling the decryption of the aggregated tally.

@@ -148,7 +178,7 @@

Rewards and penalties for sequencers are managed according to their correct participation: sequencers are rewarded proportionally to the number of votes sequenced, and may be slashed for failing to provide a valid decryption share (see Seciton~\ref{sec:token} for details on incentivation mechanisms.)} -\subsubsection{Tally finalization} +\subsubsection{Election finalization} \label{sec:vocdoni-protocol:results} In this final phase, the organizer/a sequencer computes the tally and publishes the result, together with a proof of its correct computation, on-chain.

@@ -158,7 +188,7 @@ \item Retrieve $\decryptionkey$ from \dots.

\item ... \item Use \resultscircuit from Section~\ref{sec:vocdoni-protocol:circuits:results} to generate a proof \begin{align*} - \resultsproof = \hlget{\PProve}(\hlget{\resultscircuit}, + \resultsproof = { } \hlget{\PProve}(\hlget{\resultscircuit}, \witness = (...), \publicinputs = (...)). \end{align*}
M v2/sections/protocol-intuition.tex → v2/sections/protocol-intuition.tex

@@ -1,6 +1,6 @@

% !TeX root = ../build/main.tex -The following section provides an overview of the DAVINCI protocol, describing its main phases and actors without delving into technical details. The election process is governed by smart contracts deployed on Ethereum, which ensure transparency, enforce rules, and verify proofs. As shown in Figure~\ref{fig:protocol-intuition}, the protocol consists of five main phases, from the setup of the election to the publication and verification of final results. +The following section provides an overview of the DAVINCI protocol, describing its main phases and actors without delving into technical details. An election is governed by smart contracts deployed on Ethereum, which ensure transparency, enforce rules, and verify proofs. As shown in Fig.~\ref{fig:protocol-intuition}, the protocol consists of five main phases, from the setup of the election to the publication and verification of the final results. %All the voting process is governed by the rules encoded in three smart contracts: the \textit{process management}, the \textit{sequencer registry}, and the \textit{results verification} smart contract. All these three contracts are deployed on the Ethereum blockchain, and ensure that the execution of all steps is transparent and unalterable. The protocol consists of five phases, as illustrated in Figure~\ref{fig:protocol-intuition} and described below. The first two occur during the preparation period, the subsequent two during the voting period, and the final one takes place in the tally period. \begin{figure}[h]

@@ -40,9 +40,18 @@ verify the signatures, to ensure the votes were cast by legitimate voters; they verify the proof of compliance, confirming that each vote adheres to the election voting rules, and the census membership proofs against the commitment to the census data that was originally registered in the process management smart contract. Once the sequencers have processed and verified all votes, they must prove that these verifications were performed correctly. Instead of submitting individual verifications for each vote, they generate a single \ac{ZK} proof that attests to the correctness of all verifications.

%they compress multiple individual verification into one. Additionally, the sequencers reencrypt the votes and generate a proof of the correct reencryption computation. While this process does not alter the final tally, it prevents voters from decrypting their original vote. This step mitigates vote selling or coercion, as voters are no longer able to prove their choice to third parties. Finally, sequencers submit the reencrypted votes along with their verification and reencryption proofs to the process management smart contract. The smart contract verifies all the proofs provided by the sequencers to check that they complied with the protocol.\\ \end{enumerate} - % - \item \textit{Decryption key generation}.\\ + + \item \textit{Tally decryption}. + At the end of the voting period, the smart contract ceases to accept new state updates. %,effectively finalizing the process. + Then, a threshold number of key wardens cooperate to reconstruct a partial decryption key that allows to decrypt the final tally. +% the key wardens cooperate to open the final encrypted tally. Each of them contributes a verifiable decryption share, and once enough such shares have been published, the election outcome can be recovered. This ensures that ballots stay encrypted during the election while still allowing the final result to be publicly obtained and audited once voting has closed. +% the key wardens collaborate to enable the decryption of the final tally. + That is, instead of reconstructing the election's private key, each key warden publishes a partial decryption together with a proof that the contribution is correct. + %As soon as a threshold number of valid partial decryptions has been made available, the encrypted tally can be opened and the plaintext results can be recovered. + This way, the individual votes remain encrypted throughout the voting period, and only the final aggregated result is decrypted at the end of the election. + \\ % - \item \textit{Tally finalization}. - At the end of the voting period, the smart contract ceases to accept new state updates, effectively finalizing the process. The organizer then computes the outcome of the election and submits both the results and a proof of correctness to the smart contract. The contract verifies the proof, ensuring that the tally has been derived faithfully from the final state. Once this verification succeeds, the results and the corresponding state root remain available on-chain, providing an immutable record of the election outcome that can be independently audited by anyone. + \item \textit{Election finalization}. + %At the end of the voting period, the smart contract ceases to accept new state updates, effectively finalizing the process. + The results and a proof of correctness are submitted to the results verification smart contract. The contract verifies the proof, ensuring that the tally has been derived faithfully from the final state. Once this verification succeeds, the results and the latest state root remain available on-chain, providing an immutable record of the election outcome that can be independently audited by anyone. \end{enumerate}
M v2/sections/state-tree.tex → v2/sections/state-tree.tex

@@ -2,7 +2,7 @@ % !TeX root = ../build/main.tex

% \noi Merkle trees are used to create a cryptographic representation of both the voter census registry and the election state. -The state Merkle tree, denoted by $\hlset{\stateTree}$, represents the evolving global state of an election in \davinci. It is implemented as a \ac{SMT} of fixed depth $D = 64$, as described in Section~\ref{sec:cryptographic-primitives:merkle-trees}. The state tree acts as a cryptographic accumulator that compactly commits to all relevant election data, including configuration parameters, vote identifiers, and encrypted ballots. +The state Merkle tree, denoted by $\hlset{\stateTree}$, represents the evolving global state of an election in \davinci. It is implemented as a \ac{SMT} of fixed depth $D = 64$, as described in Appendix~\ref{sec:cryptographic-primitives:merkle-trees}. The state tree acts as a cryptographic accumulator that compactly commits to all relevant election data, including configuration parameters, vote identifiers, and encrypted ballots. By organizing the election state in a single \ac{SMT}, \davinci supports efficient membership and update proofs that can be verified inside \ac{ZK} circuits, enabling succinct and verifiable state transitions. The root of the state tree, denoted $\stateroot$, is committed on-chain and serves as the authoritative reference to the current election state. Each state transition performed by a sequencer updates the tree and produces a new root. The correctness of this update, namely, that it follows the protocol rules and correctly incorporates new votes, is attested by a \ac{ZK-SNARK} proof, which is verified by the $\hlget{\statetransitionverifier}$ smart contract before the new root is accepted.

@@ -10,8 +10,8 @@

\paragraph{Namespaced key space.} -The state tree operates over keys in the range $[0, 2^D-1] \subset \mathbb{F}_p$ and uses a SNARK-friendly hash function (Poseidon, see Section~\ref{sec:cryptographic-primitives:hash}) to enable efficient in-circuit verification. To prevent collisions between different categories of data stored in the state, the 64-bit key space is partitioned into three disjoint numeric namespaces using a fixed thershold $N$. We define \( N = 2^{D-1}\), -which we use to split the address space into a lower region for configuration parameters and encrypted ballot storage, and an upper region strictly reserved for vote identifiers. This strict separation ensures that configuration entries, vote identifiers, and ballots never collide. The structure of the tree is depicted in Figure~\ref{fig:mt-state}. +The state tree operates over keys in the range $[0, 2^D-1] \subset \mathbb{F}_p$ and uses a SNARK-friendly hash function (\hlget{\Poseidon}, see Appendix~\ref{sec:cryptographic-primitives:hash}) to enable efficient in-circuit verification. To prevent collisions between different categories of data stored in the state, the 64-bit key space is partitioned into three disjoint numeric namespaces using a fixed thershold $N$. We define \( N = 2^{D-1}\), +which we use to split the address space into a lower region for configuration parameters and encrypted ballot storage, and an upper region strictly reserved for vote identifiers. This strict separation ensures that configuration entries, vote identifiers, and ballots never collide. The structure of the tree is depicted in Fig.~\ref{fig:mt-state}. %the 64-bit key space is partitioned into disjoint numeric namespaces by leveraging the most significant bit (MSB) of the address, effectively splitting the space exactly in half at the threshold N.

@@ -39,7 +39,7 @@ \paragraph{Encrypted ballot namespace.}

The region immediately following the configuration parameters, the interval $[\configmax + 1, N - 1]$, is reserved for storing encrypted ballots. %In contrast to vote identifiers, -Ballot storage locations are deterministic and derived from the voter's position in the census. Let $\idx$ denote the voter's census index, proven via a census membership proof. The storage path for the encrypted ballot is computed as +Ballot storage locations are deterministic and derived from the voter's position in the census. Let $\idx$ denote the voter's census index (see Section~\ref{sec:vocdoni-protocol:census}), proven via a census membership proof. The storage path for the encrypted ballot is computed as \[ \text{encPath} = \configmax + \idx \cdot 2^{16} + (\address \bmod 2^{16}). \]