Skip to content

Commit c8fc482

Browse files
authored
Merge pull request #1008 from Concordium/election-verification
Document third party verification flow + adapt coordinator tool docs
2 parents 8cce2e3 + 13efcab commit c8fc482

File tree

4 files changed

+73
-7
lines changed

4 files changed

+73
-7
lines changed

README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ pip3 install pipenv
6464

6565
To install the python dependencies run:
6666
```
67-
pipenv sync
67+
pipenv sync --dev
6868
```
6969

7070
Install `graphviz`:
@@ -77,7 +77,7 @@ On macOS
7777
```
7878
brew install python3 graphviz
7979
pip3 install pipenv
80-
pipenv sync
80+
pipenv sync --dev
8181
```
8282

8383
### Windows
@@ -89,7 +89,7 @@ Download and run the launcher. Make sure to select "Add Python to PATH" at the b
8989
After that from a terminal run
9090
```
9191
pip3 install pipenv
92-
pipenv sync
92+
pipenv sync --dev
9393
```
9494
from the root of this repository.
9595

source/mainnet/net/index.rst

+1
Original file line numberDiff line numberDiff line change
@@ -65,3 +65,4 @@ index
6565
voting/coordinator
6666
voting/voting
6767
voting/guardians
68+
voting/verify-election-result

source/mainnet/net/voting/coordinator.rst

+6-4
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,15 @@ The tool has the following subcommands. All commands have a ``--help`` option wh
3434
Get the list of initial weights
3535
-------------------------------
3636

37-
Use the ``initial-weights`` command to gather the average amount of CCD on an account in the given period. The intention is that this command is used to produce the initial weights of each account prior to the election starting. The output of this command is a CSV file used in the ``final-weights`` command after the election.
37+
Use the ``initial-weights generate`` command to gather the average amount of CCD on an account in the given period. The intention is that this command is used to produce the initial weights of each account prior to the election starting. The output of this command is a CSV file used in the ``final-weights`` command after the election.
3838

3939
Example
4040

4141
.. code-block:: console
4242
43-
election-coordinator --node http://localhost:20001 initial-weights --start 2024-01-01T00:00:00Z --end 2024-01-03T00:00:00Z --out initial-weights.csv
43+
election-coordinator --node http://localhost:20001 initial-weights --out . generate --start 2024-01-01T00:00:00Z --end 2024-01-03T00:00:00Z
4444
45-
The weights are stored in the initial-weights.csv file.
45+
The weights are stored in the initial-weights.csv file, and the corresponding parameters used to compute them are stored in initial-weights-params.json file in the current path directory.
4646

4747
Create a new election instance
4848
------------------------------
@@ -57,7 +57,7 @@ Use the ``new-election`` command to create the necessary files and the contract
5757

5858
.. code-block:: console
5959
60-
election-coordinator new-election --module ../contracts/concordium-governance-committee-election/concordium-out/module.wasm.v1 --threshold 1 --admin ../test-scripts/keys/2yJxX711aDXtit7zMu7PHqUMbtwQ8zm7emaikg24uyZtvLTysj.export --election-start '2024-02-01T00:00:00Z' --election-end '2024-02-07T00:00:00Z' --decryption-deadline '2024-02-08T00:00:00Z' --delegation-string 'delegatevote2024' --out election --voters-file initial-weights.csv --guardian 31bTNa42u1zZWag2bknEy7VraeJUozXsJMN1DFjQp7E5YR6a3G --guardian 4PF6BH8bKvM48b8KNYdvGW6Sv3B2nqVRiMnWTj9cvaNHJQeX3D --candidate candidate1.json --candidate https://some.url/candidate2.json --node 'https://grpc.testnet.concordium.com:20000' --base-url https://gcvoting.testnet.concordium.com`
60+
election-coordinator new-election --module ../contracts/concordium-governance-committee-election/concordium-out/module.wasm.v1 --threshold 1 --admin ../test-scripts/keys/2yJxX711aDXtit7zMu7PHqUMbtwQ8zm7emaikg24uyZtvLTysj.export --election-start '2024-02-01T00:00:00Z' --election-end '2024-02-07T00:00:00Z' --decryption-deadline '2024-02-08T00:00:00Z' --delegation-string 'delegatevote2024' --out election --voters-file initial-weights.csv --voters-params-file initial-weights-params.json --guardian 31bTNa42u1zZWag2bknEy7VraeJUozXsJMN1DFjQp7E5YR6a3G --guardian 4PF6BH8bKvM48b8KNYdvGW6Sv3B2nqVRiMnWTj9cvaNHJQeX3D --candidate candidate1.json --candidate https://some.url/candidate2.json --node 'https://grpc.testnet.concordium.com:20000' --base-url https://gcvoting.testnet.concordium.com`
6161
6262
The options are:
6363

@@ -75,6 +75,8 @@ The options are:
7575

7676
``--voters-file`` is the initial-weights.csv file for the election
7777

78+
``--voters-params-file`` is the initial-weights-params.json file for the election, containing the params used to compute the initial weights.
79+
7880
``--guardian`` (repeated) is guardian account addresses. At least one is needed.
7981

8082
``--candidate`` (repeated) is a URL or a path to a candidate. The order here matters, since that will be the order of selections in the election. The link is to the candidate metadata. The hash of the metadata will be embedded in the contract.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
.. _verify-election-result:
2+
.. include:: ../../variables.rst
3+
4+
======================
5+
Verify election result
6+
======================
7+
8+
To verify that the result of an election is correctly computed as a third party, it is possible to execute a sequence of commands using the ``election-coordinator`` tool.
9+
10+
In general, all the commands listed require specification of the concordium node and contract address to target:
11+
12+
- The ``--node`` argument for all commands should specify the address of a node on the network the election exists on.
13+
14+
- The ``--contract`` argument for all commands should specify the contract address of the election you want to verify.
15+
16+
Commands
17+
========
18+
19+
The tool has the following subcommands. All commands have a ``--help`` option which explains the input and output parameters.
20+
21+
Verify the list of initial weights
22+
----------------------------------
23+
24+
Use the ``initial-weights verify`` command to gather the average amount of CCD on an account in the given period. The intention is that this command is used to produce the initial weights of each account prior to the election starting and verify these against the weights registered in the contract. The output of this command is a CSV file used in the ``final-weights`` command after the election.
25+
26+
Example
27+
28+
.. code-block:: console
29+
30+
election-coordinator --node https://grpc.testnet.concordium.com:20000 initial-weights --out . verify --contract "<8836,0>"
31+
32+
The weights are stored in the initial-weights.csv file, and the corresponding parameters used to compute them are stored in initial-weights-params.json file in the current path directory.
33+
34+
Get the final weights
35+
---------------------
36+
37+
Use the ``final-weights`` command to compute the final weights taking into account the delegation. It takes initial weights in the initial-weights.csv into account and any delegations during the election period, outputting the result to final-weights.csv. The output of this command is used in the tally command.
38+
39+
Example
40+
41+
.. code-block:: console
42+
43+
election-coordinator --node https://grpc.testnet.concordium.com:20000 final-weights --contract "<8836,0>" --initial-weights initial-weights.csv --final-weights final-weights.csv
44+
45+
Verify the encrypted tally registered in the contract
46+
-----------------------------------------------------
47+
48+
The ``tally`` command uses the final-weights.csv generated above to compute the encrypted tally of the election and optionally posts it in the smart contract. This sums up all the votes during the election period and scales them according to the specified weights.
49+
50+
.. code-block:: console
51+
52+
election-coordinator --node https://grpc.testnet.concordium.com:20000 tally --contract "<8836,0>" --final-weights final-weights.csv
53+
54+
Verify the election result
55+
--------------------------
56+
57+
Use the ``final-result`` command after the guardians have each decrypted their share of the encrypted tally. This command will be used to combine the shares and check that it matches what you compute.
58+
59+
.. code-block:: console
60+
61+
election-coordinator --node https://grpc.testnet.concordium.com:20000 final-result --contract "<8836,0>"
62+
63+
This will look up all the decryption shares provided by the guardians, check that they are valid, and if there are enough of the valid ones, it will decrypt the final result and publish it in the smart contract.

0 commit comments

Comments
 (0)