arnaucube
arnaucube/davinci-paperPublic Self-hosted repository
davinci-paper/v2/sections/census-old.tex
v2/sections/census-old.texRaw
  1% !TeX root = ../build/main.tex
  2
  3The census Merkle tree, denoted by $\hlget{\censusTree}$ encodes the list of eligible voters and their associated voting weights. Formally, it is implemented as a sparse Merkle tree (SMT) of fixed depth\footnote{In the present work, all circuits are instantiated using sparse Merkle trees as described above. However, the protocol does not strictly depend on this structure: any authenticated data structure that supports efficient commitments and membership proofs verifiable inside zero-knowledge circuits could be employed. Adapting the protocol to such alternatives would only require modifying the corresponding circuits, while the overall flow of the election process would remain unchanged.}, as described in Section~\ref{sec:cryptographic-primitives:merkle-trees}. Each voter is mapped to a unique path in the tree, typically derived from their Ethereum address or another unique identifier, and the corresponding leaf stores the voting weight of that address. While the default weight is usually one, the system also supports weighted voting, where different participants may have different levels of influence.
  4
  5To construct the census, the organizer collects the dataset of eligible voters and their weights, computes the corresponding tree, and publishes its root (\censusroot) on-chain. The full dataset does not need to be stored on-chain; instead, it is distributed off-chain (e.g., via IPFS or another content-addressed storage system), enabling verifiers and sequencers to independently reconstruct the tree and produce membership proofs when needed. This design ensures transparency and verifiability while minimizing on-chain storage requirements.
  6
  7The census tree plays a central role during the voting phase. Voters must provide a Merkle proof showing that their address and weight are included in the tree committed by the organizer. These proofs are then verified within ZK circuits, which guarantees that only eligible participants can cast ballots without requiring the disclosure of the entire census. In this way, the census Merkle tree provides a compact, cryptographically verifiable commitment to voter eligibility that supports both privacy and scalability.
  8
  9Although the protocol does not mandate a specific method for constructing the census tree, different instantiations are possible depending on the application context:
 10%
 11\begin{itemize}
 12	\item \emph{Private datasets}. Organizations maintaining internal voter registries (e.g., membership databases or CSV files) can directly convert them into the Merkle format. This approach keeps the registry confidential, with only the root hash made public.
 13	\item \emph{Self-sovereign identity (SSI)}. If voters manage identities through SSI systems, the organizer can aggregate these identities and build 
 14	the tree accordingly. This enables participation without requiring centralized identity management.
 15	\item \textit{Ethereum-based tokens}. Token balances (e.g., ERC-20 or NFTs) may also define eligibility. In this setting, the census can either be created via the optimistic approach, taking a snapshot of token balances and allowing a dispute period for fraud proofs, or through a ZK-SNARK that proves correctness directly from Ethereum storage proofs and ensures that both individual balances and the token’s total supply are consistent. 
 16\end{itemize}
 17%
 18This flexibility allows the protocol to accommodate a wide range of use cases, from private associations to decentralized communities, while maintaining the same security and verifiability guarantees.
 19
 20-----------------------------------------
 21
 22
 23The census defines the set of eligible voters and their associated voting weights. Throughout the protocol, the census is represented by a lean incremental Merkle tree, as defined in Section~\ref{sec:cryptographic-primitives:merkle-trees}, and denoted by $\hlset{\censusTree}$. Voters are inserted sequentially into the tree: each new eligible voter occupies the next available leaf, and that leaf stores both their Ethereum address (or another unique identifier) and their voting weight. While the default weight is one, the protocol also supports weighted voting, where different participants may have different voting power.
 24
 25
 26
 27
 28
 29---------------------------------------
 30
 31\subsection{ALTRETYPE}
 32
 33The census defines the set of eligible voters and their associated voting weights. 
 34Throughout the protocol, the census is represented by a Merkle-tree commitment, denoted 
 35by $$\hlset{\censusTree}$$, and its root $\censusroot$ is recorded in the election registry smart 
 36contract. Each voter is mapped to a unique path in the tree---typically derived from 
 37their Ethereum address or another unique identifier---and the corresponding leaf stores 
 38the voter’s weight. While the default weight is one, the protocol naturally supports 
 39weighted voting.
 40
 41During ballot submission, voters provide a Merkle membership proof showing that their 
 42address and weight are included in the committed census. These proofs are verified inside 
 43zero-knowledge circuits, ensuring that eligibility checks occur privately and without 
 44requiring disclosure of the full census. The Merkle-tree commitment thus offers a compact, 
 45scalable mechanism to attest voter eligibility.
 46
 47DAVINCI supports multiple census models depending on the deployment context, including 
 48off-chain and on-chain trees, static or dynamically updatable registries, and 
 49credential-based approaches. In all configurations, the election registry smart 
 50contract stores two parameters:
 51(i) \texttt{censusRoot}, containing either a Merkle root or the address of a census 
 52contract, and 
 53(ii) \texttt{censusURI}, pointing to an off-chain location where sequencers can 
 54retrieve the census data or related verification information.
 55
 56The supported census models are described below.
 57
 58\paragraph{Off-chain static census.}
 59
 60In this model, the organizer constructs a fixed census prior to the start of the election. 
 61The census is represented as a (incremental) Merkle tree built off-chain, and its root is 
 62submitted to the election registry contract during setup. The contract stores this 
 63commitment in \texttt{censusRoot}, while \texttt{censusURI} provides a URL or 
 64content-addressed reference (e.g., IPFS) where sequencers can download the full tree to 
 65generate and verify Merkle proofs. The tree remains unchanged throughout the voting 
 66period.
 67
 68\paragraph{Off-chain dynamic census.} 
 69
 70In the off-chain dynamic model, the Merkle tree remains off-chain but can be \emph{extended} 
 71during the voting period. The organizer may add new voters (but may never delete entries 
 72or alter weights, as such operations would enable double voting). Each update produces a 
 73new Merkle root, which the organizer must publish to the election registry contract via a 
 74transaction that updates the \texttt{censusRoot} variable. Sequencers always verify 
 75membership proofs against the most recently published root, ensuring consistency with the 
 76on-chain commitment.
 77
 78\paragraph{On-chain static census.}
 79
 80Here, the census is deployed as a dedicated smart contract that stores the Merkle tree 
 81on-chain. The tree is static and does not change during the voting period. During election 
 82setup, the election registry contract reads the tree root from the census contract and 
 83stores it in \texttt{censusRoot}, while \texttt{censusURI} indicates where sequencers may 
 84retrieve the full tree representation (e.g., IPFS). Membership verification can therefore 
 85be performed entirely on-chain.
 86
 87\paragraph{On-chain dynamic census.}
 88
 89In this configuration, the census lives in a dedicated on-chain contract that supports the
 90addition of new members during the voting period. The address of this contract is stored in 
 91\texttt{censusRoot}, and \texttt{censusURI} points to an external representation of the tree 
 92(e.g., dGraph, IPFS). The census contract maintains a list of all Merkle roots corresponding 
 93to valid updates. Sequencers may produce membership proofs using earlier roots, since the 
 94tree evolves over time. During state transitions, the election registry contract queries the 
 95census contract to check whether the root used in a submitted proof is recognized as valid. 
 96As in all dynamic models, only additions to the census are permitted.
 97
 98\paragraph{Credential service provider.}
 99
100Credential service provider (CSP)\\
101
102This model replaces the Merkle-tree-based census with an eligibility credential issued by a 
103trusted entity. Instead of providing a Merkle proof, voters obtain a digital signature from a 
104\emph{Credential Service Provider} (CSP) attesting to their eligibility. In this case, the 
105election registry smart contract stores the CSP’s public key in \texttt{censusRoot}, and 
106\texttt{censusURI} specifies where voters may request or obtain their credential. Sequencers 
107verify eligibility by checking the CSP signature directly, eliminating the need for a 
108census tree. This approach is suitable when eligibility is administered by an external 
109authority capable of issuing verifiable credentials.
110
111\paragraph{Constructing the census.}
112
113Any of the above models may be instantiated using different sources of eligibility 
114information. That is, the protocol does not mandate a specific method for constructing the census tree, different instantiations are possible depending on the application context:
115%
116\begin{itemize}
117	\item \emph{Private datasets}. Organizations maintaining internal voter registries (e.g., membership databases or CSV files) can directly convert them into the Merkle format. This approach keeps the registry confidential, with only the root hash made public.
118	\item \emph{Self-sovereign identity (SSI)}. If voters manage identities through SSI systems, the organizer can aggregate these identities and build 
119	the tree accordingly. This enables participation without requiring centralized identity management.
120	\item \textit{Ethereum-based tokens}. Token balances (e.g., ERC-20 or NFTs) may also define eligibility. In this setting, the census can either be created via the optimistic approach, taking a snapshot of token balances and allowing a dispute period for fraud proofs, or through a \ac{ZK-SNARK} that proves correctness directly from Ethereum storage proofs and ensures that both individual balances and the token’s total supply are consistent. 
121\end{itemize}
122%
123This flexibility allows \davinci to accommodate a wide range of governance and participation use cases, from private associations to decentralized communities, while maintaining the same security and verifiability guarantees.