arnaucube
arnaucube/davinci-paperPublic Self-hosted repository
update name ballot protocol variables from figure
bellesmarta belles.mm@gmail.com
Wed, 27 Aug 2025 17:40:43 +0200
commit

074b4aa5248262d3fa49737d2c0e289532630a25

parent

a15ec4afb7537964e72f81eb90353e841d442b09

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

@@ -62,19 +62,22 @@

% \freefootnote{\scriptsize{Authors are listed in alphabetical order (\url{https://www.ams.org/profession/leaders/CultureStatement04.pdf}).}} \end{abstract} -{\color{blue} - -\noi Pieces of text marked in \textbf{blue} are heavily work in progress. Additionally, there are these general tasks left: +{\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 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? - \item Consider the scenario with deterministic signature (no Eth compatible) that can be used as nullifier. + \item Consider scenario where deterministic signature (no Eth compatible) can be used as nullifier. \item Do new circuit1 + circuit2. \item Do last results circuit. + \item Add citations. \end{itemize} -} +}}} \setcounter{tocdepth}{2} \makeatletter

@@ -119,7 +122,7 @@ \section{Ballot protocol}

\label{sec:ballot-protocol} \input{\secs/ballot-protocol} -\section{The Vocdoni token} +\section{Vocdoni token} %Protocol incentives \label{sec:token} \input{\secs/token}
A v2/figures/ballot-variables.drawio

@@ -0,0 +1,55 @@

+<mxfile host="app.diagrams.net" agent="Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:142.0) Gecko/20100101 Firefox/142.0" version="28.1.1"> + <diagram name="Copy of Page-1" id="s9rVSSMqwi_BMs1X_iMG"> + <mxGraphModel dx="706" dy="471" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="1100" pageHeight="850" math="0" shadow="0"> + <root> + <mxCell id="3pWEPM-DWOqgcgeheKjC-0" /> + <mxCell id="3pWEPM-DWOqgcgeheKjC-1" parent="3pWEPM-DWOqgcgeheKjC-0" /> + <mxCell id="0uB5nztOJnYtSxoqNcwR-5" value="" style="rounded=0;whiteSpace=wrap;html=1;" parent="3pWEPM-DWOqgcgeheKjC-1" vertex="1"> + <mxGeometry x="180" y="110" width="490" height="230" as="geometry" /> + </mxCell> + <mxCell id="3pWEPM-DWOqgcgeheKjC-2" value="&lt;ul&gt;&lt;li&gt;&lt;b&gt;&lt;font face=&quot;Courier New&quot;&gt;numFields&lt;/font&gt;&lt;/b&gt;: number of fields per ballot (in this case, &lt;font face=&quot;Courier New&quot;&gt;&lt;b&gt;numFields&lt;/b&gt;&lt;/font&gt; = 3).&lt;/li&gt;&lt;/ul&gt;" style="text;html=1;align=left;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="3pWEPM-DWOqgcgeheKjC-1" vertex="1"> + <mxGeometry x="170" y="170" width="490" height="30" as="geometry" /> + </mxCell> + <mxCell id="3pWEPM-DWOqgcgeheKjC-7" value="&lt;ul&gt;&lt;li&gt;&lt;b&gt;&lt;font face=&quot;Courier New&quot;&gt;minValue &lt;/font&gt;&lt;/b&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;lt;=&lt;/font&gt;&amp;nbsp; x, y, z&amp;nbsp; &lt;font face=&quot;Courier New&quot;&gt;&amp;lt;=&amp;nbsp;&lt;/font&gt;&lt;b&gt;&lt;font face=&quot;Courier New&quot;&gt;maxValue&lt;/font&gt;&lt;/b&gt;&lt;/li&gt;&lt;/ul&gt;" style="text;html=1;align=left;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="3pWEPM-DWOqgcgeheKjC-1" vertex="1"> + <mxGeometry x="170" y="250" width="269.5" height="30" as="geometry" /> + </mxCell> + <mxCell id="3pWEPM-DWOqgcgeheKjC-8" value="" style="group" parent="3pWEPM-DWOqgcgeheKjC-1" vertex="1" connectable="0"> + <mxGeometry x="170" y="288" width="520" height="32" as="geometry" /> + </mxCell> + <mxCell id="3pWEPM-DWOqgcgeheKjC-9" value="&lt;ul&gt;&lt;li&gt;&lt;b&gt;&lt;font face=&quot;Courier New&quot;&gt;minValueSum&amp;nbsp;&lt;/font&gt;&lt;/b&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;lt;=&lt;/font&gt;&amp;nbsp; x&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; + y&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; + z&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;font face=&quot;Courier New&quot;&gt;&amp;lt;=&lt;/font&gt;&lt;b&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;nbsp;maxValueSum&lt;/font&gt;&lt;/b&gt;&lt;/li&gt;&lt;/ul&gt;" style="text;html=1;align=left;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="3pWEPM-DWOqgcgeheKjC-8" vertex="1"> + <mxGeometry y="2" width="520" height="30" as="geometry" /> + </mxCell> + <mxCell id="3pWEPM-DWOqgcgeheKjC-10" value="&lt;b&gt;&lt;font face=&quot;Courier New&quot;&gt;costExponent&lt;/font&gt;&lt;/b&gt;" style="text;whiteSpace=wrap;html=1;fontSize=8;" parent="3pWEPM-DWOqgcgeheKjC-8" vertex="1"> + <mxGeometry x="154.25" y="1" width="65.75" height="20" as="geometry" /> + </mxCell> + <mxCell id="3pWEPM-DWOqgcgeheKjC-11" value="&lt;b&gt;&lt;font face=&quot;Courier New&quot;&gt;costExponent&lt;/font&gt;&lt;/b&gt;" style="text;whiteSpace=wrap;html=1;fontSize=8;" parent="3pWEPM-DWOqgcgeheKjC-8" vertex="1"> + <mxGeometry x="230" y="1" width="65.75" height="20" as="geometry" /> + </mxCell> + <mxCell id="3pWEPM-DWOqgcgeheKjC-12" value="&lt;b&gt;&lt;font face=&quot;Courier New&quot;&gt;costExponent&lt;/font&gt;&lt;/b&gt;" style="text;whiteSpace=wrap;html=1;fontSize=8;" parent="3pWEPM-DWOqgcgeheKjC-8" vertex="1"> + <mxGeometry x="307" width="65.75" height="20" as="geometry" /> + </mxCell> + <mxCell id="3pWEPM-DWOqgcgeheKjC-17" value="Ballot" style="text;html=1;align=left;verticalAlign=middle;whiteSpace=wrap;rounded=0;fontStyle=5;fontSize=14;" parent="3pWEPM-DWOqgcgeheKjC-1" vertex="1"> + <mxGeometry x="199.5" y="130" width="60.5" height="30" as="geometry" /> + </mxCell> + <mxCell id="0uB5nztOJnYtSxoqNcwR-0" value="x" style="rounded=0;whiteSpace=wrap;html=1;" parent="3pWEPM-DWOqgcgeheKjC-1" vertex="1"> + <mxGeometry x="260" y="130" width="40" height="30" as="geometry" /> + </mxCell> + <mxCell id="0uB5nztOJnYtSxoqNcwR-1" value="y" style="rounded=0;whiteSpace=wrap;html=1;" parent="3pWEPM-DWOqgcgeheKjC-1" vertex="1"> + <mxGeometry x="300" y="130" width="40" height="30" as="geometry" /> + </mxCell> + <mxCell id="0uB5nztOJnYtSxoqNcwR-2" value="z" style="rounded=0;whiteSpace=wrap;html=1;" parent="3pWEPM-DWOqgcgeheKjC-1" vertex="1"> + <mxGeometry x="340" y="130" width="40" height="30" as="geometry" /> + </mxCell> + <mxCell id="3pWEPM-DWOqgcgeheKjC-14" value="&lt;ul&gt;&lt;li&gt;&lt;b&gt;&lt;font face=&quot;Courier New&quot;&gt;uniqueValues =&amp;nbsp;&lt;/font&gt;&lt;/b&gt;&lt;/li&gt;&lt;/ul&gt;" style="text;html=1;align=left;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="3pWEPM-DWOqgcgeheKjC-1" vertex="1"> + <mxGeometry x="169.75" y="210" width="160" height="30" as="geometry" /> + </mxCell> + <mxCell id="3pWEPM-DWOqgcgeheKjC-15" value="&lt;div&gt;&lt;font face=&quot;Courier New&quot;&gt;&lt;b&gt;true &lt;/b&gt;&lt;/font&gt;&lt;font face=&quot;Helvetica&quot;&gt;: x, y, z must be different.&lt;/font&gt;&lt;/div&gt;&lt;div&gt;&lt;font face=&quot;Courier New&quot;&gt;&lt;b&gt;false &lt;/b&gt;&lt;/font&gt;&lt;font face=&quot;Helvetica&quot;&gt;: x, y, z can be different.&lt;/font&gt;&lt;/div&gt;" style="text;html=1;align=left;verticalAlign=middle;whiteSpace=wrap;rounded=0;spacingBottom=1;" parent="3pWEPM-DWOqgcgeheKjC-1" vertex="1"> + <mxGeometry x="338.25" y="210" width="211.75" height="30" as="geometry" /> + </mxCell> + <mxCell id="3pWEPM-DWOqgcgeheKjC-16" value="" style="shape=curlyBracket;whiteSpace=wrap;html=1;rounded=1;flipH=1;labelPosition=right;verticalLabelPosition=middle;align=left;verticalAlign=middle;size=0.5;rotation=-180;" parent="3pWEPM-DWOqgcgeheKjC-1" vertex="1"> + <mxGeometry x="324.25" y="210" width="10" height="30" as="geometry" /> + </mxCell> + </root> + </mxGraphModel> + </diagram> +</mxfile>
M v2/sections/ballot-protocol.tex → v2/sections/ballot-protocol.tex

@@ -4,15 +4,16 @@ 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. 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 Figure~\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. \item \maxvalue: the maximum value that each field in the ballot can take. \item \uniquevalues: a Boolean flag indicating whether all field values must be distinct (as in ranking systems). \item \costexponent: the exponent applied when computing the cost of casting votes in a field. This parameter enables quadratic or higher-order voting rules. - \item \minvaluesum: the minimum total sum of all field values in a ballot. - \item \maxvaluesum: the maximum total sum of all field values in a ballot (e.g., to enforce a budget of credits). + \item \minvaluesum: the minimum allowed total sum of a ballot, computed as $\sum_{i=1}^{\numfields} v_i^{\costexponent}$, + where $v_i$ are the field values. + \item \maxvaluesum: the maximum allowed total sum of a ballot, computed as $\sum_{i=1}^{\numfields} v_i^{\costexponent}$, where $v_i$ are the field values (e.g., to enforce a budget of credits). \end{itemize} %\begin{itemize} % \item \numfields: the maximum number of fields (i.e., options) in the ballot.

@@ -22,11 +23,12 @@ % \item \costexponent: the exponent applied when computing the cost of casting votes in a field; this parameter enables quadratic or higher-order voting rules.

% \item \minvaluesum, \maxvaluesum: bounds on the total sum of all field values in a ballot (e.g., to enforce a budget of credits). %\end{itemize} +\vspace{-0.5cm} \begin{figure}[H] \centering - \fbox{ - \includegraphics[scale = 0.4, draft = false]{\figs/ballot-variables.png}} - \caption{Schematic representation of the parameters that define a ballot in \davinci{ }{\color{blue}(variable names are outdated)}.} + \includegraphics[scale = 0.5, draft = false]{\figs/ballot-variables.png} + \caption{Schematic representation of the parameters that define a ballot in \davinci.} + \label{fig:ballot-variables} \end{figure} \vspace{-1cm}
M v2/sections/circuits.tex → v2/sections/circuits.tex

@@ -45,7 +45,7 @@ \vspace{-0.3cm}

\end{spacing} \begin{figure}[H] - \centerline{\includegraphics[width=420pt,draft=false]{\figs/circuit-voter}} + \centerline{\includegraphics[width=380pt,draft=false]{\figs/circuit-voter}} \caption{Ballot circuit. All public values are framed in green.} \label{fig:circuit-ballot} \end{figure}

@@ -123,7 +123,7 @@ \vspace{-0.3cm}

\end{spacing} \begin{figure}[h] - \centerline{\includegraphics[width=450pt,draft=false]{\figs/circuit-aggregate}} + \centerline{\includegraphics[width=400pt,draft=false]{\figs/circuit-aggregate}} \caption{Aggregation circuit. All public values are framed in green.} \label{fig:circuit-aggregate} \end{figure}
M v2/sections/cryptographic-primitives.tex → v2/sections/cryptographic-primitives.tex

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

% !TeX root = ../build/main.tex -In this section, we detail the cryptographic primitives used in Section~\ref{sec:vocdoni-protocol}. We briefly introduce elliptic curves, hash functions, Merkle trees, encryption schemes, and proof systems used in the protocol. We also specify at each step the concrete parameters with which each of the primitives is instantiated. +%hash-based commitments: trees +%authentication: signatures +%confidentiality: encryption +%decentralized trust: DKG +%verifiability: ZKPs + +In this section, we present the cryptographic primitives used in the protocol described in Section~\ref{sec:vocdoni-protocol}. We first introduce elliptic curves as the underlying algebraic setting, and then describe the following building blocks, each tied to a specific role in the system: hash functions and Merkle trees for commitments to structured data; digital signatures for voter authentication; encryption schemes for ballot confidentiality; distributed key generation (DKG) for decentralizing trust in the election keys; and zero-knowledge proofs (zkSNARKs) for verifiability of computations. For each primitive we also specify the concrete choice of parameters used. %\paragraph{Notation.} Throughout the document, we use the following conventions. Given a set $S$, we denote sampling an element $x$ uniformly at random from $S$ by $x \sample S$. We denote all bitstrings of arbitrary length by $\{0,1\}^*$. %Any group $\G$ used is of a large prime order, and we assume that the discrete logarithm problem is hard in $\G$. If two elements are denoted by the same letter in upper and lower case, e.g. $a, A$, this often means that $A$ is a public key corresponding to the secret key $a$.

@@ -177,6 +183,76 @@ %\label{sec:cryptographic-primitives:commitments}

%Pedersen commitment scheme~\cite{pedersen1991non}. +\subsection{Merkle trees} +\label{sec:cryptographic-primitives:merkle-trees} + +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, 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{\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} + +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{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 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 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} + \begin{itemize} + \item[$\bullet$] $\hlset{\SSign}_{\sk}(\msg \in \{0,1\}^\star)$: \vspace{0.1cm} + \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$. + \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} + \end{minipage} + \begin{minipage}[t]{0.54\textwidth} + \begin{itemize} + \item[$\bullet$] $\hlset{\SVer}_{\pk}(\msg \in \{0,1\}^\star, \sigma = (r, s)\in(\Z_q^*)^2)$: %\vspace{0.1cm} + \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$. + \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} + \end{itemize} + \end{minipage} +\end{mdframed} + \subsection{Encryption schemes} \label{sec:cryptographic-primitives:encryption}

@@ -241,56 +317,6 @@ \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 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 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} - \begin{itemize} - \item[$\bullet$] $\hlset{\SSign}_{\sk}(\msg \in \{0,1\}^\star)$: \vspace{0.1cm} - \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$. - \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} - \end{minipage} - \begin{minipage}[t]{0.54\textwidth} - \begin{itemize} - \item[$\bullet$] $\hlset{\SVer}_{\pk}(\msg \in \{0,1\}^\star, \sigma = (r, s)\in(\Z_q^*)^2)$: %\vspace{0.1cm} - \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$. - \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} - \end{itemize} - \end{minipage} -\end{mdframed} - \subsection{Key generation schemes} \label{sec:cryptographic-primitives:dkg}

@@ -359,30 +385,10 @@ \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 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, 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{\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} - -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} {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}(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 Figure~\ref{fig:circuits-flow}. +
M v2/sections/introduction.tex → v2/sections/introduction.tex

@@ -31,6 +31,8 @@

\subsection{Paper organization} \label{sec:introduction:organization} +%The rest of the paper is organized as follows. Section~\ref{sec:background} introduces the necessary background. Section~\ref{sec:protocol-intuition} provides a high-level overview of a voting process, omitting technical details for clarity. Section~\ref{sec:cryptographic-primitives} presents the cryptographic primitives used in the protocol, together with the concrete instantiations adopted in our design. Section~\ref{sec:vocdoni-protocol} describes the full voting process, while Section~\ref{sec:ballot-protocol} specifies the ballot protocol, whose rules are enforced by the process management smart contract. Section~\ref{sec:token} discusses the role of the Vocdoni token within the incentive structure of the system. Section~\ref{sec:analysis} analyzes the protocol, covering its security properties, implementation details, and performance evaluation. Finally, Section~\ref{sec:conclusions} concludes the paper with final remarks. + \begin{itemize} \item Section~\ref{sec:background}: background. \item Section~\ref{sec:protocol-intuition}: high overview of the election process. We omit technical details.

@@ -41,5 +43,3 @@ \item Section~\ref{sec:token}: the Vocdoni token.

\item Section~\ref{sec:analysis}: analysis of the proposed protocols. It includes a security discussion of the properties of the protocol, implementation details, and a performance evaluation. \item Section~\ref{sec:conclusions}: we finish with some last remarks. \end{itemize} - -%Mention that the spec can be tailored to the needs of the specific vote. So, here we present some default configuration, but some of the pieces can be changed (specially the cryptographic schemes or curves). For this reason, we tried to make this document modular (like the code), to facilitate the changes and analysis.