@@ -6,115 +6,133 @@ package com.webank.wedpr.acv.proto;
66option java_package = "com.webank.wedpr.acv.proto" ;
77option java_multiple_files = true ;
88
9- // Counter Secret value
10- message CounterSecret {
11- bytes poll_secret_share = 1 ;
9+ // Candidate list.
10+ message CandidateList {
11+ repeated string candidate = 1 ;
1212}
1313
14- message CounterSystemParametersShareRequest {
15- string counter_id = 1 ;
16- bytes poll_point_share = 2 ;
14+ // System parameters.
15+ message SystemParametersStorage {
16+ bytes poll_point = 1 ;
17+ CandidateList candidates = 2 ;
1718}
1819
19- message CounterSystemParametersStorage {
20- repeated CounterSystemParametersShareRequest counter_parameters_request = 1 ;
20+ // Counter's secret value.
21+ message CounterSecret {
22+ bytes poll_secret_share = 1 ;
2123}
2224
23- // Voter Secret value
25+ // Voter's secret value.
2426message VoterSecret {
2527 bytes voter_secret = 1 ;
2628}
2729
30+ // Request of voter's registration.
2831message RegistrationRequest {
2932 RegistrationBlindingPoint weight_point = 1 ;
3033}
3134
35+ // delete?
3236message RegistrationBlindingPoint {
3337 bytes blinding_poll_point = 1 ;
3438 bytes blinding_basepoint_g2 = 2 ;
3539}
3640
41+ // Response of coordinator for voter's registration.
3742message RegistrationResponse {
3843 uint32 voter_weight = 1 ;
3944 Ballot ballot = 2 ;
4045 bytes signature = 3 ;
4146}
4247
48+ // Ciphertext ballot.
4349message Ballot {
4450 bytes ciphertext1 = 1 ;
4551 bytes ciphertext2 = 2 ;
4652}
4753
54+
55+ // Request of generating system parameter from a counter.
56+ message CounterSystemParametersShareRequest {
57+ string counter_id = 1 ;
58+ bytes poll_point_share = 2 ;
59+ }
60+
61+ // Requests of generating system parameter from all counters.
62+ message CounterSystemParametersStorage {
63+ repeated CounterSystemParametersShareRequest counter_parameters_request = 1 ;
64+ }
65+
66+ // Choice of ballot casting for each candidate.
4867message VoteChoice {
4968 string candidate = 1 ;
5069 uint32 value = 2 ;
5170}
5271
72+ // Choices for all candidate.
5373message VoteChoices {
5474 repeated VoteChoice choice = 1 ;
5575}
5676
77+ // Ciphertext ballot for each candidate.
5778message CandidateBallot {
5879 string candidate = 1 ;
5980 Ballot ballot = 2 ;
6081}
6182
62- message VoteStorage {
63- bytes signature = 1 ;
64- Ballot blank_ballot = 2 ;
65- Ballot rest_ballot = 3 ;
66- repeated CandidateBallot voted_ballot = 4 ;
67- }
68-
69- // system parameters
70- message CandidateList {
71- repeated string candidate = 1 ;
72- }
73-
74- message SystemParametersStorage {
75- bytes poll_point = 1 ;
76- CandidateList candidates = 2 ;
77- }
78-
79-
80- // proofs
83+ // ZKP data to verify the format of ciphertext ballot.
8184message BallotProof {
8285 bytes format_proof = 1 ;
8386}
8487
88+ // Pair of candidate index and the ballot proof he received.
8589message StringToCandidateBallotProofPair {
8690 string key = 1 ;
8791 BallotProof value = 2 ;
8892}
8993
9094// Do not use Map, cause unordered in blockchain
95+ // Request of polling for all candidates.
9196message VoteRequest {
9297 VoteStorage vote = 1 ;
9398 repeated StringToCandidateBallotProofPair ballot_proof = 2 ;
9499 bytes range_proof = 3 ;
95100 bytes sum_balance_proof = 4 ;
96101}
97102
98- message DecryptedResultPartStorage {
99- CountingPart blank_part = 1 ;
100- repeated StringToCountingPartPair candidate_part = 2 ;
103+ // Polling for each candidates.
104+ message VoteStorage {
105+ bytes signature = 1 ;
106+ Ballot blank_ballot = 2 ;
107+ Ballot rest_ballot = 3 ;
108+ repeated CandidateBallot voted_ballot = 4 ;
109+ }
110+
111+ // Decrypted ballot and ZKP data to verify the process of counting of each counter.
112+ message CountingPart {
113+ string counter_id = 1 ;
114+ bytes blinding_c2 = 2 ;
115+ bytes equality_proof = 3 ;
101116}
102117
118+ // Pair of candidate index and the decrypted ballot he received.
103119message StringToCountingPartPair {
104120 string key = 1 ;
105121 CountingPart value = 2 ;
106122}
107123
108- message CountingPart {
109- string counter_id = 1 ;
110- bytes blinding_c2 = 2 ;
111- bytes equality_proof = 3 ;
124+ // Decrypted ballot and ZKP data to verify the process of counting of all counters.
125+ message DecryptedResultPartStorage {
126+ CountingPart blank_part = 1 ;
127+ repeated StringToCountingPartPair candidate_part = 2 ;
112128}
113129
130+ // Final result of all candidates.
114131message VoteResultStorage {
115132 repeated StringToInt64Pair result = 1 ;
116133}
117134
135+ // Final result of each candidate.
118136message StringToInt64Pair {
119137 string key = 1 ;
120138 int64 value = 2 ;
0 commit comments