-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(zk-snarks): AG-32 defined voting program (#39)
defined municipality election voting zk-snarks protocol
- Loading branch information
Showing
18 changed files
with
109 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
# Municipality Election zk-SNARKS Voting proof | ||
|
||
## About | ||
|
||
This program implements a π-vote proof based on a municipality election smart contract deployed using the election-scripts. | ||
|
||
The TypeScript script deploy the MunicipalityElection smart contract and registers parties and candidates using mock data.This must be done | ||
before to generate the proof program. | ||
|
||
In a real use case of this program, the circuit for the π-vote proof must be generated after the election | ||
registration phase has closed, so that you know the ballot paper used by the Voter to vote. | ||
|
||
Following the ballot paper for the municipalityElection generated by the ts script: | ||
|
||
```json | ||
{ | ||
"contractAddress":"0xa82fF9aFd8f496c3d6ac40E2a0F282E47488CFc9", | ||
"coalitions":[ | ||
{ | ||
"majorCandidate":{ | ||
"name":"Pino Pini", | ||
"candidatesFor":"major", | ||
"points":0 | ||
}, | ||
"parties":[ | ||
{ | ||
"name":"Partito Democratico", | ||
"councilorCandidates":[ | ||
"Luigi Rossi", | ||
"Maria Verdi", | ||
"Renato Bianchi", | ||
"Francesco Guidi", | ||
"Paolo Franchi" | ||
], | ||
"points":0 | ||
}, | ||
{ | ||
"name":"Forza Italia", | ||
"councilorCandidates":[ | ||
"Francesca Riti", | ||
"Vanessa Reti", | ||
"Mario Checchi", | ||
"Carlo Proni", | ||
"Pierpaolo Pingitore" | ||
], | ||
"points":0 | ||
} | ||
] | ||
}, | ||
{ | ||
"majorCandidate":{ | ||
"name":"Ugo Silenti", | ||
"candidatesFor":"major", | ||
"points":0 | ||
}, | ||
"parties":[ | ||
{ | ||
"name":"Cinque Stelle", | ||
"councilorCandidates":[ | ||
"Giuseppe Toni", | ||
"Nicolò Movizzo", | ||
"Alessandra Tonali", | ||
"Antonella Chierici", | ||
"Antonio Basso" | ||
], | ||
"points":0 | ||
}, | ||
{ | ||
"name":"Lega", | ||
"councilorCandidates":[ | ||
"Patrizio Pini", | ||
"Mariagrazia Crudi", | ||
"Sabrina Giacigli", | ||
"Marco Lioni", | ||
"Pio Pedri" | ||
], | ||
"points":0 | ||
} | ||
] | ||
} | ||
] | ||
} | ||
``` | ||
|
||
## Voting mechanism | ||
|
||
The election is created assigning 20 voting points (see the `election-scripts/create-election.ts`). | ||
|
||
Therefore, each voter can assign point to the major candidates and/or the parties | ||
up to a maximum of 20 points totally. | ||
|
||
It is possible to assign points to more that one major candidate at the same time and also to parties in different coalitions. | ||
|
||
## What this program proofs | ||
|
||
1. The sum of the points assigned to the candidates and the parties does not exceed 20; | ||
2. Since a voter can assign negative points in that way that the sum is 20, the second proof verifies that the points assigned are positive integers; | ||
3. The third proof consist to demonstrate that the voter knows for whom he/she is voting; |
Empty file.