This document is a work in progress and subject to change
Blockchain is a revolutionary digital technology that could impact every sector of the world economy. On top of that, Blockchain has the potential to change the way a society is organized, including how groups of people choose their leaders, or choose whether or not to execute common initiatives.
In this document, we propose the system architecture of a decentralized anonymous voting platform.
We want to bring decentralized voting to mass adoption. This requires a solution that has a user experience at least on par with current, centralized solutions.
We achieve this by externalizing the heavy lifting to a relay
network - thereby allowing for lightweight end-user clients. This fundamental architectural choice has the following implications:
- Minimizes transactions to the blockchain. Can potentially be used in the Ethereum Mainnet
Voter
does not write, only reads from the blockchainVoter
can participate with an light-client (static web/app)- Secure vote anonymization using zk-SNARK
- Data integrity via content-addressed storage (IPFS)
- Economically incentivized,
relay
network performs actions not possible by light-clients - The whole
process
is verifiable by any external observer
The following concepts are referenced extensively throughout the document
Voter
- A
voter
is the end user that will vote - Its digital representation is called an
identity
- Inside the voting
process
, andidentity
is represented by apublic key
- Can manage all interactions through a
light-client
(web/app)
Organizer
- The entity that creates and manages a specific voting
process
- Needs to interact with the blockchain
- Needs to add and retrieve data to IPFS
- Pays for the costs of a
process
(relay
transactions and rewards) - Has the highest interest for the
process
to succeed - Knows the census beforehand (list of
voters
that are authorized to participate in a specificprocess
)
Relay
- Is used as a proxy between the
voter
and the blockchain - Is a selfish actor. Good behaviour is ensured through economic incentives
- It may have to be split into several
relay
types - Performs functions that would not be possible on a
light-client
- Relays
vote packages
to otherrelays
- Aggregates
vote packages
into avotes batch
- Pins the
votes batch
to IPFS and adds its hash to the blockchain - Validates
franchise proofs
- Validates anti-spam proof-of-work nonce
- Ensures data availability on IPFS
- Is responsible for the data availability of the
vote packages
it has added (will lose stake if those are not available) - Exposes an IPFS proxy for the
light-clients
- Provides
census
Merkle-proofs tovoter
- Exposes an RPC end-point to the blockchain for the
light-client
- It should run a full Ethereum node
- Relays
Process
- It is an specific instance of a voting process
- Each
process
is identified by aProcessId
ProcessId
- A unique identifier for each
process
- Generated by the
Voting smart-contract
when a new process is created
Light-client
- The client which
voters
will use to vote - Could be an app or static website running on a smart-phone
- Provides UI for easy interaction
- Runs some moderate computational processes, such as the
franchise proof
and the relay anti-spam proof-of-work generation
Census
- A Merkle-tree made of the
public keys
of all thevoters
- The Merkle-root is hosted in the blockchain as a proof of the census
- The tree needs to be publicly available (IPFS, DAT) for everyone to verify it.
- The
zk-SNARK circuit
will use its Merkle-root to validate if avoter
public key
is part of it
Franchise proof
- Leverages zk-SNARK technology
- Used to prove two things without revealing critical data
Voter
is the owner of theprivate key
corresponding to thepublic key
Voter
'spublic key
is included in thecensus
- Generated in the
user
light-client - Is a CPU and memory intensive process
- Is validated by the
relays
before adding thevoting package
in the blockchain - It is validated by the
organizer
once theprocess
ends
zk-SNARK circuit
- Used by the
voter
to generate thefranchise proof
- Used by the
relay
andorganizer
to validate thefranchise proof
- The same circuit can be use for any
process
- It requires a trusted setup to be generated
Voting smart-contract
- The
process metadata
required by aprocess
is published here when a newprocess
is created - The
voter
light client retrieves theprocess metadata
from here Votes batches
hashes are added here- It keeps a list of available relays
- It holds the funds used to pay the
relays
- It holds the funds that the
relays
need to stake to ensure their good behaviour - When a
process
is successfully finished it transfers the funds to therelays
Process metadata
- Is the metadata that needs to be public before a
process
starts- Merkle Root of the
census
Merkle tree Vote encryption key
- Available
voting options
Process
start time (block number)Process
end time (block number)
- Merkle Root of the
Vote package
- Is the set of data sent by the
Voter
to therelay
in order to vote - Includes:
- Franchise proof
- Encrypted vote: encrypt(selected
vote options
+ random nonce) Nullifier
: hash(ProcessId
+Voter
private key
)ProcessId
- Together with the package an anti-spam proof of work is sent
Votes batch
Relays
aggregate multipleVote Packages
into a singleVotes batch
in order to minmize blockchain transactions- Its hash is added into the blockchain and pinned into IPFS
Vote encryption key
- Provided by
organizer
- The public key used by the
Voters
to encrypt their vote - Its private key needs to be made public at the end of the process, for everyone to decrypt the votes
- Multiple
vote encryption keys
can be used to ensure that no one has access to the results before theprocess
is finished - Entities providing the
vote encryption key
could be required to put some stake to ensure key publishing
Voting options
- A potential option for the user to choose when they vote
- They are published when a
process
is created - They could be exclusive or not
- Before the process in itself starts
voters
must have their digitalidentity
already created. - The unique requirement for those
identities
is that they need to be represented by apublic key
. - The system is agnostic to the identity system used, but further systems may require additional work to fully integrate.
- Presently assumes that the
organizer
has a list of all thevoters
that can participate - It aggregates all the
public keys
of thevoters
and generates thecensus
Merkle tree from them.
- Via a user interface, it provides the required
process metadata
regarding a voting process. - Sends a transaction to the
voting smart-contract
- It includes the
process metadata
, so is public for the other players - The funds sent in the transaction will be used to pay the
relays
- The amount sent is proportional to the needs of the
process
(number of participants, relay redundancy...)
- It includes the
- In parallel it also publishes the
census
to IPFS, to make it available to everyone else.
- Gets the
process metadata
from thevoting smart-contract
- Gets the
census
Merkle-proof from arelay
- Verifies her
public key
is in the publishedcensus
Merkle tree - Selects the desired
voting options
from theprocess metadata
- Encrypts the selected
voting options
and a random nonce with thevote encryption keys
encrypted_vote = encrypt( selected_voting_options + random_nonce )
- Generates the nullifier
nullifier = hash( process_id + user_private_key )
The franchise proof
is generated by running the zk-SNARK voting cicuit
with several inputs.
- private input: Private Key, census Merkle-proof
- public input: census Merkle-root, Nullifier, ProcessId, Hash(encrypted vote)
- output: Franchise proof
-
The
Vote package
is made of:- Franchise proof
- Encrypted vote
- Nullifier
- ProcessID
-
Potentially the
vote package
can be encrypted with one or morerelay
public keys
in order to choose the relay chain and minimize IP mapping -
proof-of-Work nonce (to avoid relay node spamming) must be attached to the package. If the PoW is not correct, the relay pool will discard the package.
-
The
vote package
and the nonce are sent to therelay
pool
- The
relay
pool receives thevote package
from theuser
- A
relay
verifies the proof-of-work and thefranchise proof
. If either is invalid, thevote package
is discarded. - Chooses a set of pending
vote packages
and compiles them into avotes batch
. - Adds the
votes batch
into IPFS - Uploads the
votes batch
hash to the blockchain
- The owners of the
vote encryption keys
publish the correspondingprivate keys
, so the votes and proofs can be decrypted - The
organizer
gets the hashes thevotes batch
from the blockchain - The
organizer
downloads thevotes batch
from IPFS - The
organizer
iterates over all thevote packages
- It decrypts the
encrypted vote
with the published private key of thevoting encryption keys
- It runs the
franchise proof
through thezk-SNARK circuit
and discards invalid proofs - It discards
vote-packages
with repeatednullifier
(double votes)
- It decrypts the
- It computes the final results
- The
organizer
signals badrelays
- The
organizer
makes theprocess
closing transaction, uploading the results Relays
are rewarded according to their contribution
- Zk-SNARK trusted setup
- IP/vote mapping
- Most of the unresolved details are around creating a fully decentralized relay network. Multiple alternatives exist.
- A centralized trusted
relay
is a very valid option in a certain context
The system is agnostic to the identity scheme used.
We are developing our implementation using Iden3,for its balance of decentralization and scalability.
Other identity schemes could eventually be integrated.
The light-client
website/app will allow users and organizers interact with the whole system.
This piece must be as static as possible, thus non dependent on any dynamic database. This allows for multiple ways to access the frontend, for instance via IPFS or ZeroNet, making censorship very hard or even impossible.
Being static makes it easier to checksum it and therefore minimizing atac vectors.
The light-client
needs to interact with different service providers such as Web3 RPC, IPFS gateway or TOR proxy. However the user must be able to choose its own provider.