arnaucube
arnaucube/davinci-paperPublic Self-hosted repository
davinci-paper/v2/sections/smart-contracts.tex
v2/sections/smart-contracts.texRaw
 1% !TeX root = ../build/main.tex
 2
 3The \davinci protocol operates on an Ethereum-compatible network, which serves as the source of truth for the election. By leveraging an Ethereum virtual machine (EVM) blockchain, all election transitions become immutable and publicly verifiable. To coordinate and validate each phase of the process, DAVINCI deploys a set of smart contracts that enforce protocol rules, verify zero-knowledge proofs, and maintain on-chain commitments such as state roots, encryption keys, and final results. Together, these contracts provide a trustless execution environment that guarantees the correct and transparent progression of the election without relying on any centralized authority. 
 4\noi {\color{blue}\textbf{TODO}: add methods and state variables.}
 5
 6\subsubsection{Organization registry}
 7
 8The \hlset{\orgregistry} smart contract is used to create and manage organizations within the system. Each organization is identified by the Ethereum address of its creator and is associated with a name and a URL pointing to its metadata. At this stage, the contract serves only as a registration mechanism, but it lays the foundation for future extensions, such as managing multiple elections under the same organization.
 9
10\subsubsection{Census management}
11
12{\color{blue}The \hlset{\censusmanagement} smart contract xxx.}
13
14\subsubsection{Key management}
15
16The \hlset{\dkgmanagement} smart contract coordinates the \ac{DKG} process among the \keywardens. It records their contributions, verifies proofs of correct participation, and ensures that a valid encryption public key is produced once the \ac{DKG} round is complete.
17
18\subsubsection{Election (process) registry}
19
20The \hlset{\electionregistry} manages the lifecycle of each election, from its creation to the registration of final results. It maintains the election’s current state and ensures that all transitions follow the protocol. 
21
22\subsubsection{State transition verifier}
23
24The \hlset{\statetransitionverifier} is responsible for validating the proofs that attest to correct updates of the election state. It stores the verification key corresponding to the state transition circuit (see Section~\ref{sec:vocdoni-protocol:circuits:state-transition}) and checks that each submitted proof correctly links the previous and new state roots. Only transitions verified through this contract are accepted as valid updates by the process registry.
25
26\subsubsection{Results verifier}
27
28The \hlset{\resultsverifier} contract validates the proof of correct tally computation. It contains the verification key for the results circuit (see Section~\ref{sec:vocdoni-protocol:circuits:results}) and ensures that the final results submitted by the organizer match the commitments from the final state. Once verified, the results and their proof are permanently recorded on-chain, providing a tamper-proof reference for the election outcome.\\
29
30\martai{\\
31	1. \orgregistry only for transparency purposes, right? Any EOA can call \electionregistry?\\
32	2. Once EPK is created, does a kew warden uploaded it to \dkgmanagement and that triggers a call to \electionregistry that records it?\\
33	3. What is the relation with \electionregistry and \dkgmanagement, because the organizer sets the security parameters for the DKG, what is the interaction between contracts?\\
34	4. Does \electionregistry call the other two verifier contracts? Or the sequencers need to call the other two?}
35
36%
37%1. OrganizationRegistry: se utiliza para crear una organización (que asocia la address del creador con un nombre y una URL a sus metadatos). No tiene ningún otro rol de momento.
38%2. ProcessRegistry: registra como dices todo el proceso de una election, desde su creación hasta registrar los resultados (incluyendo el stateroot en cada momento). En resumen:
39%Genera el state root inicial (aun no, pero lo hará).
40%Controla el status de la election (ready, pause, ...).
41%Verifica las state transitions y actualiza el state de la election.
42%Verifica los resultados una vez que son calculados.
43%3. (Encara no): Coordinación DKG
44%4. Verifier: Realmente son 2 verifiers, el de las statetransitions y el de los results (uno por cada circuito porque cada uno contiene la verification key que debe).