davinci-paper/v2/sections/census.tex
v2/sections/census.texRaw
1% !TeX root = ../build/main.tex
2
3The census defines the set of eligible voters and their associated voting weights. At its core, a census is simply a dataset that, for each voter, contains a unique identifier (typically an Ethereum address), a voting weight, and a means to produce a membership proof that can be verified inside a \ac{ZK} circuit. \Davinci supports two mechanisms for generating such proofs:
4\begin{itemize}
5 \item \textit{Credential-based membership proofs}: eligibility is certified by a digital signature issued by a \ac{CSP}.
6 \item \textit{Merkle-tree-based membership proofs}: the census is organized as a lean incremental Merkle tree (see Section~\ref{sec:cryptographic-primitives:merkle-trees}) and denoted by $\hlset{\censusTree}$. Each voter is assigned a sequential index in the tree, and their identifier and weight are stored in the corresponding leaf. Only the Merkle root is kept on-chain, and sequencers supply Merkle proofs to attest membership.
7\end{itemize}
8%
9To support different census models, the \hlget{\electionregistry} smart contract stores the following three parameters:
10\begin{itemize}
11 \item \censusorigin: the deployment model (off-chain static, off-chain dynamic, on-chain dynamic, or \ac{CSP}).
12 \item \censusuri: a \ac{URI} pointing to an external reference (URL, GraphQL endpoint, CDN path, IPFS/IPNS, etc.) from which sequencers can download or query the census data.
13 \item \censusroot: the on-chain commitment used for membership verification. Its interpretation depends on the type of census. In the \ac{CSP} model, this parameter corresponds to the \ac{CSP}’s public key, and in the case of Merkle trees, it corresponds to a Merkle root (off-chain static/dynamic) or a census contract address (on-chain dynamic).
14\end{itemize}
15%
16Organizers are free to construct the census from various data sources, such as private membership registries, self-sovereign identity credentials, or Ethereum-based tokens (e.g. ERC-20 or NFTs) whose balances define eligibility. Token-based censuses may be built from an optimistic snapshot at a chosen block or via a ZK proof that validates balances using Ethereum storage proofs. This flexibility supports a broad range of use cases and governance scenarios.
17%
18The supported census models are summarized in Table~\ref{tab:census-models} and described in detail below.
19
20\paragraph{Credential-based census.} Voter eligibility is certified by a digital signature issued by a \ac{CSP}. A voter obtains a signed credential from the \ac{CSP}, and sequencers verify the signature inside the \ac{ZK} circuits. In this case, \censusroot stores the \ac{CSP}’s public key, and \censusuri specifies the endpoint where voters obtain their credential. This model is suitable when eligibility is managed externally through attested identities rather than by maintaining a Merkle-tree dataset.
21
22\paragraph{Off-chain static census.} The organizer constructs a fixed census prior to the election. The Merkle tree is built locally, its root is stored in \censusroot, and \censusuri specifies the endpoint from which sequencers can retrieve the full tree. Since the census is static, no updates occur during the voting period.
23
24\paragraph{Off-chain dynamic census.} The Merkle tree remains off-chain, but the organizer may append new voters during the voting period (never deleting voters or modifying weights, as this would enable double voting). Each new insertion produces a new Merkle root, which the organizer must publish to the \hlget{\electionregistry} contract by updating the \censusroot parameter. As in the static model, GraphQL provides the endpoint from which sequencers download the current version of the tree. Sequencers verify membership proofs against the most recently published root.
25
26\paragraph{On-chain dynamic census.} In this configuration, the census is managed by a dedicated on-chain contract (\hlget{\censusmanagement}) that supports adding new members during the voting period. The address of this contract is stored in \censusroot, while \censusuri points to an external representation of the tree (e.g., a GraphQL endpoint). The \hlget{\censusmanagement} contract maintains a history of valid Merkle roots. Sequencers may therefore generate membership proofs using older roots, and during state transitions the \hlget{\electionregistry} contract queries the \hlget{\censusmanagement} contract to verify that the root used in the proof is still valid. As in all dynamic models, only additions to the census are permitted during the voting period.
27
28\begin{table}[H]
29 \centering
30 \renewcommand{\arraystretch}{1.25}
31 \begin{tabular}{|P{1.6cm}|P{2.1cm}|P{3.3cm}|P{4.1cm}|P{4.8cm}|}
32
33 \hline
34 \multicolumn{2}{|c|}{\censusorigin} &
35 \censusuri &
36 \censusroot &
37 Membership proof \\
38 \hline
39
40 \multicolumn{2}{|P{3.5cm}|}{Credential service provider (CSP)}
41 & \multirow{2}{*}{CSP's public key}
42 & Endpoint to obtain an eligibility credential
43 & \multirow{2}{*}{Digital signature verification}\\
44 \hline
45
46 \multirow{4}{*}{Off-chain}
47 & \multirow{2}{*}{\centering Static}
48 & \multirow{2}{*}{Fixed Merkle root}
49 & Endpoint to obtain the census tree
50 & Merkle proof verified against the Merkle root \\
51 \cline{2-5}
52
53 & \centering Dynamic (add-only)
54 & \multirow{2}{*}{Latest Merkle root}
55 & Endpoint to obtain the latest version of the tree
56 & Merkle proof verified against the latest Merkle root\\
57 \hline
58
59 \multirow{2}{*}{On-chain}
60 & \centering Dynamic (add-only)
61 & \censusmanagement contract address
62 & Endpoint to obtain the latest version of the tree
63 & Merkle proof verified against most recent roots \\
64 \hline
65
66 \end{tabular}
67 \vspace{0.5cm}
68 \caption{Summary of census configurations supported by the \davinci protocol.}
69 \label{tab:census-models}
70\end{table}