% !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. \subsection{Parties involved} \label{sec:vocdoni-protocol:parties} A voting process involves three types of participants: the organizer, the sequencer, and the voters. \paragraph{Organizer.} The organizer is the entity responsible for defining and setting up the voting process. Its key responsibilities include defining the voting parameters and gathering the census data. The organizer ensures that the election is structured correctly but does not participate in vote collection or tallying. \paragraph{Sequencer.} Sequencers are a set of decentralized parties that facilitate the voting process. On the one hand, they collaboratively generate a public encryption key that voters use to encrypt their votes. Then, during the voting phase, they receive and verify encrypted votes from voters and reencrypt votes to prevent coercion. %Old text: the Sequencer is a specialized component designed to handle the voting process using zero-knowledge proof mechanisms. It ensures that all transactions related to this process are validated and sequenced. The Sequencers periodically commit the state of the voting process to Ethereum. \paragraph{Voter.} Voters are the participants that belong the census that cast their votes in the election. \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. %\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} 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 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!!} \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.} \martai{One way to think about it: (weight, pk).} \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: \begin{itemize} \item Address \texttt{0x0}: it stores \processid, a unique identifier for the voting process. \item Address \texttt{0x1}: it stores \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. That is, the aggregated encrypted voting results that need to be added. \item Address \texttt{0x5}: it stores the \substractaccumulator. That is, it stores the aggregated encrypted voting results that need to be subtracted. \item Any address: 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). \item \textbf{voteIDs??} \end{itemize} \begin{figure}[h] \centerline{\includegraphics[width=400pt,draft=false]{\figs/mt-state-mermaid}} \caption{Structure of the state Merkle tree (FIGURE SHOULD BE udpated!).} \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. \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{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{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.\\ \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.} \martai{I don't follow the above paragraph.} \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{It's convenient to name the proof associated to each circuit: a proof for this circuit is called [...].\\ Answer: 1. ballotProof, 2. voteVerifier, 3. aggregator, 4. stateTransition.} \begin{figure}[h] \centerline{\includegraphics[width=350pt,draft=false]{\figs/circuits-flow}} \caption{Circuits flow.} \label{fig:circuits-flow} \end{figure} \pagebreak \subsubsection{Ballot circuit} Figure~\ref{fig:circuit-voter} -- BN254.\\ \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. \begin{spacing}{1.25} \vspace{0.3cm} \noi \textbf{Public inputs} \begin{itemize} \item $\public$ $\processid$: voting process identifier. \item $\public$ $\ballotmode$: ballot protocol configuration.S \item $\public$ $\epk$ ($EPK$): encryption public key. \item $\public$ $\address$: voter's address. \item $\public$ $\weight$: voter's weight. \item $\public$ $(C_1, C_2)$: encrypted ballot. \item $\public$ $\voteid$: vote's unique identifier. \end{itemize} \textbf{Private inputs} \begin{itemize} \item \private $\ballot$: plaintext voter's voting choice. \item \private $k$: random scalar. \end{itemize} \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)$. \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} \end{figure} \newpage \subsubsection{Verifier circuit} \label{sec:vocdoni-protocol:circuits:authentication} Figure~\ref{fig:circuit-authentication} -- BLS12-377.\\ \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. \begin{spacing}{1.25} \vspace{0.3cm} \noi \textbf{Public inputs} \begin{itemize} \item \public $\processid$: process identifier. \item \public $\ballotmode$: ballot protocol configuration. \item \public $\epk$ ($EPK$): encryption public key. \item \public $(C_1, C_2)$: encrypted ballot. \item \public $\voteid$: voter's identifier. \item \public $\censusroot$: census Merkle tree root. \item \public $\pk$: voter's public key. \end{itemize} \textbf{Private inputs} \begin{itemize} \item \private $\voteproof$: voter's 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. \end{itemize} \vspace{-0.3cm} \end{spacing} \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} \end{figure} \newpage \subsubsection{Aggregation circuit} 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.} \begin{spacing}{1.25} \vspace{0.3cm} \noi \textbf{Public inputs} \begin{itemize} \item \public $(C_1, C_2)_i$: list of voters' encrypted ballots. \item \public $\voteid_i$: set of vote's identifiers. \item \public $\pk_i$: list of voters' public keys. \item \public $\processid$: process identifier. \item \public $\ballotmode$: ballot protocol configuration. \item \public $EPK$: encryption public key. \item \public $\censusroot$: census Merkle tree root. \end{itemize} \textbf{Private inputs} \begin{itemize} \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{Shared public inputs.} The public inputs \processid, \ballotmode, \epk, and \censusroot are the same for all proofs. \end{itemize} \vspace{-0.3cm} \end{spacing} \begin{figure}[h] \centerline{\includegraphics[width=450pt,draft=false]{\figs/circuit-aggregate}} \caption{Aggregation circuit. All public values are framed in green.} \label{fig:circuit-aggregate} \end{figure} \newpage \subsubsection{State transition circuit} Figure~\ref{fig:circuit-state-transition-v2} -- BN254. \\ \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. \paragraph{Assertions.} \begin{itemize} \item \emph{Aggregation verification}: The agreggated zkProof is valid. \item \emph{Transition verification}: The MerkleTree transition witness proves every change between Root1 and Root2. \item \emph{Public inputs integrity}: ProcessID, BallotMode, CensusRoot, EncryptionKey remain unchanged. \item \emph{Votes counting}: Ballots are correctly counted as new or overwrites, and added to results accumulators. \end{itemize} When a new voting process begins, the Sequencer initializes a new State, represented by the root hash of a Merkle tree. This tree encapsulates all essential information about the voting process, including process parameters, voter registry (census), ballot configurations, and initial results. For each new batch of votes, the Sequencer updates the state by generating a zkSNARK proof that \textbf{validates the state transition from the current Root to a new Root}. This proof is submitted on-chain for settlement. By doing so, we maintain an immutable and verifiable record of the voting process on the blockchain. This approach allows anyone to access the latest verified state of the voting process from the Results Verification smart contract, along with the necessary data to process subsequent state updates. The system's design enables multiple Sequencers to participate in tallying votes. They can take the current State Root and its associated data to construct the next state, incorporating new votes into the tally. This decentralization of Sequencers helps prevent potential censorship and reinforces the robustness of the voting process. \paragraph{Maintaining the Chain.} The chain of integrity is maintained through a combination of smart contract enforcement and strict zkSNARK circuit constraints. This ensures that each state transition is valid and builds upon the last accepted state without requiring additional mechanisms. \begin{itemize} \item \textbf{Sequential state roots}: Each state transition updates the Merkle tree from a previous root (`Root1`) to a new root (`Root2`) after processing a batch of votes. \item \textbf{Smart contract enforcement}: The smart contract verifies that the `Root1` provided in the zkSNARK proof matches the last committed state root stored on-chain. This guarantees that all transitions are sequential and based on the latest accepted state. \item \textbf{Proof validation}: The smart contract uses the zkSNARK verification key to validate the submitted proof. A valid proof confirms that the transition from `Root1` to `Root2` adheres to all protocol rules enforced by the circuit. \item \textbf{State update}: Upon successful verification, the smart contract updates the stored state root hash to`Root2`, ensuring an immutable and continuous chain of states. \end{itemize} \paragraph{State Transition} To validate and process state transitions, \textbf{we employ a zkSNARK circuit that enforces all protocol constraints}. This circuit proves that the transition from the previous state Root to the new state Root is valid based on the newly processed votes. \begin{figure}[H] \centering \fbox{ \includegraphics[scale = 0.12, draft = false]{\figs/state-transition.png}} \end{figure} %\begin{figure}[H] % \centering % \fbox{ % \includegraphics[scale = 0.3, draft = false]{\figs/circuit-inputs.png}} %\end{figure} % %\begin{figure}[H] % \centerline{\includegraphics[width=400pt,draft=false]{\figs/circuit-state-transition}} % \caption{State transition circuit. All public values are framed in green.} % \label{fig:circuit-state-transition} %\end{figure} \begin{mdframed} \begin{minipage}[H]{1\textwidth} \begin{spacing}{1.25} \vspace{0.3cm} \begin{center}{STATE TRANSITION CIRCUIT}\end{center} \textbf{Public inputs} \begin{itemize} \item \public $root_{old}$: Merkle tree root before the state transition. \item \public $root_{new}$: Meklre tree root after the state transition. \item \public $blobCommitment$: the commitment to the data blob containing the new votes. \end{itemize} \item \textbf{Private inputs} \begin{itemize} \item \private Votes: The list of new votes being processed, including census proofs and authentication data. \item \private Merkle Proofs of nullifier inclusion: Proofs that each voter nullifier is included in the census. \item \private Merkle Proofs of results update: Proofs that the process results have been correctly updated. \item \private Merkle Tree Update Witnesses: Necessary data (e.g., Merkle paths) to update the Merkle tree from Root1 to Root2. \item \private Process Parameters: Retrieved from Root1 within the circuit. \end{itemize} \textbf{Constraints} \\ \vspace{-0.4cm} \begin{itemize} \item \textbf{Immutable process parameters}: Ensure that critical process parameters (such as `censusRoot` or `processId`) retrieved from `Root1` remain consistent and are not altered in the transition. \item \textbf{Vote validity}: Validate that each vote proof is correct. \item \textbf{Voter eligibility}: Confirm that each voter is included in the census by verifying Merkle proofs of inclusion against the `censusRoot` retrieved from `Root1`. \item \textbf{Nullifier non-existence}: Ensure that the nullifier for each vote does not exist in the current state (`Root1`), preventing double voting. \item \textbf{Nullifier addition}: Correctly add each new nullifier to the state, resulting in `Root2`, updating the Merkle tree accordingly. \item \textbf{Results update}: Ensure that the voting results are accurately updated by adding the new votes to the previous results retrieved from `Root1`, so that `results2 = results1 + votes`. \item \textbf{Blob data integrity}: Confirm that the data used in the circuit (votes, nullifiers) corresponds to the `blobCommitment` provided as a public input, ensuring that the votes processed are exactly those published in the data blob. \item \textbf{State transition validity}: Ensure that the new state root (`Root2`) is correctly computed from `Root1` by applying the validated votes and updates to the Merkle tree. \end{itemize} \vspace{-0.3cm} \end{spacing} \end{minipage} \end{mdframed} \martai{STATE TRANSITION CIRCUIT: a potential problem is that a sequencer may know if one of their votes has been overwritten, for this reason, sequencers reencrypt a certain amount of ballots every time (already existing ballots I mean). So, the circuit should include the reencryptions: both for existing ballots and also for the new votes, which should be reencrypted (for receipt-freeness).} \begin{landscape} %\thispagestyle{empty} % removes the page number \begin{figure}[H] \centerline{\includegraphics[width=560pt,draft=false]{\figs/circuit-state-transition-v2}} \caption{State transition circuit. All public values are framed in green.} \label{fig:circuit-state-transition-v2} \end{figure} \end{landscape} \subsubsection{Results circuit} \label{sec:vocdoni-protocol:circuits:results} TBA. \subsection{Protocol flow} \label{sec:vocdoni-protocol:flow} In Figure~\ref{fig:protocol-flow} we describe the protocol flow. \begin{figure}%[H] \centerline{\includegraphics[width=370pt,draft=false]{\figs/protocol-flow}} \caption{Vocdoni voting process overview.} \label{fig:protocol-flow} \end{figure} \subsubsection{Prior to voting (only once)} \label{sec:vocdoni-protocol:prior-steps} %\martai{Remove the first step, we assume contracts are already deployed or at least, the logic is available.} % %This is done only once. Then every voting will start its process from step in Section~\ref{sec:vocdoni-protocol:start}. % %Vocdoni: %\begin{enumerate} % \item Deployment of the 3 smart contracts. % \item Sequencers registry starts (it doesn't end). %\end{enumerate} \sequencers -- this process is always open: \begin{enumerate} \item Register this and that way. \item Public keys? Sequencers must also publish how they can be reached (either when they register or when they contribute to the DKG). They can use a URI: Uniform Resource Identifier. \item PROVIDE COLLATERAL. What happens to the collateral? If done only once, then you lose it? Do you need to send a new tx with more collateral? \item Send transaction to Sequencer registry smart contract (pay for tx fee). \end{enumerate} \subsubsection{Start of the voting process} \label{sec:vocdoni-protocol:start} \organizer \begin{enumerate} \item Prepares the census data \censusdata and generates census Merkle tree. \item Generates the census commitment: $\censusroot = \hlget{\MTRoot}()$. \martai{Additionally, after this step, the organizer should make a Merkle proof available to all eligible voters.} \item Set voting details: {\color{blue}duration, options, type, etc. + CENSUS MT ROOT.} \item Compute the process identifier \processid, which is a unique 32-byte number derived from the organizer's Ethereum address and nonce, and the chain ID. %that uniquely identifies a specific voting process. This variable encapsulates essential information about the voting, such as the rules and constraints for ballots and the unique identifier of the \davinci blockchain instance. \item Set security factors for DKG: a timeout for the DKG ceremony + minimum number of sequencers. \item Send transaction to the Ethereum process management smart contract with all data. Note this transaction has a cost (Eth tx fees) that needs to be covered by the organizer. The transaction includes the fields: \[\processid, etc.\] \end{enumerate} \subsubsection{Encryption key generation process} %Voting key generation \label{sec:vocdoni-protocol:dkg} \sequencers \begin{enumerate} \item Fetch the \processid, \ballotmode, and \censusroot from the process management smart contract. \item Make contributions to DKG ceremony before the timeout set by the organizer. \end{enumerate} \noi After the timeout, all contributions to DKG are done. The smart contract checks if minimum number of sequencers is reached. If so, the \epk ``becomes available". \martai{The idea here is that some sequencer makes EPK available (a.k.a. sends a transaction). Alternatively, generate a SNARK proving the EPK has been generated correctly and the SC verifies it. It is not clear to me if it is sent to SR or PM. } \subsubsection{Voting process} \label{sec:vocdoni-protocol:voting} \voter \begin{itemize} \item Choose any of the available sequencers from the sequencer registry smart contract. \item Fetch from the census registry their membership proof $\censusproof$ to prove eligibility. \item Collect %the process data the $\epk$, $\ballotmode$, $\processid$ from the process management smart contract. \item Select their voting choice $\ballot$ according to the election rules specified by the $\ballotmode$ parameter. \item Sample a fresh random $k \in \F$ and encrypt the selected choice using the public key $\epk$: \begin{equation} \label{eq-ciphertext} (C_1, C_2) = \hlget{\Enc}_{\epk}(\ballot; k). \end{equation} \item Use the user's own Ethereum address $\address$ and the previous $k$ to compute the $\voteid$: \begin{equation} \label{eq-voteid} \voteid = \hlget{\Multimimc}(\processid \conc \address \conc k). \end{equation} \item Generate ZK-SNARK of satisfiability of circuit from Fig.~\ref{fig:circuit-voter} with the proof system from Section~\ref{sec:cryptographic-primitives:zkp} to prove that Eqs.~\labelcref{eq-ciphertext,eq-voteid} are correctly computed, and that $\ballot$ satisfies ballot protocol rules according to $\ballotmode$. \[ \voteproof = \text{Prove(), Circuit()}.\] \item Sign $\voteid$ using the user's secret key $\sk$ to authenticates the vote and ensure that was cast by a legitimate voter: \[ \signature = \hlget{\SSign}_{\sk}(\voteid).\] \item Send the following data, which includes the encrypted vote, census membership proof, signature and vote proof, to the selected sequencer: \[ \vote = [ \processid, \voteid, \encryptedballot, \censuspf, \voteproof, \signature ]. \] \end{itemize} \martai{\\ 1. Add as a footnote that the address is not send because it can be recomputed from the signature.\\ 2. In the code, they call it \textit{vote}, \textit{verifierVote}. Alternative: \textit{envelope}.} \noi \sequencers \begin{itemize} \item Fetch current state: retrieve the current valid process state root from the process management smart contract and the associated data from Ethereum blobs. \item Generate a SK-SNARK proof of state transition proving: \begin{itemize} \item the validity of the ZK-SNARK proof provided by the voter, \item the correct accumulation of votes from users, adding them to the process state, \item the correct sum of the new encrypted votes using the homomorphic properties of ElGamal, \item the new votes are from eligible users by checking the census Merkle proofs, \item the new voters have not already voted by checking their nullifiers, or it is a correct vote overwrite, \item the data blob hash matches the data used to verify the transition. \end{itemize} \item Submit updated state: send the new state root to the smart contract and store the updated data in Ethereum blobs. \end{itemize} Sequencers keep accumulating votes and create state transition until the finalization of the process. \martai{I understand this finalization is a deadline set by the organizer.} SC: \begin{itemize} \item Upon receiving a sequencer's transaction, the SC verifies the zk-SNARK proof provided byt he sequencer. \item Ensure the origin root corresponds to the current stored state root. \item Confirm that the blob hash matches the one stored in Ethereum. \end{itemize} \subsubsection{Results validation} \label{sec:vocdoni-protocol:validation} Once the voting is completed (I understand the timeout set by the organizer expires), the following things happen. \noi \sequencers \begin{itemize} \item $t$ out of $n$ sequencers publish their shares corresponding to the EPK to the Ethereum smart contract. \martai{specify which SC.} \item When the threshold of shares is reached, the results can be decrypted by anyone. \martai{mention that the SC computes the corresponding ESK, or that can be computed by anyone off-chain, since all info is public.} \item Sequencers receive reward for their correct participants depending on the number of sequenced votes. \martai{slash if they don't provide the right share? reward only dependent of sequenced votes? any relation to their participation in the computation of either EPK or ESK?} \end{itemize} This way: \begin{itemize} \item After the voting period ends and the results are decrypted, anyone can verify the correctness of the final result. \martai{explain how.} \item Use the zkSNARK state proof and publicly available data on-chain to ensure the integrity and correctness of the entire voting process. \martai{elaborate on this.} \end{itemize} \subsubsection{Finalization of the voting process} \label{sec:vocdoni-protocol:finalization}