readable version up to sec. 5.4.4
jump to
@@ -473,3 +473,23 @@ title = {Sparse {M}erkle Trees},
url = {https://docs.iden3.io/publications/pdfs/Merkle-Tree.pdf}, year = {2019} } + +@book{blake95elliptic, + author = {Blake, Ian F. and Seroussi, G. and Smart, N. P.}, + title = {Elliptic curves in cryptography}, + year = {1999}, + isbn = {0521653746}, + publisher = {Cambridge University Press}, + address = {USA} +} + +@INPROCEEDINGS{sutikno98implementation, + author={Sutikno, S. and Surya, A. and Effendi, R.}, + booktitle={IEEE. APCCAS 1998. 1998 IEEE Asia-Pacific Conference on Circuits and Systems. Microelectronics and Integrating Systems. Proceedings (Cat. No.98EX242)}, + title={An implementation of ElGamal elliptic curves cryptosystems}, + year={1998}, + volume={}, + number={}, + pages={483-486}, + keywords={Public key cryptography}, + doi={10.1109/APCCAS.1998.743829}}
@@ -22,16 +22,21 @@ \thispagestyle{plain}
%\addcontentsline{toc}{section}{\protect\numberline{}Abstract} \begin{abstract} - \Davinci is the evolution of the Vocdoni voting protocol, designed to empower civil society by providing essential tools for secure, verifiable, and anonymous digital voting. Leveraging recent advancements in zero-knowledge (ZK) proof systems and blockchain technology, \davinci transitions to a specialized ZK-rollup system that inherits network security from settlement layers like Ethereum mainnet. The system relies on cryptographic proofs to ensure integrity and security, eliminating the need for centralized authorities. By integrating ZK-SNARKs and threshold homomorphic encryption, \davinci enables end-to-end verifiability, privacy, and trustlessness in the voting process. The protocol employs a distributed key generation among sequencers, coordinated via Ethereum smart contracts, and uses Ethereum data blobs for data availability. With a focus on accessibility, scalability, receipt-freeness, and automation, \davinci aims to facilitate high-frequency, low-cost voting, fostering mass adoption of e-voting and simplifying civil participation. Finally, the introduction of the Vocdoni token aligns incentives among participants, ensuring the system's sustainability and enabling decentralized governance. + \Davinci is the evolution of the Vocdoni voting protocol, designed to empower civil society by providing essential tools for secure, verifiable, and anonymous digital voting. Leveraging recent advancements in zero-knowledge (ZK) proof systems and blockchain technology, \davinci transitions to a specialized ZK-rollup system that inherits network security from settlement layers like Ethereum mainnet. The system relies on cryptographic proofs to ensure integrity and security, eliminating the need for centralized authorities. By integrating ZK-SNARKs and threshold homomorphic encryption, \davinci enables end-to-end verifiability, privacy, and trustlessness in the voting process. The protocol employs a distributed key generation among sequencers, coordinated via Ethereum smart contracts, and uses Ethereum data blobs for data availability. With a focus on accessibility, scalability, receipt-freeness, and automation, \davinci aims to facilitate high-frequency and low-cost voting, fostering mass adoption of e-voting and simplifying civil participation. Moreover, the introduction of the Vocdoni token aligns incentives among participants, ensuring the system's sustainability and enabling decentralized governance. % - Moreover, 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 the proposed architecture is not merely theoretical but a viable solution ready for short-term deployment. + 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. % \freefootnote{\scriptsize{Authors are listed in alphabetical order (\url{https://www.ams.org/profession/leaders/CultureStatement04.pdf}).}} \end{abstract} -\martai{\\ - 1. Consider separating the roles of the sequencers from key generators.\\ - 2. Change $(C_1, C_2)$ to \texttt{ciphertext} (in protocol flow and figures).} +{\color{blue} + \begin{itemize} + \item Consider separating the roles of the sequencers from key generators. + \item Change $(C_1, C_2)$ to \texttt{ciphertext} (in protocol flow and figures). + \item Notation: are voteIDs called Nullifiers? + \end{itemize} +} \setcounter{tocdepth}{2} \makeatletter@@ -39,6 +44,7 @@ \renewcommand*\l@author[2]{}
\renewcommand*\l@title[2]{} \makeatletter +%\renewcommand{\contentsname}{Contents} \tableofcontents \newpage@@ -60,7 +66,6 @@ \section{Cryptographic primitives} %building blocks
\label{sec:cryptographic-primitives} \input{\secs/cryptographic-primitives} -\newpage \section{Voting protocol} \label{sec:vocdoni-protocol} \input{\secs/vocdoni-protocol}
@@ -27,6 +27,10 @@ \footnotetext{#1}%
\let\thefootnote\svthefootnote% } +% Footnote spaces +\setlength{\skip\footins}{20pt} % space between text and footnotes +\setlength{\footnotesep}{1em} % space between individual footnotes + % Table of contents style % Make section entries bold in ToC \makeatletter@@ -114,12 +118,12 @@ \newcommand{\sequencers}{\fcolorbox{darkgrayborder}{sequencerbg}{ \textsf{sequencers} }\xspace}
% Ballot protocol \newcommand{\ballotstyle}[1]{\texttt{#1}\xspace} -\newcommand{\maxcount}{\ballotstyle{maxCount}} +\newcommand{\numfields}{\ballotstyle{numFields}} \newcommand{\maxvalue}{\ballotstyle{maxValue}} \newcommand{\minvalue}{\ballotstyle{minValue}} \newcommand{\uniquevalues}{\ballotstyle{uniqueValues}} -\newcommand{\maxtotalcost}{\ballotstyle{maxTotalCost}} -\newcommand{\mintotalcost}{\ballotstyle{minTotalCost}} +\newcommand{\maxvaluesum}{\ballotstyle{maxValueSum}} +\newcommand{\minvaluesum}{\ballotstyle{minValueSum}} \newcommand{\costexponent}{\ballotstyle{costExponent}} % Voting protocol@@ -127,8 +131,10 @@ \newcommand{\variablestyle}[1]{\texttt{#1}\xspace}
\newcommand{\census}{\variablestyle{census}} \newcommand{\censusdata}{\variablestyle{censusData}} \newcommand{\voteproof}{\variablestyle{voteProof}} +\newcommand{\ballotproof}{\variablestyle{ballotProof}} \newcommand{\censusproof}{\variablestyle{censusProof}} \newcommand{\authenticationproof}{\variablestyle{authenticationProof}} +\newcommand{\aggregationproof}{\variablestyle{aggregationProof}} \newcommand{\voteid}{\variablestyle{voteID}} \newcommand{\ballot}{\variablestyle{ballot}} \newcommand{\vote}{\variablestyle{vote}}@@ -140,6 +146,7 @@ \newcommand{\encryptedballot}{\variablestyle{encryptedBallot}}
\newcommand{\zkproof}{\variablestyle{ZKproof}} \newcommand{\signature}{\variablestyle{signature}} \newcommand{\address}{\variablestyle{address}} +\newcommand{\stateproof}{\variablestyle{stateProof}} % State Merkle tree \newcommand{\censusroot}{\variablestyle{censusRoot}}@@ -175,8 +182,12 @@ \newcommand{\EncAdd}{\methodstyle{EncAdd}}
\newcommand{\ReEnc}{\methodstyle{ReEnc}} \newcommand{\SSign}{\methodstyle{S.Sign}} \newcommand{\SVer}{\methodstyle{S.Verify}} +\newcommand{\PProve}{\methodstyle{P.Prove}} +\newcommand{\PVerify}{\methodstyle{P.Verify}} \newcommand{\GenerateShares}{\methodstyle{GenerateShares}} \newcommand{\VerifyShare}{\methodstyle{VerifyShare}} +\newcommand{\GenerateEncryptedShares}{\methodstyle{GenerateEncryptedShares}} +\newcommand{\VerifyEncryptedShare}{\methodstyle{VerifyEncryptedShare}} \newcommand{\DerivePublicKey}{\methodstyle{DerivePublicKey}} \newcommand{\DeriveSecretShare}{\methodstyle{DeriveSecretShare}}
@@ -27,6 +27,7 @@ \usepackage{multirow}
\usepackage{ifdraft} %\usepackage{draftwatermark} + \usepackage{setspace} \usepackage{cleveref} %ref multiple equations
@@ -1,6 +1,6 @@
% !TeX root = ../build/main.tex -\subsection{Interplanetary file system (IPFS)} +\subsection{Interplanetary file system} \label{sec:background:ipfs} \begin{itemize}@@ -11,7 +11,7 @@ \subsection{Ethereum}
\label{sec:background:ethereum} \begin{itemize} - \item Ethereum blockchain (say transactions have a cost fee). + \item Ethereum blockchain (say transactions have a fee cost). \item Ethereum smart contracts. \textit{Ethereum smart contracts are employed to orchestrate the voting process, manage state transitions, and store critical data, such as the current state root and encryption public keys. These smart contracts provide a trustless environment, ensuring that all participants can be confident that the voting process rules are correctly enforced.}
@@ -0,0 +1,100 @@
+% !TeX root = ../build/main.tex + +\martai{It is not clear what is the advantage of defining a protocol like this. Is it easy because it is easy to implement as an arithmetic circuit? Make the advantage clear.} + +\martai{Yes. The advantage is that we can define many types of voting systems (or recounting) with just these few variables. Moreover, we avoid if-else statements, which makes it very convenient to implement in-circuit. More info here: \url{https://docs.vocdoni.io/architecture/data-schemes/ballot-protocol.html\#vocdoni-results-interpretation} (no multiple question supported).} + +\martai{It is called Ballot Mode because we define some modes (like quadratic, etc.) that can be chosen by the organizer. Essentially, each of this modes has a special configuration, but in order to make it easier, the organizer only needs to choose which of the modes (configs) to apply.} + +\martai{How is the voter's $\weight$ encoded as part of the ballot?} + +The \davinci ballot protocol is a simple and efficient mechanism for casting and tallying votes in any type of election or collective decision-making process. Each voting process consists of one or several fields and voters are required to provide a response for each of these fields in their ballot. + +The responses in the ballot are represented as a sequence of natural numbers, each corresponding to the voter’s choice for the respective field. Results are accumulated into a single array. Each position in the array corresponds to the sum of all votes cast for that field across all voters. + +The ballot protocol is defined by a set of configurable variables that dictate how votes must be cast. This way the protocol can accommodate a wide range of voting processes and behaviors. The list of variables is the following. + +\begin{enumerate} + \item \maxcount: it defines the maximum number of fields in a ballot (max 64). + \item \maxvalue: it is the maximum allowable value for any field in a ballot (if greater than 0). + \item \minvalue: it is the minimum allowable value for any field in a ballot (default 0). + \item \uniquevalues: it specifies whether voters can select the same value multiple times within a ballot (default false). + \item \maxtotalcost: it limits the sum of all field values in a ballot (if greater than 0). + \item \mintotalcost: it specifies a minimum required total sum of field values in a ballot (default 0) + \item \costexponent: it defines the exponent used to calculate the "cost" of votes for each field (default 1). +\end{enumerate} + +\martai{"if greater than 0" vs. "default" (make it consistent).} + +\begin{figure}[H] + \centering + \fbox{ + \includegraphics[scale = 0.4, draft = false]{\figs/ballot-variables.png}} +\end{figure} + +\martai{In Figure: when is says uniqueValues: x, y, z must be different -- this is if uniqueValues = false, right?} + +\paragraph{Example 1: Rating candidates.} + +\martai{Reorder names Lennon, Hendrix, Joplin alphabetically.} +\martai{In this example, the rest of variables are default, right? E.g. minValue = 0?} + +Consider a voting process where voters are asked to rate three candidates: Lennon, Hendrix, and Joplin. Voters rate each candidate from 0 to 5 stars, and each vote is represented as an array where each position corresponds to the candidate’s rating. The configuration of this voting would be the following: + +\begin{itemize} + \item \maxcount: 3 + \item \maxvalue: 5 + \item \uniquevalues: Yes +\end{itemize} + +Ballots: + +\begin{itemize} + \item Vote 1: \texttt{[3, 2, 5]} (3 stars for Lennon, 2 stars for Hendrix, 5 stars for Joplin) + \item Vote 2: \texttt{[4, 3, 2]} + \item Vote 3: \texttt{[2, 4, 5]} +\end{itemize} + +\martai{I would write 4 ballots.} + +After accumulating the votes: + +\begin{itemize} + \item Results Array: \texttt{[3+4+2, 2+3+4, 5+2+5] = [9, 9, 12]}\\ + Lennon received 9 points, Hendrix received 9 points, and Joplin received 12 points. +\end{itemize} + +\martai{In the above example, there is no limit to maxTotalCost, right? Maybe add something like, if maxTotalcost = X, then one of the previous ballots would be invalid (and explain why).} + +\paragraph{Example 2: Quadratic voting for resource allocation.} + +In a scenario where voters distribute a fixed number of credits across different options (e.g., selecting funding levels for NGOs), the ballot allows voters to assign multiple points, but the cost of casting multiple votes for a single option increases quadratically. + +Configuration: + +\begin{itemize} + \item \maxcount: 4 + \item \maxtotalcost: 12 (credits) + \item \costexponent: 2 (quadratic) +\end{itemize} + +Ballots: + +\begin{itemize} + \item Vote 1: \texttt{[2, 2, 2, 0]} + \item Vote 2: \texttt{[1, 1, 3, 1]} + \item Vote 3: \texttt{[0, 2, 1, 2]} +\end{itemize} + +\martai{Add a fourth vote, e.g. [3, 3, 0, 0]. Then mention that the first 3 ballots are ok because $2^2 + 2^2 + 2^2 = 12$, $1^2 + 1^1 + 3^2 + 1^2 = 12$, $2^2 + 1 + 2^2 = 9 < 12$, but $3^2 + 3^2 = 18 > 12$, and therefore it's invalid. Did I get this right?} + + +After accumulating the votes: + + +\begin{itemize} + \item Results Array: \texttt{[2+1+0, 2+1+2, 2+3+1, 0+1+2] = [3, 5, 6, 3]} \\ + Each position in the array represents the total sum of credits allocated to each NGO. +\end{itemize} + +\martai{Cost may be dependant on the voter's weight.}
@@ -15,12 +15,12 @@
The ballot protocol is defined by a set of configurable variables that dictate how votes must be cast. This way the protocol can accommodate a wide range of voting processes and behaviors. The list of variables is the following. \begin{enumerate} - \item \maxcount: it defines the maximum number of fields in a ballot (max 64). + \item \numfields: it defines the maximum number of fields in a ballot (max 64). \item \maxvalue: it is the maximum allowable value for any field in a ballot (if greater than 0). \item \minvalue: it is the minimum allowable value for any field in a ballot (default 0). \item \uniquevalues: it specifies whether voters can select the same value multiple times within a ballot (default false). - \item \maxtotalcost: it limits the sum of all field values in a ballot (if greater than 0). - \item \mintotalcost: it specifies a minimum required total sum of field values in a ballot (default 0) + \item \maxvaluesum: it limits the sum of all field values in a ballot (if greater than 0). + \item \minvaluesum: it specifies a minimum required total sum of field values in a ballot (default 0) \item \costexponent: it defines the exponent used to calculate the "cost" of votes for each field (default 1). \end{enumerate}@@ -42,7 +42,7 @@
Consider a voting process where voters are asked to rate three candidates: Lennon, Hendrix, and Joplin. Voters rate each candidate from 0 to 5 stars, and each vote is represented as an array where each position corresponds to the candidate’s rating. The configuration of this voting would be the following: \begin{itemize} - \item \maxcount: 3 + \item \numfields: 3 \item \maxvalue: 5 \item \uniquevalues: Yes \end{itemize}@@ -73,9 +73,9 @@
Configuration: \begin{itemize} - \item \maxcount: 4 - \item \maxtotalcost: 12 (credits) - \item \costexponent: 2 (quadratic) + \item \numfields: 4 + \item \maxvaluesum: 12 (credits) + \item \costexponent: 2 (quadratic) \end{itemize} Ballots:
@@ -9,7 +9,7 @@
\subsection{Elliptic curves} \label{sec:cryptographic-primitives:elliptic-curves} -\Davinci relies on multiple elliptic curves to ensure interoperability with Ethereum, compatibility with available cryptographic primitives, and efficient in-circuit operations. On the one hand, SECP256K1~\cite{brown10sec} is used because Ethereum public keys are elements of this curve. As \Davinci assumes each voter holds a standard Ethereum address, cryptographic operations such as digital signatures and identity verification rely on SECP256K1 to match the Ethereum ecosystem. On the other hand, BN254~\cite{jancar20bn256} is chosen because it is the curve supported by Ethereum's precompiled contracts for ZK proof verification, which makes it ideal for verifying SNARK proofs on-chain with minimal gas cost. then, BabyJubjub~\cite{belles21twisted} is used as an inner curve for elliptic curve operations within arithmetic circuits. Finally, BLS12-377~\cite{bowe20zexe} and BW6-761~\cite{elhousni20optimized} are used to enable recursive proof composition. More specifically, BLS12-377 acts as the inner curve for constructing proofs, while BW6-761 serves as the outer curve that verifies those proofs within larger ZK-SNARK circuits. This pairing enables succinct verification and composability of ZK-SNARKs within other ZK-SNARKs, which we use for \davinci’s aggregation and state transition logic. Below, we give the details of these curves. +\Davinci relies on multiple elliptic curves to ensure interoperability with Ethereum, compatibility with available cryptographic primitives, and efficient in-circuit operations. On the one hand, SECP256K1~\cite{brown10sec} is used because Ethereum public keys are elements of this curve. As \Davinci assumes each voter holds a standard Ethereum address, cryptographic operations such as digital signatures and identity verification rely on SECP256K1 to match the Ethereum ecosystem. On the other hand, BN254~\cite{jancar20bn256} is chosen because it is the curve supported by Ethereum's precompiled contracts for ZK proof verification, which makes it ideal for verifying SNARK proofs on-chain with minimal gas cost. Then, BabyJubjub~\cite{belles21twisted} is used as an inner curve for elliptic curve operations within arithmetic circuits. Finally, BLS12-377~\cite{bowe20zexe} and BW6-761~\cite{elhousni20optimized} are used to enable recursive proof composition. More specifically, BLS12-377 acts as the inner curve for constructing proofs, while BW6-761 serves as the outer curve that verifies those proofs within larger ZK-SNARK circuits. This pairing enables succinct verification and composability of ZK-SNARKs within other ZK-SNARKs, which we use for \davinci’s aggregation and state transition logic. Below, we give the details of these curves. \paragraph{Parameters.}@@ -162,9 +162,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:authentication}).
\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}. -\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). {\color{blue}On the other side, $\hlset{\Multimimc}$.} - -\martai{MiMC two instantiations: MiMC and MiMC-7, and also the curves. Check!} +{\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:@@ -182,46 +180,38 @@
\subsection{Encryption schemes} \label{sec:cryptographic-primitives:encryption} -\textit{Old text: Threshold homomorphic encryption, specifically the ElGamal scheme, is used to allow the summation of encrypted votes without decrypting them. This enables the system to compute the final vote tally while maintaining the privacy of individual votes. By ensuring that no vote is exposed during the aggregation phase, this scheme preserves voter confidentiality and provides anti-coercion protection, as voters cannot prove their choice to a third party once an encrypted vote is added.}\\ +To preserve ballot secrecy while enabling tallying, \davinci employs a threshold variant of the ElGamal cryptosystem instantiated over the BabyJubjub curve~\cite{sutikno98implementation}. 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. -ElGamal [CITE]. - -\medskip - +\paragraph{Encryption and decryption.} +Given a message $m$, the ElGamal encryption algorithm maps it into a group element $M$ of $\BJ{\G}$ and outputs a ciphertext as follows: +% \begin{mdframed} \begin{minipage}[t]{0.54\textwidth} \begin{itemize} - \item[$\bullet$] $\hlset{\Enc}_{\pk}(\msg \in \{0,1\}^\star; k\in\F_t)$: \vspace{0.1cm} + \item[$\bullet$] $\hlset{\Enc}_{\pk}(m; k \in \F_t)$: \begin{enumerate} - \item Map $\msg$ to $\BJ{\G}$ via $M = m \hlget{\BJ{G}}$. + \item Map $m$ to $\BJ{\G}$ via $M = m \cdot \hlget{\BJ{G}}$. \item Compute $C_1 = k \cdot \hlget{\BJ{G}} \in \BJ{\G}$. - \item Compute $C_2 = k \cdot \pk + M \in \BJ{\G}$. + \item Compute $C_2 = k \cdot \pk + M \in \BJ{\G}$. \item Output $\enc = (C_1, C_2) \in {(\BJ{\G})}^2$. \end{enumerate} \end{itemize} \end{minipage} \begin{minipage}[t]{0.44\textwidth} \begin{itemize} - \item[$\bullet$] $\hlset{\Dec}_{\sk}(\enc \in {(\BJ{\G})}^2)$: \vspace{0.1cm} + \item[$\bullet$] $\hlset{\Dec}_{\sk}(\enc)$: \begin{enumerate} - - %From a ciphertext (C,D) calculate C′=xC, and retrieve the point Pm with Pm=D−C′=(k(xP)+Pm)−(x(kP)). Then calculate the message m with f−1(Pm). - - \item Parse $\enc = (C_1, C_2) \in {(\BJ{\G})}^2$. + \item Parse $\enc = (C_1, C_2)$. \item Compute $K = \sk \cdot C_1 \in \BJ{\G}$. - \item Output $\msg = C_2 - K$. + \item Output $M = C_2 - K$. \end{enumerate} \end{itemize} \end{minipage} \end{mdframed} -\martai{It remains to explain how to recover $m$ from $M$. I propose to define a function $P_m$ that maps $m$ to $\J$, and then say that although it is generally not invertible, in this case the message space is small, and therefore, it can be done via brute-force search or using the baby-step giant-step algorithm [CITE].} +Since the plaintext message space is typically small, recovering $m$ from $M$ is efficient: although the mapping $m \mapsto M$ is not generally invertible, it can be reversed by brute-force search or optimized techniques such as baby-step giant-step~\cite{blake95elliptic}.%Blake: section V.4. -Note that this scheme is additively homomorphic. That is, given two ciphertexts $(C_1, C_2)$ and $(C_1', C_2')$, their component-wise addition yields: $(C_1^{sum}, C_2^{sum}) = (C_1 + C_1', C_2 + C_2')$. The aggregated ciphertext decrypts to the sum of the messages $M^{sum} = M_1 + M_2$. - -\martai{The $pk$ used to encrypt is generated by multiple parties as defined in Section~\ref{sec:cryptographic-primitives:dkg}.} - -\martai{Add reencryption algorithm, which essentially adds $\Enc(0)$: $\Enc(v) = \Enc(v + 0) = \Enc(v) + \Enc(0)$.} +\paragraph{Homomorphic addition and reencryption.} ElGamal encryption is additively homomorphic. Given two ciphertexts $(C_1, C_2)$ and $(C_1', C_2')$, their component-wise addition yields another valid ciphertext $(C_1 + C_1',\, C_2 + C_2')$. The resulting ciphertext decrypts to the sum of the two underlying messages. This property allows sequencers to aggregate encrypted ballots directly. Moreover, to prevent linkability and ensure receipt-freeness, sequencers also re-randomize ciphertexts. Re-encryption exploits this property by adding to a ciphertext an encryption of zero. This operation yields a fresh ciphertext of the same message under new randomness, making it computationally infeasible to link the re-encrypted ballot with the original submission. \begin{mdframed} \begin{minipage}[t]{0.53\textwidth}@@ -240,7 +230,7 @@ \item[$\bullet$] $\hlset{\ReEnc}_{\pk}(\enc \in {(\BJ{\G})}^2; k\in\F_t)$: \vspace{0.1cm}
\begin{enumerate} \item Parse $\enc = (C_1, C_2) \in {(\BJ{\G})}^2$. \item Compute $\enc' = \hlget{\Enc}_{\pk}(0; k)$. - \item Output $\hlget{\EncAdd_{\pk}(\enc, \enc')}$. + \item Output $\hlget{\EncAdd}_{\pk}(\enc, \enc')$. % \item Compute $C_1' = k \cdot G + C_1 \in \J$. % \item Compute $C_2' = k \cdot \pk + C_2 \in \J$. % \item Output $\enc' = (C_1', C_2') \in \J^2$.@@ -249,14 +239,19 @@ \end{itemize}
\end{minipage} \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{Digital signature schemes} \label{sec:cryptographic-primitives:signatures} -\Davinci uses the elliptic curve digital signature algorithm (ECDSA)~\cite{johnson01ecdsa} over the SECP256K1 curve to ensure compatibility with standard Ethereum wallets. %, such as MetaMask~\ref{} or Ledger~\ref{}, +\Davinci uses the {elliptic curve digital signature algorithm} (ECDSA)~\cite{johnson01ecdsa} over the SECP256K1 curve to ensure compatibility with standard Ethereum wallets. %, such as MetaMask~\ref{} or Ledger~\ref{}, % %\Davinci uses the elliptic curve digital signature algorithm (ECDSA)~\cite{johnson01ecdsa} over the SECP256K1 curve for user authentication and vote authorization. This decision is taken to ensure that \davinci is compatible with standard Ethereum wallets, such as MetaMask~\ref{} or Ledger~\ref{}, without requiring users to generate or manage additional cryptographic keys. % -Verification of ECDSA signatures is \textit{performed inside} zero-knowledge proofs using a specialized circuit that emulates SECP256K1 arithmetic. This approach is necessary because SECP256K1 is defined over a 256-bit prime field that differs from the native field used in the ZK-SNARK circuit (see Section\ref{sec:vocdoni-protocol:circuits} for more details). Below, we describe the algorithms, which follow the standard ECDSA protocol. +Verification of ECDSA signatures is performed inside zero-knowledge proofs using a specialized circuit that emulates SECP256K1 arithmetic. This approach is necessary because SECP256K1 is defined over a 256-bit prime field that differs from the native field used in the ZK-SNARK circuit (see Section\ref{sec:vocdoni-protocol:circuits} for more details). Below, we describe the algorithms, which follow the standard ECDSA protocol. +% +{\color{blue} (The output of the hash does not match -- check where variables live.)} \begin{mdframed} \begin{minipage}[t]{0.46\textwidth}@@ -266,8 +261,16 @@ \begin{enumerate}
\item Compute $h = \hlget{\Keccak}(\msg) \bmod q$. \item\label{item:ssign-step} Select a random scalar $k \sample \Z_q^{*}$. \item Compute $R = k \cdot \hlget{\SEC{G}} = (x_R, y_R) \in \SEC{\G}$. - \item Set $r = x_R \bmod q$. If $r = 0$, go back to step~\ref{item:ssign-step}. - \item Compute $s = k^{-1} \cdot (h + r \cdot \sk) \bmod q.$ If $s = 0$, go back to step~\ref{item:ssign-step}. + \item Set $r = x_R \bmod q$. + \begin{itemize} + \item If $r = 0$, go back to step~\ref{item:ssign-step}. + \item Else, continue. + \end{itemize} + \item Compute $s = k^{-1} \cdot (h + r \cdot \sk) \bmod q.$ + \begin{itemize} + \item If $s = 0$, go back to step~\ref{item:ssign-step}. + \item Else, continue. + \end{itemize} \item Output $\sigma = (r, s)$. \end{enumerate} \end{itemize}@@ -279,7 +282,8 @@ \begin{enumerate}
\item Check that $\pk \in \SEC{\G}$. \item Compute $h = \hlget{\Keccak}(\msg) \bmod q$. \item Compute $w = s^{-1} \bmod q$. - \item Compute $u_1 = h \cdot w \bmod q$ and $u_2 = r \cdot w \bmod q$. + \item Compute $u_1 = h \cdot w \bmod q$. + \item Compute $u_2 = r \cdot w \bmod q$. \item Compute $$X = u_1 \cdot \hlget{\SEC{G}} + u_2 \cdot \pk = (x_X, y_X) \in \SEC{\G}.$$ \item Accept if $r = x_X \bmod q$; otherwise, reject. \end{enumerate}@@ -287,114 +291,98 @@ \end{itemize}
\end{minipage} \end{mdframed} -\martai{The output of the hash does not match, CHECK!} - \subsection{Key generation schemes} \label{sec:cryptographic-primitives:dkg} -\textit{Old text: The DKG protocol is used to generate the encryption public key (EPK) in a decentralized manner. Sequencers collaboratively participate in the DKG process to create the EPK, ensuring that no single party has full control over the key. This approach guarantees that the encryption key remains secure and that decryption of results is only possible when a threshold number of sequencers publish their shares.}\\ +To ensure that no single entity controls the decryption key, DAVINCI employs a distributed key generation (DKG) protocol to jointly derive the ElGamal encryption key pair used for ballots encryption~\cite{}. Sequencers who participate in the DKG ceremony 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 sequencers. Only a threshold number $t$ out of $n$ sequencers can later collaborate to decrypt the tally. Unlike classical DKG protocols where shares are exchanged in the clear, our construction uses encrypted shares and 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. -We use the distributed key generation (DKG) protocol that allows a group of participants to jointly generate a pair of public/private keys for the ElGamal cryptosystem [CITE]. Each participant holds a share of the private key, and only a threshold number of participants can collaborate to decrypt messages. +{\color{blue} Let $t$ be the threshold parameter and $n$ the number of sequencers, with $t\leq n$. Let $G$ be a generator of the elliptic curve group of order $q$. Each participant $P_i$ runs the following procedure. -\martai{We use a variation of DKG because of the encryption of shares. Below I described the original functions but they should be changed!} -\martai{Mention that in the SC participants are listed, that is, they have an associated number $i$.} +\begin{mdframed} + \begin{itemize} + {\color{blue} + \item[$\bullet$] $\hlset{\GenerateEncryptedShares}(i)$: + \begin{enumerate} + \item Select random scalars $a_{i,0},\dots,a_{i,t-1} \sample \Z_q$. + \item Define the polynomial $f_i(x) = \sum_{j=0}^{t-1} a_{i,j} x^j$. + \item For each $j \in \{0,\dots,t-1\}$, compute public commitments $C_{i,j} = a_{i,j}\cdot G$. + \item For each sequencer $P_\ell$ with index + $\ell \in \{1,\dots,n\}$, compute the secret share $s_{i,\ell} = f_i(\ell)$. + \item Encrypt each $s_{i,\ell}$ under $P_\ell$'s public key using a simplified version of the EC integrated encryption scheme (ECIES), obtaining $EncECIES(s_{i,\ell})$. + \item Output $\{C_{i,j}\}_{j=0}^{t-1}$ and $\{EncECIES(s_{i,\ell})\}_{\ell=1}^n$, together with a ZK-SNARK proof attesting that the encrypted values are consistent with the commitments. + \end{enumerate} + } + \end{itemize} +\end{mdframed} -Let $t$ be the threshold parameter (minimum number of participants required to decrypt messages) and $n$ the total number of participants participating in the DKG protocol ($t \leq n$). Let $G$ be generator point of order $q$. (This will already be defined in the EC section). +The smart contract verifies the encrypted shares. \begin{mdframed} -Each participant $P_i$ will use $\hlget{\GenerateShares}$ to generate their share. Then, they will make the set $\{C_i\}_{i=1}^{t-1}$ publicly available and send each $s_j$ privately to each participant $s_j$. Every participant $P_i$ can verify the share $s_{j,i}$ received from $P_j$ (from of the others) using the algorithm $\hlget{\VerifyShare}$.\\ - -\noindent -\begin{minipage}[t]{0.5\textwidth} - \begin{itemize} - \item[$\bullet$] $\hlset{\GenerateShares}(\text{participant $i$})$: \vspace{0.1cm} - \begin{enumerate} - \item Select random scalars $a_{i,0} \sample \Z_q$. - \item Define the polynomial $f_i(x) = \sum_{j = 0}^{t-1} a_{i,j} x^{j}$. - \item For every $j\in\{0,\dots,t-1\}$, compute - $$C_{i, j} = a_{i,j}\cdot G.$$ - \item For every $j\in\{1,\dots,n\}$, compute shares - $$s_{i, j} = f_i(j).$$ - \item Output $\{C_{i,j}\}_{i=0}^{t-1}$ and $\{s_{i,j}\}_{j=1}^{n}$. - \end{enumerate} - \end{itemize} - \martai{This is not true - according to the specs, shares are encrypted using a simplified version of the EC integrated encryption scheme (ECIES). Each participant generates a zkSNARK proof to prove the correctness of the encrypted shares and compliance of the DKG protocol. This allows the Ethereum SC to verify the validity without revealing the secrets.} - \martai{Change the name of algorithm to $\texttt{GenerateEncryptedShares}$.} -\end{minipage} -\begin{minipage}[t]{0.5\textwidth} - \begin{itemize} - \item[$\bullet$] $\hlset{\VerifyShare}(i, j, s_{i,j}, C_i)$: \vspace{0.1cm} - \begin{enumerate} - \item Compute $V = \sum_{i = 0}^{t-1} C_i$. - \item Verify that $V = s_{i,j} \cdot G$. - \martai{This is done by the smart contract - the shares are not in the clear but encrypted.} - \end{enumerate} - \end{itemize} - \martai{Describe slashing mechanism in SC section if one of the shares fails the verification?} -\end{minipage} + \begin{itemize} + {\color{blue} + \item[$\bullet$] $\hlset{\VerifyEncryptedShare}(i, \ell, EncECIES(s_{i,\ell}), \{C_{i,j}\})$: + \begin{enumerate} + \item Verify that the ZK-SNARK proof attached to $EncECIES(s_{i,\ell})$ is correct. + \item If the proof is valid, the share is accepted; otherwise, the participant $P_i$ may be slashed. + \end{enumerate} + } + \end{itemize} \end{mdframed} -%%%% -% -%%%% + +After collecting valid encrypted shares, each sequencer $P_j$ can recover their secret share $s_j$ by decrypting all contributions addressed to them:} + \begin{mdframed} -Participant $P_j$ uses the algorithm $\hlget{\DeriveSecretShare}$ to compute their portion of the collective private key. The algorithm $\hlget{\DerivePublicKey}$ generates the public key from the committed data from the participants. \\ - -\noindent -\begin{minipage}[t]{0.5\textwidth} \begin{itemize} - \item[$\bullet$] $\hlset{\DeriveSecretShare}(\text{participant $j$})$: \vspace{0.1cm} + {\color{blue} + \item[$\bullet$] $\hlset{\DeriveSecretShare}(j)$: \begin{enumerate} - \item Compute $s_j = \sum_{i = 1}^{n} s_{i, j} \mod q$. + \item Decrypt all $EncECIES(s_{i,j})$ values received from other participants. + \item Compute $s_j = \sum_{i=1}^n s_{i,j} \mod q$. \item Output $s_j$. \end{enumerate} + } \end{itemize} -\end{minipage} -% -\begin{minipage}[t]{0.5\textwidth} +\end{mdframed} + +\begin{mdframed} \begin{itemize} - \item[$\bullet$] $\hlset{\DerivePublicKey}(\{C_{i,0}\}_{i=1}^n)$: \vspace{0.1cm} - \begin{enumerate} - \item Let $pk = \sum_{i=1}^n C_{i,0}$. - \item Output $pk$. - \end{enumerate} + {\color{blue} + \item[$\bullet$] $\hlset{\DerivePublicKey}(\{C_{i,0}\}_{i=1}^n)$: + \begin{enumerate} + \item Compute $pk = \sum_{i=1}^n C_{i,0}$. + \item Output $pk$. + \end{enumerate} + Note that $C_{i,0} = a_{i,0}\cdot G$, so the collective public key corresponds to $pk = s \cdot G$, where $s = \sum_{i=1}^n a_{i,0} \bmod q$ is the collective private key, unknown to any single participant. + } \end{itemize} - Note that since $C_{i,0} = a_{i,0} \cdot G$, the public key is effectively $sG$ where $s = \sum_{i = 1}^n a_{i,0} \mod q$ is the collective private key (unknown to any single participant). - \martai{As before, this should be changed to the encrypted version. It should be explained how the public key is generated from the encrypted shares.} -\end{minipage} -% \end{mdframed} +This approach ensures that the encryption public key is securely generated in a decentralized way, that each sequencer learns only their own secret share, and that the correctness of the entire DKG procedure is verifiable on-chain. Misbehavior, such as submitting invalid shares, can be detected and penalized through the slashing mechanism enforced by the smart contract (see Section~\ref{sec:token}). + \subsection{Merkle trees} \label{sec:cryptographic-primitives:merkle-trees} -The \davinci protocol uses sparse Merkle trees (SMTs) as defined in ~\cite{baylina19sparse}. Essentially, in this kind of trees each leaf corresponds to a key-value pair, with empty leaves explicitly represented to enable both inclusion and non-inclusion proofs. The key feature of these trees is that the hash of each entry defines a unique traversal path in the tree from root to leaf, regardless of insertion order. When inserting, the algorithm descends until it encounters an empty node or a leaf; if there is a hash prefix collision, the tree is split at the first differing bit, creating new intermediate nodes appropriately. SMTs support efficient membership and non‑membership proofs, enabling a party to prove that a given key-value is (or is not) present in the tree without revealing the content. +The \davinci protocol uses sparse Merkle Trees (SMTs) as its primary data structure for maintaining off-chain state. Following the construction in~\cite{baylina19sparse}, these are full binary trees of fixed depth in which each leaf encodes a key-value pair and empty leaves are explicitly represented, allowing for both inclusion and non-inclusion proofs. A key property of SMTs is that the hash of each key determines a unique traversal path from the root to the leaf, regardless of insertion order. When inserting a new key, the tree descends until it encounters either an empty node or a leaf. In case of a path collision, the algorithm splits at the first differing bit, creating intermediate nodes accordingly. +%SMTs support efficient membership and non‑membership proofs, enabling a party to prove that a given key-value is (or is not) present in the tree without revealing the content. -In \davinci, both the census (voter registry with weights) and the vote state are maintained using SMTs. The root hashes are committed on-chain, while full tree contents remain off-chain. Sequencers generate and submit Merkle proofs to the verification circuits, which reconstruct and validate the root transitions. This design allows compact, verifiable state updates and enables independent verification without relying on trusted data sources. - -\noi To each Merkle tree $\tree$, we associate the following functions: +In \davinci, SMTs are used to represent two core data structures: the census tree, which encodes the list of eligible voters along with their respective voting weights, and the state tree, which encodes the current status of submitted votes. Both trees have fixed depth 64. The census tree is instantiated with the MiMC hash function over the BLS12-377 scalar field, while the state tree uses Poseidon over the BN254 scalar field. Only the root hash of each tree is published on-chain, ensuring verifiability with minimal on-chain storage. +% +To support state transitions and circuit verification, each tree $\tree$ has the following functions associated: \begin{itemize} -% \item ${\tree.\hlset{\MTGenerate}}(data)$: given a set of data, instantiate the tree. - \item ${\tree.\hlset{\MTRoot}}()$: it returns the root of the tree. - \item ${\tree.\hlset{\MTInsert}}(path, \leaf)$: efectivament, el path se segueix per it inserts a new leaf in the tree. - \item ${\tree.\hlset{\MTUpdate}}(\leaf[old], \leaf)$: given an old leaf in the tree, it updates the leaf content to \leaf. -% \item ${\tree.\hlset{\MTRemove}}()$: it removes a leaf from the tree. The root is updated. - \item ${\tree.\hlset{\MTMembershipProof}}(\leaf)$: it returns the Merkle tree inclusion proof of the given \leaf. - \item ${\tree.\hlset{\MTNonMembershipProof}}(\leaf)$: it returns the Merkle tree non-inclusion proof of the given \leaf. - % \item ${\MT.\UpdateRoot}_{\pp}({\leaf, \pos, \root})$: it updates the root. - \item ${\tree.\hlset{\MTVerify}}(\leaf, proof, root)$: it takes a Merkle proof and a root as an input and verifies the proof of the leaf against the given root. + \item $\tree.\hlset{\MTRoot}()$: it returns the current Merkle root of the tree. + \item $\tree.\hlset{\MTInsert}(path, \leaf)$: it inserts a new leaf $\leaf$ at the position defined by the given path. + \item $\tree.\hlset{\MTUpdate}(\leaf_{old}, \leaf)$: it updates an existing leaf in the tree. + \item $\tree.\hlset{\MTMembershipProof}(\leaf)$: it returns a Merkle proof of inclusion for the given leaf. + \item $\tree.\hlset{\MTNonMembershipProof}(\leaf)$: it returns a proof that the given leaf is not included in the tree. + \item $\tree.\hlset{\MTVerify}(\leaf, proof, root)$: it verifies that the given proof corresponds to the claimed root and leaf. \end{itemize} -\martai{\textbf{(1) State MT:} Poseidon with BN254 scalar field. \textbf{(2) Census MT:} MiMC with BLS12-377 scalar field.} - -\martai{Sparse MTs (binary) with depth $64$. Structure of sparse MT from iden3.} - -\martai{Add MT.Update, for those ciphertexts that are overwrites.} - -\martai{Clarify leaf -- if hash of the leaf or address as path.} +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 Section~\ref{sec:vocdoni-protocol:merkle-trees}. \subsection{Zero-knowledge proof systems} \label{sec:cryptographic-primitives:zkp} -Groth16~\cite{groth2016size} with different curves. -\textit{Zero-knowledge succinct non-interactive arguments of knowledge are a crucial component in ensuring the validity of the voting results. Voters generate zkSNARK proofs to prove that their encrypted votes comply with the rules and requirements of the voting process, without revealing any information about their choices. Sequencers also generate zkSNARK proofs to prove the correct aggregation of votes into the shared state that maintains the status of the voting process.}+{Zero-knowledge succinct non-interactive arguments of knowledge (ZK-SNARKs)} are a crucial component in ensuring the integrity of the voting process. 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}().} + +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}.
@@ -7,16 +7,14 @@ Against this backdrop, the Vocdoni project was initiated in 2018 with the aim of rethinking online voting from first principles. The name Voĉdoni, meaning “to give voice” in Esperanto, reflects the project’s foundational goal: to empower collectives—from small associations to millions of citizens—to engage in secure and verifiable decision-making, regardless of technological or institutional barriers. Central to this vision was the idea that voting is not limited to formal governmental elections but serves as a more general-purpose mechanism for collective signaling. Vocdoni introduced a fully anonymous, end-to-end verifiable voting system designed to operate efficiently across a range of devices, including smartphones. To support these goals, the team deployed a custom infrastructure emphasizing resilience, neutrality, and transparency.
Technically, the architecture of Vocdoni was grounded on a bespoke {Byzantine fault tolerant} (BFT) layer-1 blockchain, named Vochain. At the time, {zero-knowledge} (ZK) proof systems such as ZK-SNARKs were emerging but not yet practical for most deployments. Vochain provided a performant and low-cost environment (achieving approximately 700 transactions per second) where advanced cryptographic tools could be used without the constraints imposed by blockchains based on the {Ethereum virtual machine} (EVM). The ability to issue voting transactions without requiring user fees enabled broader accessibility. Over several years of development and deployment, this architecture proved both viable and valuable in practice. However, broader adoption as a universal voting protocol highlighted the need for further architectural refinements and stronger formal guarantees. -In this work, we introduce \davinci, a new protocol that builds upon the lessons and conceptual groundwork laid by Vocdoni. \Davinci adopts a modular design and integrates state-of-the-art cryptographic tools—including succinct ZK proofs, improved bulletin board constructions, and robust coercion resistance mechanisms—reflecting the most recent advances in academic research. Unlike monolithic designs, \davinci is conceived as a composable primitive: a foundational layer intended to support secure and verifiable voting in diverse contexts, from blockchain governance to institutional elections. This shift in design philosophy aims to address long-standing challenges in the field, offering a cleaner abstraction with clearer security boundaries and formal underpinnings.\\ - -\martai{TODO -- introduce the Vocdoni token.} +In this work, we introduce \davinci, a new protocol that builds upon the lessons and conceptual groundwork laid by Vocdoni. \Davinci adopts a modular design and integrates state-of-the-art cryptographic tools, including succinct ZK proofs, improved bulletin board constructions, and robust coercion resistance mechanisms—reflecting the most recent advances in academic research. Unlike monolithic designs, \davinci is conceived as a composable primitive: a foundational layer intended to support secure and verifiable voting in diverse contexts, from blockchain governance to institutional elections. This shift in design philosophy aims to address long-standing challenges in the field, offering a cleaner abstraction with clearer security boundaries and formal underpinnings.\\ \subsection{Contributions} \label{sec:introduction:contributions} This work introduces \davinci, a modular and verifiable protocol for digital voting, designed to support privacy-preserving, auditable, and adaptable election processes across diverse governance contexts. The protocol models voting as a constrained state machine, in which each valid operation is expressed as a formally defined state transition, enforced through succinct ZK proofs. That is, at the core of the system lies a set of reusable arithmetic circuits that implement voter authentication, encrypted ballot validation, state transitions, and tally finalization. These circuits are optimized for off-chain proving and are compatible with modern ZK-SNARK systems. Application-layer state is maintained off-chain and committed on-chain using cryptographic accumulators, specifically Merkle trees. The protocol defines two such trees: one for the voter registry (the census) and one for the voting state. These trees enable voters and verifiers to produce efficient inclusion and transition proofs, while minimizing on-chain storage and computation. -To coordinate protocol execution, \davinci includes a set of Ethereum smart contracts that mediate the setup of elections, manage finalization procedures, and verify submitted proofs of correctness. A standardized transaction and data encoding format supports all stages of the process, including vote casting, aggregation, and result publication. This approach ensures that protocol interactions remain deterministic and interoperable across clients and backends. Overall, the design aims to balance auditability and privacy while reducing trust assumptions on infrastructure providers. By cleanly separating concerns and providing modular interfaces, the protocol is intended to serve as a foundation for both practical deployments and future extensions, such as integration with alternative identity systems, off-chain data availability layers, or other consensus backends. +To coordinate protocol execution, \davinci includes a set of Ethereum smart contracts that mediate the setup of elections, manage finalization procedures, and verify submitted proofs of correctness. A standardized transaction and data encoding format supports all stages of the process, including vote casting, aggregation, and result publication. This approach ensures that protocol interactions remain deterministic and interoperable across clients and backends. The system also introduces the Vocdoni token, which is used to align incentives between participants. Altogether, the design aims to balance auditability and privacy while reducing trust assumptions on infrastructure providers. By cleanly separating concerns and providing modular interfaces, the protocol is intended to serve as a foundation for both practical deployments and future extensions, such as integration with alternative identity systems, off-chain data availability layers, or other consensus backends. \begin{itemize} \item The Vocdoni voting protocol.@@ -36,7 +34,7 @@
\begin{itemize} \item Section~\ref{sec:background}: background. \item Section~\ref{sec:protocol-intuition}: high overview of the election process. We omit technical details. - \item Section~\ref{sec:cryptographic-primitives}: cryptographic primitives used in the voting process. A description of the primitives but also the details of their instantiation, that is, the specific protocols being used. + \item Section~\ref{sec:cryptographic-primitives}: cryptographic primitives used in the voting process. A description of the primitives but also the specific protocols being used and the details of their instantiation. \item Section~\ref{sec:vocdoni-protocol}: description of the voting process. \item Section~\ref{sec:ballot-protocol}: a proposed protocol for ballots. The rules of this protocol are implemented in the process management smart contracts. \item Section~\ref{sec:token}: the Vocdoni token.
@@ -1,13 +1,17 @@
% !TeX root = ../build/main.tex -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 5 phases, as illustrated in Figure~\ref{fig:protocol-intuition}, and described below.\\ +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 5 phases, as illustrated in Figure~\ref{fig:protocol-intuition}, and described below. \begin{figure}[h] \centerline{\includegraphics[width=350pt,draft=false]{\figs/protocol-intuition-flow}} + \setlength{\abovecaptionskip}{0pt} % Space between figure and caption \caption{Overview of the protocol flow.} \label{fig:protocol-intuition} + %\setlength{\belowcaptionskip}{0pt} % Space after caption \end{figure} +\vspace{-0.5cm} + \paragraph{$\boxed{1}$ Voting setup.} In the first phase, the organizing entity gathers all census data and generates a cryptographic commitment to this data. %using a Merkle tree (MT) root.@@ -15,7 +19,7 @@ Additionally, the organizer defines the voting parameters, including the number of voting options and the vote-counting mechanism (e.g., weighted voting, quadratic voting, etc.). Once these details are set, the organizer submits a transaction to the process management smart contract on the Ethereum blockchain. This transaction publicly records the voting parameters and census commitment, ensuring transparency and preventing any subsequent alterations to the voting setup.
\paragraph{$\boxed{2}$ Encryption key generation.} -A designated group of participants, referred to as \textit{sequencers}, collaboratively generate a shared encryption public key, which voters will use to encrypt their votes. This key is established through a distributed key generation (DKG) protocol, ensuring that no single party can control or reconstruct the corresponding private key independently. +A designated group of participants, referred to as \textit{sequencers}, collaboratively generate a shared encryption public key, which voters will use to encrypt their votes. This key is established through a {distributed key generation} (DKG) protocol, ensuring that no single party can control or reconstruct the corresponding private key independently. Sequencers have a dual role in the protocol. In addition to generating the encryption key, they are also responsible for collecting votes from voters during the election. Consequently, their public key and the necessary information to contact them off-chain must be registered in the sequencer registry smart contract. Once the encryption public key is securely computed and published in the sequencer registry smart contract, the voting phase can start. \paragraph{$\boxed{3}$ Voting.}@@ -26,7 +30,7 @@
\paragraph{$\boxed{4}$ Votes collection.} During this phase, sequencers collect encrypted votes from multiple voters along with their corresponding proofs, and verify the validity of these submissions. That is, sequencers -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 polling 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 zero-knowledge (ZK) proof that attests to the correctness of all verifications. +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 polling 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 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, the 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.
@@ -3,7 +3,7 @@
\Davinci introduces the Vocdoni token (\token) as a key element of its decentralized voting ecosystem, playing a crucial role in the protocol's sustainability. The token serves multiple utility functions that align the incentives of all participants (voting organizers, sequencers, and voters) ensuring the integrity, efficiency, and security of the voting system. -\subsection{Roles of the \token} +\subsection{Roles of the token} \begin{enumerate} \item \textbf{Collateral for sequencers}: Sequencers are required to stake \token tokens as a collateral to participate in the protocol. This serves as a safeguard to ensure responsible participation. If a sequencer behaves improperly (whether due to malicious intent or unintentional errors) it can face penalties, including the loss of part of its staked tokens.
@@ -1,6 +1,6 @@
% !TeX root = ../build/main.tex -This section outlines the \davinci voting protocol. We introduce the parties involved in the process in Section~\ref{sec:vocdoni-protocol:parties}. In Section~\ref{sec:vocdoni-protocol:merkle-trees}, we describe the census and state Merkle trees, and in Section~\ref{sec:vocdoni-protocol:smart-contracts} the Ethereum smart contracts. In Section~\ref{sec:vocdoni-protocol:circuits}, we present the zero-knowledge circuits used to enforce vote validity, authentication, aggregation, and state transitions. Finally, in Section~\ref{sec:vocdoni-protocol:flow}, we detail the full protocol flow step by step, from the voting setup to the results validation and process finalization. +This section outlines the \davinci voting protocol. We introduce the parties involved in the process in Section~\ref{sec:vocdoni-protocol:parties}. In Section~\ref{sec:vocdoni-protocol:merkle-trees}, we describe the census and state Merkle trees, and in Section~\ref{sec:vocdoni-protocol:smart-contracts} the Ethereum smart contracts. In Section~\ref{sec:vocdoni-protocol:circuits}, we present the ZK circuits used to enforce vote validity, authentication, aggregation, and state transitions. Finally, in Section~\ref{sec:vocdoni-protocol:flow}, we detail the full protocol flow step by step, from the voting setup to the results validation and process finalization. \subsection{Parties involved} \label{sec:vocdoni-protocol:parties}@@ -17,105 +17,96 @@
\subsection{Merkle trees} \label{sec:vocdoni-protocol:merkle-trees} -Merkle trees are used to create a cryptographic representation of both the voter registry (census) and the voting process state. +Merkle trees are used to create a cryptographic representation of both the voter census registry and the voting process state. %\begin{itemize} % \item \textbf{Census}: Each voter is assigned a Merkle proof, which they use to prove their eligibility to vote. This mechanism ensures efficient and secure verification of voter eligibility. % \item \textbf{State}: The voting process state is represented as a Merkle tree, with new votes being added to the tree. The root of this Merkle tree is stored on Ethereum, allowing multiple sequencers to participate in the voting phase and ensuring consistency. %\end{itemize}} -\subsubsection{Census Merkle tree} +\subsubsection{Census tree} +The census Merkle tree, denoted by $\hlget{\censusTree}$ encodes the list of eligible voters and their associated voting weights. Formally, it is implemented as a sparse Merkle tree (SMT) of fixed depth\footnote{In the present work, all circuits are instantiated using sparse Merkle trees as described above. However, the protocol does not strictly depend on this structure: any authenticated data structure that supports efficient commitments and membership proofs verifiable inside zero-knowledge circuits could be employed. Adapting the protocol to such alternatives would only require modifying the corresponding circuits, while the overall flow of the voting process would remain unchanged.}, as described in Section~\ref{sec:cryptographic-primitives:merkle-trees}. Each voter is mapped to a unique path in the tree, typically derived from their Ethereum address or another unique identifier, and the corresponding leaf stores the voting weight of that address. While the default weight is usually one, the system also supports weighted voting, where different participants may have different levels of influence. -\martai{The Path corresponds to the voter's Address (e.g., their Ethereum address or any unique identifier). The Leaf Value stores the voting Weight assigned to that address.} +To construct the census, the organizer collects the dataset of eligible voters and their weights, computes the corresponding tree, and publishes its root (\censusroot) on-chain. The full dataset does not need to be stored on-chain; instead, it is distributed off-chain (e.g., via IPFS or another content-addressed storage system), enabling verifiers and sequencers to independently reconstruct the tree and produce membership proofs when needed. This design ensures transparency and verifiability while minimizing on-chain storage requirements. -The census represents the list of eligible voters and their associated voting weights. It is implemented as a binary Merkle tree using an iden3 Sparse Merkle Tree (SMT) structure with a zkSNARK-friendly hashing function to ensure compatibility with zero-knowledge circuits. Each leaf in the tree corresponds to a unique voter address (e.g., Ethereum address), and stores the associated voting weight. This construction enables efficient Merkle proofs that allow voters to prove their eligibility and weight without revealing the full census dataset. +The census tree plays a central role during the voting phase. Voters must provide a Merkle proof showing that their address and weight are included in the tree committed by the organizer. These proofs are then verified within ZK circuits, which guarantees that only eligible participants can cast ballots without requiring the disclosure of the entire census. In this way, the census Merkle tree provides a compact, cryptographically verifiable commitment to voter eligibility that supports both privacy and scalability. -$\hlset{\censusTree}$ - -The organizer is responsible for generating the census and computing its Merkle root, which is then committed on-chain. To minimize on-chain storage, the full census is distributed off-chain—e.g., via IPFS or a trusted HTTPS endpoint—allowing verifiers and sequencers to independently access the dataset and reconstruct Merkle proofs as needed. - -The protocol does not prescribe a specific method for constructing the census, but supports multiple approaches to accommodate various use cases: - -Private datasets. Organizations with internal lists of eligible voters (e.g., membership databases or CSV files) can directly convert them into the Merkle format. This allows voter registries to remain confidential, with only the root hash made public. - -Self-Sovereign Identity (SSI). Voter eligibility can also be derived from SSI systems, where users control their identities. The organizer collects and aggregates this data into the census tree, enabling participation without centralized identity management. - -Ethereum-based tokens. Token holdings—such as ERC-20 or NFT balances—can define voter eligibility using either of two approaches: - -Optimistic: A snapshot of token holders at a specific Ethereum block is used to build the census off-chain. The root is submitted to the smart contract, and a dispute period allows for fraud proofs (e.g., using Ethereum storage proofs) to challenge incorrect entries. - -Zero-knowledge: A zkSNARK circuit verifies that the census has been constructed correctly with respect to the on-chain token balances at a given block. The proof ensures balance correctness and total supply consistency. - -This flexible design allows the system to support a wide range of identity and eligibility models while maintaining transparency, verifiability, and scalability. - - -\martai{There is a whole section about the Census Merkle tree in the whitepaper -- CHECK!!} +Although the protocol does not mandate a specific method for constructing the census tree, different instantiations are possible depending on the application context: +% +\begin{itemize} + \item \emph{Private datasets}. Organizations maintaining internal voter registries (e.g., membership databases or CSV files) can directly convert them into the Merkle format. This approach keeps the registry confidential, with only the root hash made public. + \item \emph{Self-sovereign identity (SSI)}. If voters manage identities through SSI systems, the organizer can aggregate these identities and build + the tree accordingly. This enables participation without requiring centralized identity management. + \item \textit{Ethereum-based tokens}. Token balances (e.g., ERC-20 or NFTs) may also define eligibility. In this setting, the census can either be created via the optimistic approach, taking a snapshot of token balances and allowing a dispute period for fraud proofs, or through a ZK-SNARK that proves correctness directly from Ethereum storage proofs and ensures that both individual balances and the token’s total supply are consistent. +\end{itemize} +% +This flexibility allows the protocol to accommodate a wide range of use cases, from private associations to decentralized communities, while maintaining the same security and verifiability guarantees. -\martai{It could actually be another type of data structure. We only need to be able to get a commitment and a membership proof that can be proven in-circuit. Mention it in some way.} +\subsubsection{State tree} -\martai{One way to think about it: (weight, pk).} +The state Merkle tree, denoted by $\hlget{\stateTree}$, represents the evolving state of the voting process. Like the census tree, it is implemented as a SMT of fixed depth, as described in Section~\ref{sec:cryptographic-primitives:merkle-trees}. In contrast to the census tree, which remains static once the election begins, the state tree is dynamic: it is updated throughout the process as new votes are cast, validated, and incorporated by the sequencers. -\subsubsection{State Merkle tree} Explain what it is and the structure. Below, the original text: -The State tree contains some special addresses (indices) for storing some required data regarding the voting process: +The leaves of the state tree store the global process parameters, the encrypted ballots, and the set of vote identifiers, as illustrated in Figure~\ref{fig:mt-state}. More specifically: -$\hlset{\stateTree}$ +\paragraph{Reserved addresses for metadata.} The first six addresses are reserved for the process parameters as follows: \begin{itemize} - \item Address \texttt{0x0}: it stores \processid, a unique identifier for the voting process. - \item Address \texttt{0x1}: it stores the \censusroot. %and \type, which contains the necessary information to validate vote proofs. -% \martai{they type was a field in case the organization was using a different structure for the census than a MT.} - \item Address \texttt{0x2}: it stores \ballotmode, which encodes rules for validating votes, such as the maximum number of selectable options. - \item Address \texttt{0x3}: it stores the \epk, which is the public key used to encrypt the votes. - \item Address \texttt{0x4}: it stores the \addaccumulator, which is the aggregated encrypted voting results that need to be added. - \item Address \texttt{0x5}: it stores the \substractaccumulator, which is the aggregated encrypted voting results that need to be subtracted. + \item \texttt{0x0}: it stores a unique identifier for the voting process (\processid). + \item \texttt{0x1}: it stores the committed census root (\censusroot). %and \type, a field in case the organization was using a different structure for the census than a MT. + \item \texttt{0x2}: it stores the ballot mode configuration, which is the set of rules for validating votes (\ballotmode). + \item \texttt{0x3}: it stores the encryption public key used to encrypt the votes (\epk). + \item \texttt{0x4}: it stores an accumulator of the encrypted votes that need to be added to the tally (\addaccumulator). + \item \texttt{0x5}: it stores an accumulator of the encrypted votes that need to be substracted from the tally because they have been overwritten (\substractaccumulator). \end{itemize} -The rest of addresses: vote \addresses: are stored within the State tree pointing to a voter's encrypted ballot. Addresses are used as indexes (i.e. path to the leaf that stores encrypted ballots). -And voteIDs also stored within the State tree, pointing to empty leafs. +\paragraph{Encrypted ballots.} Each voter’s encrypted ballot is stored in the state tree at a leaf whose path corresponds to their Ethereum address (or another unique identifier). The leaf value is the ciphertext corresponding to the ballot generated under the election’s public encryption key. If the voter later overwrites their ballot, the same path is updated with the new ciphertext. + +\paragraph{Vote identifiers.} In addition to storing ballots, the state tree also tracks the set of vote identifiers. Each vote identifier \voteid, which is derived from the \processid, the voter’s address, and fresh randomness, determines the path to a dedicated leaf. Initially empty, these leaves are filled when the corresponding \voteid is used, thereby recording that it has been consumed. This enables efficient non-membership proofs: before accepting a new ballot, the sequencer checks that the corresponding \voteid path is still empty, and upon inclusion, the leaf is marked as used to prevent reuse. \\ + +%Figure~\ref{fig:mt-state} illustrates the structure of the state tree, showing the reserved slots for process parameters as well as the leaves used for ballots and vote identifiers. \begin{figure}[h] \centerline{\includegraphics[width=400pt,draft=false]{\figs/mt-state-mermaid}} - \caption{Structure of the state Merkle tree (FIGURE SHOULD BE udpated!).} + \caption{Structure of the state Merkle tree. The first leaves are reserved for global process parameters while subsequent leaves store encrypted ballots indexed by voter addresses and vote identifiers.} \label{fig:mt-state} \end{figure} -\textbf{The Initial State}: The voting process begins with an initial state where the Merkle Tree Root is established and published on the Process Management smart contract. Predefined parameters are included, but the results are initialized to zero, and no nullifiers are present. The Process Organizer transaction, contains the initial root and the necessary Merkle proofs. These proofs verify that the initial parameters are correct according to the voting process information and that no additional information is stored. Since the \processid of the initial state is a unique identifier, there won't be duplicate roots for different processes. +At the beginning of the election, the state tree is initialized with the process parameters and empty accumulators, and its root ($\stateroot$) is published on-chain. As the voting progresses, sequencers update the tree whenever new votes are received, producing a new root for each transition. To guarantee correctness, each update is accompanied by a ZK-SNARK proof attesting that the transition from the previous root to the new root respects all protocol constraints: ballots are well-formed and comply with the voting rules, voters are eligible according to the census, the \voteid non-membership condition prevents double voting (or overwrites are handled correctly), and encrypted results are aggregated consistently. In addition, sequencers reencrypt stored ciphertexts, including both newly submitted and already included ballots. This mechanism refreshes the randomness of the encrypted votes without altering their underlying content, ensuring receipt-freeness and concealing whether a particular ballot has been overwritten or simply re-randomized. +In this way, the state tree provides a compact and tamper-proof commitment to the current status of the election. At the end of the process, the final state root together with the on-chain verification of all transitions serves as a complete cryptographic record of the election, encapsulating both the tally and the integrity of the entire voting procedure. \subsection{Smart contracts} \label{sec:vocdoni-protocol:smart-contracts} An Ethereum compatible network is used as the source of truth for the voting system. By leveraging an Ethereum virutal machine (EVM) blockchain, the voting process management ensures that all transitions are immutable and verifiable by all participants. To this end, we implement the following three smart contracts. -\paragraph{Process management.} This smart contract is responsible for the life-cycle management of voting processes. It includes the initiation, monitoring, execution, and closure of voting events. +\paragraph{Process management smart contract.} It is responsible for the life-cycle management of voting processes. It includes the initiation, monitoring, execution, and closure of voting events. -\paragraph{Sequencer registry.} This smart contract keeps track of the existing available sequencers, stores the collateral of the sequencers to ensure (that incentivizes) good behaviour, and is used to coordinate the distributed key generation when a new voting process is created. +\paragraph{Sequencer registry smart contract.} It keeps track of the existing available sequencers, stores the collateral of the sequencers to ensure (that incentivizes) good behaviour, and is used to coordinate the distributed key generation when a new voting process is created. -\paragraph{Results verification.} For each voting process, this smart contract maintains the integrity of the cast votes and process life cycle. It verifies that each state transition committed by a sequencer adheres to the predefined rules.\\ +\paragraph{Results verification smart contract.} For each voting process, this smart contract maintains the integrity of the cast votes and process life cycle. It verifies that each state transition committed by a sequencer adheres to the predefined rules.\\ \subsection{Circuits} \label{sec:vocdoni-protocol:circuits} -\martai{The idea of this section is to describe the circuits. Then, in Section~\ref{sec:analysis:implementation} we give the details such as of the number of constants, framework used, etc. I haven't done this split yet.} - -\martai{\textbf{About the circuits: in practice (and for optimization), all public inputs $PI$ are private, and we produce a single public input $h = Hash(PI)$. Then, the verifier checks that $Hash(PI) = h$ and verifies the proof only against $h$.} For this, we use the MiMC-7 hash function. Since this is an implementation detail, I propose to write this as a footnote or as an introduction to this section.} - -\textit{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.} +At the core of \davinci lie a set of arithmetic circuits that enforce the correctness of every step of the voting process. 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 voter eligibility and census membership; the \emph{aggregation circuit} (Section~\ref{sec:vocdoni-protocol:circuits:aggregation}) combines multiple authenticated votes into a single proof; and the \emph{state transition circuit} (Section~\ref{sec:vocdoni-protocol:circuits:state-transition}) updates the global state root and produces the ZK-SNARK proof that is verified on-chain. The flow of these circuits and their interactions is shown in Figure~\ref{fig:circuits-flow}. \begin{figure}[h] \centerline{\includegraphics[width=\linewidth,draft=false]{\figs/circuits-flow-v2}} - \caption{Circuits flow.} + \caption{ + Overview of the circuit flow in \davinci.} \label{fig:circuits-flow} \end{figure} -\pagebreak +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 individually, we compute a single commitment $h = Hash(PI)$ and use $h$ as the only public input. The proof verifier then checks that $Hash(PI) = h$, ensuring that the original public inputs are consistent while reducing both proof size and verification cost. In \davinci, this commitment is computed using the MiMC-7 hash function {\color{blue}(use hlget to point "Hash" to MiMC-7)}. 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}. + +% 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} - -Figure~\ref{fig:circuit-voter} -- BN254.\\ +\label{sec:vocdoni-protocol:circuits:ballot} -\noi Generated by the user when casting a vote, this circuit proves that the encrypted ballot is valid (i.e. follows the protocol rules) and that the vote identifier is correctly computed. +The ballot circuit, 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 ZK proof generated using the 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. \begin{spacing}{1.25} \vspace{0.3cm}@@ -138,24 +129,21 @@ \textbf{Constraints}
\begin{itemize} \item \emph{Vote encryption}. Correct encryption of the ballot: $(C_1, C_2) = \hlget{\Enc}_{\epk}(\ballot; k).$ \item \emph{Protocol rules compliance}. The ballot meets the protocol rules (number of valid choices, etc.): $... + \weight$. - \item \emph{Vote identifier}. The vote's identifier is correctly computed: $\voteid = \text{Hash} (\processid \conc \address \conc k)$. + \item \emph{Vote identifier}. The vote's identifier is correctly computed: $\voteid = \text{Hash} (\processid \conc \address \conc k).$ \end{itemize} \vspace{-0.3cm} \end{spacing} \begin{figure}[H] - \centerline{\includegraphics[width=450pt,draft=false]{\figs/circuit-voter}} - \caption{Voter circuit. All public values are framed in green.} - \label{fig:circuit-voter} + \centerline{\includegraphics[width=420pt,draft=false]{\figs/circuit-voter}} + \caption{Ballot circuit. All public values are framed in green.} + \label{fig:circuit-ballot} \end{figure} -\newpage \subsubsection{Verifier circuit} -\label{sec:vocdoni-protocol:circuits:authentication} - -Figure~\ref{fig:circuit-authentication} -- BLS12-377.\\ +\label{sec:vocdoni-protocol:circuits:verifier} -\noi Generated by the sequencer, this circuit transforms the vote proof to the BLS12-377 curve for native recursion and validates the user's eligibility in the census, as well as their signature. +The verifier circuit, 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 it also validates the voter’s eligibility in the census 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}@@ -171,16 +159,19 @@ \item \public $\pk$: voter's public key.
\end{itemize} \textbf{Private inputs} \begin{itemize} - \item \private $\voteproof$: voter's proof. + \item \private $\ballotproof$: voter's ballot proof. \item \private $\weight$: voter's weight. \item \private $\censuspf$: census membership proof. \item \private $\signature$: voter's signature. \end{itemize} \textbf{Constraints} \begin{itemize} - \item \emph{Voter's proof verification.} The vote zkProof is valid for the inputs provided: $P.Verify().$ - \item \emph{Census membership.} The address derived from the user's public key is part of the census, and verifies the census proof with the user's weight provided. - \item \emph{Authentication + non-malleability.} The signature of the vote's identifier is valid for the given public key. + \item \emph{Voter's proof verification.} The vote zkProof is valid for the inputs provided: + $$\hlget{\PVerify}\left(\ballotproof, PI = (\processid, \ballotmode, \epk, (C_1, C_2), \voteid, \weight)\right).$$ + \item \emph{Census membership.} The address derived from the user's public key is part of the census, and verifies the census proof with the user's weight provided: + $$ \hlget{\censusTree}.\hlget{\MTMembershipProof}(\weight, \address = \hlget{\Keccak}(\pk), \censuspf, \censusroot). $$ + \item \emph{Authentication + non-malleability.} The signature of the vote's identifier is valid for the given public key: + $$ \hlget{\SVer}_{\pk}(\voteid, \signature). $$ \end{itemize} \vspace{-0.3cm} \end{spacing}@@ -188,19 +179,13 @@
\begin{figure}[H] \centerline{\includegraphics[width=450pt,draft=false]{\figs/circuit-authentication}} \caption{Authentication circuit. All public values are framed in green.} - \label{fig:circuit-authentication} + \label{fig:circuit-verifier} \end{figure} -\newpage \subsubsection{Aggregation circuit} +\label{sec:vocdoni-protocol:circuits:aggregation} -Figure~\ref{fig:circuit-aggregate} -- BW6-761.\\ - -\noi This circuit accumulates multiple authenticated votes into a single proof. It also verifies that all accumulated votes belong to the same voting process. - -\martai{Actually, the circuit only takes voteProof and the hash(PI). Circuit 4 is the one that verifies shared PI.} - -\martai{The batch, number of verification proofs, is a fixed parameter (currently set to 60). If it includes less proofs than the max size of the batch, the sequencer adds dummy proofs to the circuit.} +The aggregation circuit, 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 voting process. The batch size, 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 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. \begin{spacing}{1.25} \vspace{0.3cm}@@ -220,7 +205,8 @@ \item \private $\authenticationproof_i$: set of authentication proofs.
\end{itemize} \textbf{Constraints} \\ \vspace{-0.4cm} \begin{itemize} - \item \emph{Votes aggregation.} The accumulated authentication zkProofs are valid (for the given inputs). + \item \emph{Votes aggregation.} The accumulated authentication proofs are valid (for the given inputs). For every $i$: + $$\hlget{\PVerify}(\authenticationproof, PI = ((C_1, C_2)_i, \voteid_i, \pk_i, \processid, \ballotmode, EPK, \censusroot)).$$ \item \emph{Shared public inputs.} The public inputs \processid, \ballotmode, \epk, and \censusroot are the same for all proofs. \end{itemize} \vspace{-0.3cm}@@ -232,12 +218,12 @@ \caption{Aggregation circuit. All public values are framed in green.}
\label{fig:circuit-aggregate} \end{figure} -\newpage \subsubsection{State transition circuit} +\label{sec:vocdoni-protocol:circuits:state-transition} -Figure~\ref{fig:circuit-state-transition-v2} -- BN254. \\ +The state transition circuit, illustrated in Figure~\ref{fig:circuit-state-transition-v2}, is generated by the sequencer to update the global state of the voting process. 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, and that the accumulators of encrypted results are updated accordingly. 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 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. -\noi Given the aggregated votes proof, this circuit verifies the correct inclusion of all new votes into the process's state Merkle tree. It generates the final state transition proof that will be validated by the Ethereum smart contract. // This circuit verifies that a batch of votes correctly updates the global Merkle state root, including ballots, commitments, and results. It also verifies that the state transition corresponds to a valid proof aggregation and that overwritten votes are properly accounted for. +\pagebreak \paragraph{Assertions.}@@ -340,6 +326,8 @@ TBA.
\subsection{Protocol flow} \label{sec:vocdoni-protocol:flow} + +\martai{Rename steps: 1. voting setup, 2. encryption key generation, 3. votes collection, 4. results validation.} In Figure~\ref{fig:protocol-flow} we describe the protocol flow.