arnaucube
arnaucube/davinci-paperPublic Self-hosted repository
davinci-paper/v2/sections/vocdoni-protocol.tex
v2/sections/vocdoni-protocol.texRaw
  1% !TeX root = ../build/main.tex
  2
  3\martai{Is the process called voting? Election, poll?}
  4
  5\subsection{Parties involved}
  6\label{sec:vocdoni-protocol:parties}
  7
  8A voting process involves three types of participants: the organizer, the sequencer, and the voters.
  9
 10\paragraph{Organizer.} The organizer is the entity reposnible 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.
 11
 12\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.
 13 
 14\paragraph{Voter.} Voters are the participants that belong the census that cast their votes in the election. 
 15
 16\subsection{Components}
 17\label{sec:vocdoni-protocol:components}
 18
 19\subsubsection{Merkle trees} 
 20
 21\textit{Old text: Merkle trees are employed to create a cryptographic representation of both the voter registry (census) and the voting process state:
 22	\begin{itemize}
 23		\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.
 24		\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. 
 25\end{itemize}}
 26
 27\paragraph{Census Merkle tree.} Explain what it is. \\
 28
 29\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.}
 30
 31\paragraph{State Merkle tree.} Explain what it is and the structure. Below, the original text:\\
 32
 33The State tree contains some special addresses (indices) for storing some required data regarding the voting process:
 34
 35\begin{itemize}
 36	\item Address \texttt{0x0}: Process identifier: stores a unique identifier for the voting process.
 37	\item Address \texttt{0x1}: Census Root and Type: contains the information necessary to validate vote proofs.
 38	\item Address \texttt{0x2}: Ballot Mode: encodes rules for validating votes, such as the maximum number of selectable options.
 39	\item Address \texttt{0x3}: Threshold Encryption key: the public key used to encrypt the votes.
 40	\item Address \texttt{0x4}: Added Results Accumulator: stores the aggregated encrypted voting results that need to be added.
 41	\item Address \texttt{0x5}: Subtract Results Accumulator: stores the aggregated encrypted voting results that need to be subtracted.
 42	\item Any address: vote addresses: are stored within the State tree pointing to a voter's identity commitment. Each commitment is a 32-byte hash derived from the voter's unique information and a secret.
 43	\item Any address: vote nullifiers: are stored within the State tree to prevent double voting and to allow vote overwrite. Each nullifier is a 32-byte hash derived from the voter's commitment and a secret.
 44\end{itemize}
 45
 46\begin{figure}[h]
 47	\centerline{\includegraphics[width=400pt,draft=false]{\figs/mt-state}}
 48	\caption{Structure of the state Merkle tree (FIGURE SHOULD BE POLISHED).}
 49	\label{fig:mt-state}
 50\end{figure}
 51
 52\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.
 53
 54
 55\subsubsection{Smart contracts}
 56
 57\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.
 58
 59\paragraph{Sequencer registry.} 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.
 60
 61\paragraph{Results verification.} 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.\\
 62
 63\martai{This is wrong. Explanation of SR and RV smart contracts are mixed, I don't know what I was thinking when I wrote it. We should also include a sentence about the management of sequencers.}
 64
 65
 66\begin{figure}[h]
 67	\centerline{\includegraphics[width=400pt,draft=false]{\figs/circuit-inputs}}
 68	\caption{Caption.}
 69	\label{fig:circuit-inputs}
 70\end{figure}
 71
 72
 73\subsubsection{Votes [I don't think this is the right place]}
 74
 75In the Vocdoni Z system, a vote comprises several components that work together to ensure secure, private, and verifiable voting. These components are:
 76
 77\begin{enumerate}
 78	\item Process Identifier
 79	\item Census Proof
 80	\item Identity Commitment
 81	\item Nullifier
 82	\item Encrypted Ballot and Zero-Knowledge Proof (ZKP)
 83	\item Signature	
 84\end{enumerate}
 85
 86Below, we detail each component and its role in the voting process.
 87
 88\begin{enumerate}
 89	\item \textbf{Process Identifier} \\
 90	
 91	The \textbf{Process Identifier} (\texttt{ProcessId}) is a unique 32-byte number that uniquely identifies a specific voting process within the Vocdoni Z ecosystem. It encapsulates essential information, including the rules and constraints for ballots and the unique identifier of the Vocdoni Z blockchain instance.\\
 92	
 93	\item \textbf{Census Proof} \\
 94	
 95	The \textbf{Census Proof} serves as the voter's identity verification mechanism, ensuring that only eligible voters can participate. Depending on the process configuration, the voter provides:
 96	\begin{itemize}
 97		\item \textbf{Merkle Tree-Based Proof}: A Merkle proof showing inclusion in the census.
 98		\item \textbf{Credential Service Provider (CSP)}: A credential issued by a trusted third party. \\
 99	\end{itemize}
100	
101	\item \textbf{Identity Commitment}\\
102	
103	The \textbf{Commitment} $C$ is used to prevent a voter from registering multiple nullifiers and to avoid collisions if different voters choose the same secret.
104	
105	$$ C = \text{Hash} (\text{Address} || ProcessId || s). $$
106	
107	\begin{itemize}
108		\item \textbf{Stored in State Merkle Tree (SMT)}: Indexed by the voter's address.
109		\item \textbf{Prevents Multiple Registrations}: Each address can have only one commitment, ensuring a voter cannot register multiple secrets.
110		\item \textbf{Collision Resistance}: Including the address in $C$ ensures that commitments are unique even if voters choose the same secret $s$.
111	\end{itemize}
112	
113	The secret $s$ can be implemented from different ways or a combination of them, such as:
114	
115	\begin{itemize}
116		\item A secure enough Password introduced by the user.
117		\item A signature of a specific text.
118		\item A random input that the user must store to allow potential vote overwrite.\\
119	\end{itemize}
120	
121	\item \textbf{Nullifier} \\
122	
123	The \textbf{Nullifier} $N$ is a 32-byte hash used to:
124	
125	\begin{itemize}
126		\item \textbf{Prevent Double Voting}: Ensures each voter can cast only one vote or overwrite their previous vote.
127		\item \textbf{Allow Vote Overwriting}: Voters can submit a new vote with the same nullifier to replace their previous vote.
128		\item \textbf{Provide Anonymity}: Cannot be linked back to the voter's identity without knowledge of the secret $s$.
129	\end{itemize}
130	
131	$$ N = \text{Hash}(\text{C} || s) $$ 
132	
133	\item \textbf{Encrypted Ballot and Zero-Knowledge Proof (ZKP)} \\
134	
135	The ballot contains the voter's selections encoded according to the ballot protocol rules. To ensure privacy, the ballot is encrypted using the ElGamal cryptosystem over elliptic curves, which allows homomorphic combination of encrypted votes.
136	
137	\textbf{Encryption process}:
138	
139	\begin{itemize}
140		\item The voter's choice $m$ is encoded as a point on the elliptic curve.
141		\item The voter selects a random scalar $k \in [1, n-1]$, where is the order of the elliptic curve group.
142		\item Compute the ciphertext components:
143		\begin{itemize}
144			\item $C_1 = k \cdot G$
145			\item $C_2 = M + k \cdot H$
146		\end{itemize}
147		\item The ciphertext is the pair $(C_1, C_2)$.
148	\end{itemize}
149	
150	
151	\textbf{Zero-Knowledge Proof (ZKP)}:
152	
153	The voter generates a ZKP to prove the correctness of the ballot and encryption process:
154	
155	\begin{enumerate}
156		\item \textbf{Correctness of Encryption}: Ensures the ciphertext $(C_1, C_2)$ is correctly computed from the plaintext message $M$ and random scalar $k$.
157		\item \textbf{Compliance with Ballot Protocol Rules}: The plaintext vote adheres to the ballot protocol constraints, such as valid choices and allowed number of selections.
158		\item \textbf{Correct Computation of Commitment and Nullifier}:
159		\begin{itemize}
160			\item \textbf{Commitment}: $C = \text{Hash} (\text{Address} || ProcessId || s).$
161			\item \textbf{Nullifier}: $N = \text{Hash}(\text{C} || s)$.
162			\item The voter knows the secret linking the commitment and nullifier.
163		\end{itemize}
164	\end{enumerate}
165	
166	\textbf{Inputs to the ZKP Circuit}:
167	
168	\begin{itemize}
169		\item \textbf{Public Inputs}:
170		\begin{itemize}
171			\item Encrypted Ballot $(C_1, C_2)$.
172			\item Ballot Protocol Configuration.
173			\item Encryption Parameters.
174			\item Voter's Weight
175			\item Commitment $C$.
176			\item Nullifier $N$.
177		\end{itemize}
178		\item \textbf{Private Inputs}:
179		\begin{itemize}
180			\item Plaintext Vote $m$.
181			\item Secret $s$.
182			\item Random Scalar $k$.
183			\item Voter's Address (used internally in the computation of $C$).
184		\end{itemize}
185	\end{itemize}
186	
187	\begin{figure}[H]
188		\centering
189		\fbox{
190			\includegraphics[scale = 0.3, draft = false]{\figs/vote-circuit-inputs.png}}
191	\end{figure}
192	
193	\item \textbf{Signature}\\
194	
195	The \textbf{Signature} authenticates the vote and ensures that it was cast by a legitimate voter. The voter signs necessary components using their private key, depending on the census configuration (e.g., ECDSA, EdDSA, RSA).	
196\end{enumerate}
197
198
199\subsection{Circuits}
200\label{sec:vocdoni-protocol:circuits}
201
202\martai{The idea of this section is to describe de 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.}
203
204\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.}
205
206\martai{I don't follow the above paragraph.}
207
208
209\martai{NOTATION (1) What I name \texttt{config}, is called \texttt{Ballot Mode}, and (2) \texttt{MT root} is \texttt{census root}.}
210
211\martai{It's convenient to name the proof associated to each circuit: a proof for this circuit is called [...] .}
212
213\subsubsection{Voter circuit}
214
215Figure~\ref{fig:circuit-voter}.
216
217\paragraph{Description.} 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 nullifier and commitment are correctly generated.
218
219\begin{itemize}
220	\item Constraints: Approximately 53.000
221	\item Curve: BN254
222	\item Framework: Circom/SnarkJS
223	\item Actor: User
224\end{itemize}
225
226\paragraph{Assertions.}
227
228\begin{itemize}
229	\item \emph{Rules compliance}: The ballots meets the ballot mode provided following the protocol rules.
230	\item \emph{Vote encryption}: The ballots encryption is correct.
231	\item \emph{Vote commitment + nullification}: The nullifier and commitments are correctly computed.
232\end{itemize}
233
234\begin{figure}[h]
235	\centerline{\includegraphics[width=400pt,draft=false]{\figs/voter-circuit}}
236	\caption{Voter circuit. All public values are framed in green.}
237	\label{fig:circuit-voter}
238\end{figure}
239
240\subsubsection{Authentication circuit}
241
242Figure~\ref{fig:circuit-authentication}.
243
244\paragraph{Description.} 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.
245
246\begin{itemize}
247	\item Constraints: Approximately 3.1 million
248	\item Curve: BLS12-377
249	\item Framework: Gnark
250	\item Actor: Sequencer
251\end{itemize}
252
253\paragraph{Assertions.}
254
255\begin{itemize}
256	\item \emph{Voter's proof verification}: The vote zkProof is valid for the inputs provided.
257	\item \emph{Authentication + non-malleability}: The signature of the inputs provided is valid for the public key of the voter.
258	\item \emph{Census membership}: The address derived from the user public key is part of the census, and verifies the census proof with the user weight provided.
259\end{itemize}
260
261\begin{figure}[h]
262	\centerline{\includegraphics[width=400pt,draft=false]{\figs/circuit-authentication}}
263	\caption{Authentication circuit. All public values are framed in green.}
264	\label{fig:circuit-authentication}
265\end{figure}
266
267\subsubsection{Aggregation circuit}
268
269Figure~\ref{fig:circuit-aggregate}.
270
271\paragraph{Description.} This circuit accumulates multiple authenticated votes into a single proof. It also verifies that all accumulated votes belong to the same voting process.
272
273\begin{itemize}
274	\item Constraints: 40.000 $\times$ (number of votes)
275	\item Curve: BW6-761
276	\item Framework: Gnark
277	\item Actor: Sequencer
278\end{itemize}
279
280\paragraph{Assertions.}
281
282\begin{itemize}
283	\item \emph{Votes aggregation}: The accumulated zkProofs are valid.
284	\item \emph{Shared public inputs}: The ProcessId, CensusRoot, BallotMode and EPK is the same for all of them.
285\end{itemize}
286
287\begin{figure}[h]
288	\centerline{\includegraphics[width=400pt,draft=false]{\figs/circuit-aggregate}}
289	\caption{Aggregation circuit. All public values are framed in green.}
290	\label{fig:circuit-aggregate}
291\end{figure}
292
293
294\subsubsection{State transition circuit}
295
296\paragraph{Description.} 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.
297
298\begin{itemize}
299	\item Constraints: Approximately 4 million
300	\item Curve: BN254
301	\item Framework: Gnark
302	\item Actor: Sequencer
303\end{itemize}
304
305\paragraph{Assertions.}
306
307\begin{itemize}
308	\item \emph{Aggregation verification}: The agreggated zkProof is valid.
309	\item \emph{Transition verification}: The MerkleTree transition witness proves every change between Root1 and Root2.
310	\item \emph{Public inputs integrity}: ProcessID, BallotMode, CensusRoot, EncryptionKey remain unchanged.
311	\item \emph{Votes counting}: Ballots are correctly counted as new or overwrites, and added to results accumulators.
312\end{itemize}
313
314\martai{The corresponding circuit figure is not done yet.}
315
316\noi \textit{Old original text, I think it will help here:}
317
318When 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.
319
320For 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.
321
322This 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.
323
324\paragraph{Maintaining the Chain.}
325
326The 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.
327
328\begin{itemize}
329	\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.
330	\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.
331	\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.
332	\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.
333\end{itemize}
334
335\paragraph{State Transition}
336
337To 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.
338
339\begin{figure}[H]
340	\centering
341	\fbox{
342		\includegraphics[scale = 0.12, draft = false]{\figs/state-transition.png}}
343\end{figure}
344
345The circuit have the following inputs (the public ones are required to verify the proof).
346
347\begin{itemize}
348	\item \textbf{Public Inputs:}
349	\begin{itemize}
350		\item Previous State Root (Root1): The Merkle tree root before the state transition.
351		\item New State Root (Root2): The Merkle tree root after the state transition.
352		\item Blob Data Commitment (blobCommitment): The commitment to the data blob containing the new votes.
353	\end{itemize}
354	\item \textbf{Private Inputs:}	
355	\begin{itemize}
356		\item Votes: The list of new votes being processed, including census proofs and authentication data.
357		\item Merkle Proofs of nullifier inclusion: Proofs that each voter nullifier is included in the census.
358		\item Merkle Proofs of results update: Proofs that the process results have been correctly updated.
359		\item Merkle Tree Update Witnesses: Necessary data (e.g., Merkle paths) to update the Merkle tree from Root1 to Root2.
360		\item Process Parameters: Retrieved from Root1 within the circuit.
361	\end{itemize}
362\end{itemize}
363
364\begin{figure}[H]
365	\centering
366	\fbox{
367		\includegraphics[scale = 0.3, draft = false]{\figs/circuit-inputs.png}}
368\end{figure}
369
370The following constraints must be enforced by the circuit.
371
372\begin{itemize}
373	\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.
374	\item \textbf{Vote Validity}: Validate that each vote proof is correct.
375	\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`.
376	\item \textbf{Nullifier Non-Existence}: Ensure that the nullifier for each vote does not exist in the current state (`Root1`), preventing double voting.
377	\item \textbf{Nullifier Addition}: Correctly add each new nullifier to the state, resulting in `Root2`, updating the Merkle tree accordingly.
378	\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`.
379	\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.
380	\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.
381\end{itemize}
382
383\subsection{Protocol flow}
384\label{sec:vocdoni-protocol:flow}
385
386In Figure~\ref{fig:protocol-flow} we describe the protocol flow.
387
388\martai{About the figure: layout should be fixed. In addition, the icons for the different parties are missing.}
389
390\begin{figure}[H]
391	\centerline{\includegraphics[width=400pt,draft=false]{\figs/protocol-flow}}
392	\caption{Vocdoni voting process overview.}
393	\label{fig:protocol-flow}
394\end{figure}
395
396\subsection{Prior to voting (only once)}
397\label{sec:vocdoni-protocol:prior-steps}
398
399\martai{Remove the first step, we assume contracts are already deployed or at least, the logic is available.}
400
401This is done only once. Then every voting will start its process from step in Section~\ref{sec:vocdoni-protocol:start}.
402
403Vocdoni:
404\begin{enumerate}
405	\item Deployment of the 3 smart contracts.
406	\item Sequencers registry starts (it doesn't end).
407\end{enumerate}
408
409Sequencers (nodes validadors) -- this process is always open:
410\begin{enumerate}
411	\item Register this and that way.
412	\item Public keys?
413	\martai{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.}
414	\item PROVIDE COLLATERAL.
415	\martai{What happens to the collateral? If done only once, then you lose it? Do you need to send a new tx with more collateral?}
416	\item Send transaction to Sequencer registry smart contract (pay for tx fee).
417\end{enumerate}
418
419\subsection{Start of the voting process}
420\label{sec:vocdoni-protocol:start}
421
422The organizer:
423\begin{enumerate}
424	\item Prepares the census data \texttt{census\_data}.
425	\item Generates the census commitment \texttt{MT\_census.root = Com(census\_data)}.
426	\martai{In general, make use (link) to the functions defined in Section~\ref{sec:cryptographic-primitives}. For example, here the \texttt{MT.root()}.}
427	\martai{Additionally, after this step, the organizer should make a Merkle proof available to all eligible voters.}
428	\item Set voting details: duration, options, type, etc. + CENSUS MT ROOT.
429	\item Also a timeout for the DKG ceremony + minimum number of sequencers.
430	\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.
431\end{enumerate}
432
433\subsection{Key generation process} %Voting key generation
434\label{sec:vocdoni-protocol:dkg}
435
436The sequencer:
437\begin{enumerate}
438	\item Download all required data from the PM smart contract which includes the census MT root to handle the new vote.
439	\item Make contributions to DKG ceremony.
440\end{enumerate}
441
442After XXX time (set by the organizer in the PM contract?): all contributions to DKG are done.
443
444\martai{The organizer decides a minimum number of sequencers (security factor).}
445	
446\begin{itemize}
447	\item EPK ``becomes available".
448	\martai{I understand EPK becomes available in the SR smart contract, and that key is sent to the PM contract?}
449	\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.}
450\end{itemize}
451
452\subsection{Voting process}
453\label{sec:vocdoni-protocol:voting}
454
455Voter:
456
457\begin{itemize}
458	\item Choose any of the available sequencers (from?? -- from the SR SC).
459	\item Fetch their census \textbf{Merkle proof} to prove eligibility (from the census registry).
460	\item Use the EPK to encrypt the voting choice.
461	\item Generate ZK-SNARK of satisfiability of circuit from Fig.~\ref{fig:circuit-voter} with protocol from Section~\ref{sec:cryptographic-primitives:zkp} to prove the validity of the encrypted vote and adherence to ballot protocol rules. We call this proof \textbf{vote proof}.
462	\item Send the encrypted vote, Merkle proof, validity proof, and identity proof to the sequencer.
463	\martai{I understand Validity proof refers to ``voter circuit"? Merkle proof is for inclusion, right? And identity proof is for example a signature??}
464\end{itemize}
465
466Sequencer:
467
468\begin{itemize}
469	\item Fetch current state: retrieve the current valid process state root from the Etherem smart contract and the associated data from Ethereum blobs.
470	\martai{specify which SC.}
471	\item Generate a SK-SNARK proof of state transition proving:
472		\begin{itemize}
473			\item the validity of the ZK-SNARK proof provided by the voter,
474			\item the correct accumulation of votes from users, adding them to the process state,
475			\item the correct sum of the new encrypted votes using the homomorphic properties of ElGamal,
476			\item the new votes are from eligible users by checking the census Merkle proofs,
477			\item the new voters have not already voted by checking their nullifiers, or it is a correct vote overwrite,
478			\item the data blob hash matches the data used to verify the transition.
479		\end{itemize}
480	\item Submit updated state: send the new state root to the smart contract and store the updated data in Ethereum blobs.
481\end{itemize}
482
483Sequencers keep accumulating votes and create state transition until the finalization of the process.
484
485\martai{I understand this finalization is a deadline set by the organizer.}
486
487SC:
488
489\begin{itemize}
490	\item Upon receiving a sequencer's transaction, the SC verifies the zk-SNARK proof provided byt he sequencer.
491	\item Ensure the origin root corresponds to the current stored state root.
492	\item Confirm that the blob hash matches the one stored in Ethereum.
493\end{itemize}
494
495\subsection{Results validation}
496\label{sec:vocdoni-protocol:validation}
497
498Once the voting is completed (I understand the timeout set by the organizer expires), the following things happen.
499
500Sequencer:
501
502\begin{itemize}
503	\item $t$ out of $n$ sequencers publish their shares corresponding to the EPK to the Ethereum smart contract.
504	\martai{specify which SC.}
505	\item When the threshold of shares is reached, the results can be decrypted by anyone.
506	\martai{mention that the SC computes the corresponding ESK, or that can be computed by anyone off-chain, since all info is public.}
507	\item Sequencers receive reward for their correct participants depending on the number of sequenced votes.
508	\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?}
509\end{itemize}
510
511This way:
512
513\begin{itemize}
514	\item After the voting period ends and the results are decrypted, anyone can verify the correctness of the final result.
515	\martai{explain how.}
516	\item Use the zkSNARK state proof and publicly available data on-chain to ensure the integrity and correctness of the entire voting process.
517	\martai{elaborate on this.}
518\end{itemize}
519
520\subsection{Finalization of the voting process}
521\label{sec:vocdoni-protocol:finalization}