@maci-protocol/website 0.0.0-ci.5c85652 → 0.0.0-ci.5d489df

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. package/blog/2024-02-28-maci-v1.2.0.md +1 -1
  2. package/blog/2025-03-21-roadmap-2025.md +1 -1
  3. package/blog/2025-08-18-maci-aragon-plugin.md +107 -0
  4. package/blog/2025-09-05-maci-coordinator-service.md +167 -0
  5. package/docusaurus.config.ts +7 -1
  6. package/package.json +9 -8
  7. package/versioned_docs/version-v0.x/contract.md +1 -1
  8. package/versioned_docs/version-v0.x/introduction.md +0 -4
  9. package/versioned_docs/version-v0.x/quadratic-vote-tallying-circuit.md +1 -1
  10. package/versioned_docs/version-v1.2/circuits.md +8 -8
  11. package/versioned_docs/version-v1.2/contributing/contributing.md +4 -4
  12. package/versioned_docs/version-v1.2/deployment.md +1 -1
  13. package/versioned_docs/version-v1.2/integrating.md +1 -1
  14. package/versioned_docs/version-v1.2/key-change.md +1 -1
  15. package/versioned_docs/version-v1.2/poll-types.md +1 -1
  16. package/versioned_docs/version-v1.2/testing-in-detail.md +3 -3
  17. package/versioned_docs/version-v1.2/testing.md +1 -1
  18. package/versioned_docs/version-v1.2/topup.md +1 -1
  19. package/versioned_docs/version-v1.2/typedoc/core/index.md +2 -2
  20. package/versioned_docs/version-v1.2/versioning.md +3 -3
  21. package/versioned_docs/version-v1.2/workflow.md +1 -1
  22. package/versioned_docs/version-v2.x/contributing/contributing.md +4 -4
  23. package/versioned_docs/version-v2.x/core-concepts/key-change.md +1 -1
  24. package/versioned_docs/version-v2.x/core-concepts/merkle-trees.md +1 -1
  25. package/versioned_docs/version-v2.x/core-concepts/poll-types.md +1 -1
  26. package/versioned_docs/version-v2.x/core-concepts/workflow.md +1 -1
  27. package/versioned_docs/version-v2.x/guides/integrating.md +1 -1
  28. package/versioned_docs/version-v2.x/guides/testing/testing-in-detail.md +3 -3
  29. package/versioned_docs/version-v2.x/guides/testing/testing.md +1 -1
  30. package/versioned_docs/version-v2.x/processes/versioning.md +3 -3
  31. package/versioned_docs/version-v2.x/supported-networks/deployed-contracts.md +7 -7
  32. package/versioned_docs/version-v2.x/technical-references/smart-contracts/AccQueue.md +1 -1
  33. package/versioned_docs/version-v2.x/technical-references/smart-contracts/MACI.md +1 -1
  34. package/versioned_docs/version-v2.x/technical-references/smart-contracts/MessageProcessor.md +1 -1
  35. package/versioned_docs/version-v2.x/technical-references/smart-contracts/Params.md +1 -1
  36. package/versioned_docs/version-v2.x/technical-references/smart-contracts/Poll.md +1 -1
  37. package/versioned_docs/version-v2.x/technical-references/smart-contracts/PollFactory.md +1 -1
  38. package/versioned_docs/version-v2.x/technical-references/smart-contracts/Tally.md +1 -1
  39. package/versioned_docs/version-v2.x/technical-references/smart-contracts/VkRegistry.md +1 -1
  40. package/versioned_docs/version-v2.x/technical-references/smart-contracts/VoiceCreditProxy.md +1 -1
  41. package/versioned_docs/version-v2.x/technical-references/zk-snark-circuits/processMessages.md +4 -4
  42. package/versioned_docs/version-v2.x/technical-references/zk-snark-circuits/tallyVotes.md +2 -2
  43. package/versioned_docs/version-v2.x/technical-references/zk-snark-circuits/zk-snark-circuits.md +3 -3
  44. package/versioned_docs/version-v3.x/contributing/contributing.md +11 -5
  45. package/versioned_docs/version-v3.x/core-concepts/key-change.md +1 -1
  46. package/versioned_docs/version-v3.x/core-concepts/poll-types.md +1 -1
  47. package/versioned_docs/version-v3.x/core-concepts/polls.md +1 -1
  48. package/versioned_docs/version-v3.x/core-concepts/workflow.md +1 -1
  49. package/versioned_docs/version-v3.x/guides/integrating.md +2 -2
  50. package/versioned_docs/version-v3.x/guides/sdk.md +121 -0
  51. package/versioned_docs/version-v3.x/guides/testing/testing-in-detail.md +3 -3
  52. package/versioned_docs/version-v3.x/guides/testing/testing-introduction.md +30 -4
  53. package/versioned_docs/version-v3.x/guides/troubleshooting.md +2 -2
  54. package/versioned_docs/version-v3.x/processes/versioning.md +3 -3
  55. package/versioned_docs/version-v3.x/security/trusted-setup.md +1 -1
  56. package/versioned_docs/version-v3.x/supported-networks/costs.md +306 -0
  57. package/versioned_docs/version-v3.x/supported-networks/deployed-contracts.md +7 -7
  58. package/versioned_docs/version-v3.x/technical-references/coordinator-service/index.md +15 -1
  59. package/versioned_docs/version-v3.x/technical-references/coordinator-service/installation.md +5 -33
  60. package/versioned_docs/version-v3.x/technical-references/coordinator-service/usage.md +64 -0
  61. package/versioned_docs/version-v3.x/technical-references/smart-contracts/MACI.md +1 -1
  62. package/versioned_docs/version-v3.x/technical-references/smart-contracts/MessageProcessor.md +1 -1
  63. package/versioned_docs/version-v3.x/technical-references/smart-contracts/Params.md +1 -1
  64. package/versioned_docs/version-v3.x/technical-references/smart-contracts/Policies.md +1 -1
  65. package/versioned_docs/version-v3.x/technical-references/smart-contracts/Poll.md +1 -1
  66. package/versioned_docs/version-v3.x/technical-references/smart-contracts/PollFactory.md +1 -1
  67. package/versioned_docs/version-v3.x/technical-references/smart-contracts/Tally.md +1 -1
  68. package/versioned_docs/version-v3.x/technical-references/smart-contracts/VkRegistry.md +1 -1
  69. package/versioned_docs/version-v3.x/technical-references/smart-contracts/VoiceCreditProxy.md +1 -1
  70. package/versioned_docs/version-v3.x/technical-references/technical-references.md +8 -8
  71. package/versioned_docs/version-v3.x/technical-references/zk-snark-circuits/joinPoll.md +1 -1
  72. package/versioned_docs/version-v3.x/technical-references/zk-snark-circuits/processMessages.md +66 -6
  73. package/versioned_docs/version-v3.x/technical-references/zk-snark-circuits/tallyVotes.md +2 -2
  74. package/versioned_docs/version-v3.x/technical-references/zk-snark-circuits/zk-snark-circuits.md +3 -3
@@ -154,7 +154,7 @@ Within the circuits folder, there are a number of tests that are used to verify
154
154
 
155
155
  These tests often use mock data from the `core` package. For instance, when testing the `processMessages` circuit, we are required to generate the parameters from the `core` packing, using the `Poll:processMessages` function. The same applies to vote tallying, where we need the `Poll:tally` function to be run first with mock users and vote messages.
156
156
 
157
- All of the tests run using test parameters, usually `10, 20, 2`, aside from the tests inside: [`ceremonyParam`](https://github.com/privacy-scaling-explorations/maci/blob/dev/circuits/ts/__tests__/CeremonyParams.test.ts) which use the parameters of the latest MACI ceremony. More details on the trusted setup can be found [here](/docs/security/trusted-setup).
157
+ All of the tests run using test parameters, usually `10, 20, 2`, aside from the tests inside: [`ceremonyParam`](https://github.com/privacy-scaling-explorations/maci/blob/main/circuits/ts/__tests__/CeremonyParams.test.ts) which use the parameters of the latest MACI ceremony. More details on the trusted setup can be found [here](/docs/security/trusted-setup).
158
158
 
159
159
  ### Core
160
160
 
@@ -162,7 +162,7 @@ The core package contains a number of tests that are used to verify that the cor
162
162
 
163
163
  These tests interact with the crypto and dombinobjs packages, where mock data comes from. Their main goal is to ensure that the core functions work as expected, and that the state is as expected after a series of operations.
164
164
 
165
- Currently, there is a blend of e2e and unit tests, where e2e tests are used to verify that the entire MACI local processing works as expected (users signup, publish votes, messages are processed and finally these votes are tallied). Unit tests on the other hand are used to verify that the core functions work as expected, such as `MessageProcessor` and `VoteTally`. You will find them in separate files, with e2e being [here](https://github.com/privacy-scaling-explorations/maci/blob/dev/core/ts/__tests__/e2e.test.ts) and unit tests in the other files.
165
+ Currently, there is a blend of e2e and unit tests, where e2e tests are used to verify that the entire MACI local processing works as expected (users signup, publish votes, messages are processed and finally these votes are tallied). Unit tests on the other hand are used to verify that the core functions work as expected, such as `MessageProcessor` and `VoteTally`. You will find them in separate files, with e2e being [here](https://github.com/privacy-scaling-explorations/maci/blob/main/core/ts/__tests__/e2e.test.ts) and unit tests in the other files.
166
166
 
167
167
  ### Domainobjs/Crypto tests
168
168
 
@@ -170,7 +170,7 @@ These tests are used to verify that MACI's primitives such as private keys work
170
170
 
171
171
  ## "Manual" Testing
172
172
 
173
- To ensure that the MACI stack works as expected, without having to run the entire test suite (or even just the e2e tests), there is a [bash script](https://github.com/privacy-scaling-explorations/maci/blob/dev/packages/contracts/testScriptLocalhost.sh) inside the contracts folder which can be used.
173
+ To ensure that the MACI stack works as expected, without having to run the entire test suite (or even just the e2e tests), there is a [bash script](https://github.com/privacy-scaling-explorations/maci/blob/main/packages/contracts/testScriptLocalhost.sh) inside the contracts folder which can be used.
174
174
 
175
175
  This script contains a number of actions which touch all of the parts of MACI, and resemble exactly what other e2e tests do.
176
176
 
@@ -53,6 +53,32 @@ To run Contracts only tests, run:
53
53
  pnpm run test
54
54
  ```
55
55
 
56
+ To run e2e tests for hardhat tasks for `contracts` using the in-memory hardhat network:
57
+
58
+ ```bash
59
+ pnpm run test:hardhat
60
+ ```
61
+
62
+ You can update the `deploy-config.json` file to change policies or other deployment settings used by the test.
63
+
64
+ You can enhance test reporting and gas cost estimation by adding the following variables to your `.env` file:
65
+
66
+ ```bash
67
+ # CoinMarkerCap api key for prices (gas reporter)
68
+ COINMARKETCAP_API_KEY=
69
+ # Gas price for gas reporter
70
+ # Allows you to manually specify the gas price (e.g. 3 gwei)
71
+ GAS_REPORTER_PRICE=
72
+ ```
73
+
74
+ These variables are used by `hardhat-gas-reporter` to show cost estimates for gas usage in the test reports.
75
+
76
+ If you would like to run these E2E tests against a different [supported networks](/docs/supported-networks/), you can override the network like this:
77
+
78
+ ```bash
79
+ pnpm exec hardhat test --network {NETWORK} ./tests/e2e/hardhatTasks.test.ts
80
+ ```
81
+
56
82
  ### Circuits
57
83
 
58
84
  To test the circuits, from the main `maci/` directory, run:
@@ -86,7 +112,7 @@ circuits.
86
112
 
87
113
  Note the locations of the `.zkey` files as the smart contract tasks require them as part of the JSON configuration file.
88
114
 
89
- For testing purposes you can download the required artifacts using the [`download-zkeys:test`](https://github.com/privacy-scaling-explorations/maci/blob/dev/package.json#L15). The script will place all required artifacts inside the `cli/zkeys` folder.
115
+ For testing purposes you can download the required artifacts using the [`download-zkeys:test`](https://github.com/privacy-scaling-explorations/maci/blob/main/package.json#L15). The script will place all required artifacts inside the `cli/zkeys` folder.
90
116
 
91
117
  You can run the script directly with bash or use pnpm: `pnpm run download:test-zkeys` from the monorepo root.
92
118
 
@@ -97,19 +123,19 @@ From the root folder, run:
97
123
  **for c++ witness generator**
98
124
 
99
125
  ```bash
100
- pnpm build:circuits-c -- --outPath ../testing/zkeys
126
+ pnpm build:circuits-c -- --outPath ../../zkeys
101
127
  ```
102
128
 
103
129
  **for wasm witness generator**
104
130
 
105
131
  ```bash
106
- pnpm build:circuits-wasm -- --outPath ../testing/zkeys
132
+ pnpm build:circuits-wasm -- --outPath ../../zkeys
107
133
  ```
108
134
 
109
135
  **generate zkeys**
110
136
 
111
137
  ```bash
112
- pnpm setup:zkeys --outPath ../testing/zkeys
138
+ pnpm setup:zkeys --outPath ../../zkeys
113
139
  ```
114
140
 
115
141
  ### Check the Rapidsnark binary
@@ -71,7 +71,7 @@ Error: commitment mismatch
71
71
 
72
72
  This is because commitments are generated using random salts, thus will differ at each `generateProofs` run.
73
73
 
74
- In [core/Poll.ts](https://github.com/privacy-scaling-explorations/maci/blob/dev/packages/core/ts/Poll.ts):
74
+ In [core/Poll.ts](https://github.com/privacy-scaling-explorations/maci/blob/main/packages/core/ts/Poll.ts):
75
75
 
76
76
  ```
77
77
  let newSbSalt = genRandomSalt();
@@ -140,7 +140,7 @@ event MergeMessageAqSubRoots(uint256 indexed _numSrQueueOps);
140
140
  event MergeMessageAq(uint256 indexed _messageRoot);
141
141
  ```
142
142
 
143
- Please remember to pull the latest MACI repo updates(`git fetch origin && git pull origin dev`) and run `pnpm build` in the root of this monorepo.
143
+ Please remember to pull the latest MACI repo updates(`git fetch origin && git pull origin main`) and run `pnpm build` in the root of this monorepo.
144
144
 
145
145
  ### Verifier contract found the proof invalid
146
146
 
@@ -19,7 +19,7 @@ MACI follows the [Semantic Versioning Specification (SemVer)](https://semver.org
19
19
 
20
20
  All MACI packages are organized in our monorepo and follow a global release approach, meaning that all packages have the same version.
21
21
 
22
- Currently, MACI core team manually decides when to release and what the version should be. Packages are released [automatically via CI](https://github.com/privacy-scaling-explorations/maci/blob/dev/.github/workflows/release.yml) when a new tag is created in GitHub. [You can view our releases and tags in GitHub](https://github.com/privacy-scaling-explorations/maci/releases).
22
+ Currently, MACI core team manually decides when to release and what the version should be. Packages are released [automatically via CI](https://github.com/privacy-scaling-explorations/maci/blob/main/.github/workflows/release.yml) when a new tag is created in GitHub. [You can view our releases and tags in GitHub](https://github.com/privacy-scaling-explorations/maci/releases).
23
23
 
24
24
  ## MACI Release Process
25
25
 
@@ -37,10 +37,10 @@ Version number '1.2.3' is used here as an example. You should replace the versio
37
37
  git clone https://github.com/privacy-scaling-explorations/maci
38
38
  ```
39
39
 
40
- 3. Switch to the `dev` branch:
40
+ 3. Switch to the `main` branch:
41
41
 
42
42
  ```
43
- git checkout dev
43
+ git checkout main
44
44
  ```
45
45
 
46
46
  4. Install required dependencies:
@@ -17,7 +17,7 @@ to manage a large amount of value, and if their users accept that the risk of
17
17
  coordinator misbehaviour is insufficient to justify doing the work of a
18
18
  trusted setup. After all, MACI's security model presumes a trusted coordinator.
19
19
 
20
- The [PSE team](https://pse.dev/) is making available a trusted set of zKeys for MACI's circuits,
20
+ The [PSE team](https://pse.main/) is making available a trusted set of zKeys for MACI's circuits,
21
21
  which are available and accessible on
22
22
  [p0tion's website](https://ceremony.pse.dev/).
23
23
  For more info on trusted setup ceremonies please refer to p0tion's [docs](https://p0tion.super.site/).
@@ -417,3 +417,309 @@ Below are the estimated costs for various MACI operations and deployments, assum
417
417
  | ZupassPolicyFactory | - | - | 785744 | 2.6 % | 0.0788 |
418
418
 
419
419
  </details>
420
+
421
+ ## Costs on Ethereum Mainnet
422
+
423
+ Below are the estimated costs for various MACI operations and deployments, assuming:
424
+
425
+ - **Gas price**: 7 gwei
426
+ - **ETH price**: $2526
427
+
428
+ <details>
429
+ <summary>Contract calls cost</summary>
430
+
431
+ | Contract | Method | Min | Max | Avg | USD (avg) |
432
+ | ---------------------------------------- | -------------------------- | ------- | ------- | ------- | --------- |
433
+ | AnonAadhaarCheckerFactory | deploy | - | - | 125971 | 2.23 |
434
+ | AnonAadhaarPolicy | enforce | - | - | 38141 | 0.67 |
435
+ | AnonAadhaarPolicy | setTarget | 50133 | 50167 | 50149 | 0.89 |
436
+ | AnonAadhaarPolicyFactory | deploy | - | - | 129387 | 2.29 |
437
+ | ConstantInitialVoiceCreditProxyFactory | deploy | - | - | 118665 | 2.10 |
438
+ | EASCheckerFactory | deploy | - | - | 155556 | 2.75 |
439
+ | EASPolicyFactory | deploy | - | - | 129387 | 2.29 |
440
+ | ERC20CheckerFactory | deploy | - | - | 125959 | 2.23 |
441
+ | ERC20PolicyFactory | deploy | - | - | 129365 | 2.29 |
442
+ | ERC20VotesCheckerFactory | deploy | - | - | 154673 | 2.74 |
443
+ | ERC20VotesInitialVoiceCreditProxyFactory | deploy | - | - | 176590 | 3.12 |
444
+ | ERC20VotesPolicyFactory | deploy | - | - | 129365 | 2.29 |
445
+ | FreeForAllCheckerFactory | deploy | - | - | 89376 | 1.58 |
446
+ | FreeForAllPolicyFactory | deploy | 129375 | 129387 | 129386 | 2.29 |
447
+ | GitcoinPassportCheckerFactory | deploy | - | - | 125937 | 2.23 |
448
+ | GitcoinPassportPolicyFactory | deploy | - | - | 129365 | 2.29 |
449
+ | HatsCheckerFactory | deploy | - | - | 169023 | 2.99 |
450
+ | HatsPolicyFactory | deploy | - | - | 129387 | 2.29 |
451
+ | MACI | deployPoll | 1580777 | 1583817 | 1581631 | 27.98 |
452
+ | MACI | signUp | 197667 | 730504 | 315320 | 5.58 |
453
+ | MerkleProofCheckerFactory | deploy | - | - | 119047 | 2.11 |
454
+ | MerkleProofPolicyFactory | deploy | - | - | 129387 | 2.29 |
455
+ | MessageProcessor | processMessages | 252065 | 252976 | 252375 | 4.46 |
456
+ | Poll | joinPoll | 282314 | 503970 | 334836 | 5.92 |
457
+ | Poll | mergeState | 176483 | 331802 | 232886 | 4.12 |
458
+ | Poll | padLastBatch | - | - | 81884 | 1.45 |
459
+ | Poll | publishMessage | - | - | 358677 | 6.34 |
460
+ | Poll | publishMessageBatch | - | - | 671442 | 11.88 |
461
+ | Poll | relayMessagesBatch | - | - | 155223 | 2.75 |
462
+ | PollFactory | deploy | - | - | 1099100 | 19.44 |
463
+ | SemaphoreCheckerFactory | deploy | - | - | 106047 | 1.88 |
464
+ | SemaphorePolicyFactory | deploy | - | - | 129387 | 2.29 |
465
+ | Tally | addTallyResults | 7312489 | 7844939 | 7578714 | 134.05 |
466
+ | Tally | tallyVotes | 147320 | 204580 | 161641 | 2.86 |
467
+ | TokenCheckerFactory | deploy | - | - | 97197 | 1.72 |
468
+ | TokenPolicyFactory | deploy | - | - | 129387 | 2.29 |
469
+ | VerifyingKeysRegistry | setPollJoinedVerifyingKey | - | - | 453033 | 8.01 |
470
+ | VerifyingKeysRegistry | setPollJoiningVerifyingKey | - | - | 453011 | 8.01 |
471
+ | VerifyingKeysRegistry | setVerifyingKeys | 885514 | 885526 | 885517 | 15.66 |
472
+ | VerifyingKeysRegistry | setVerifyingKeysBatch | - | - | 1787720 | 31.62 |
473
+ | ZupassCheckerFactory | deploy | - | - | 206318 | 3.65 |
474
+ | ZupassPolicyFactory | deploy | - | - | 129365 | 2.29 |
475
+
476
+ </details>
477
+
478
+ <details>
479
+ <summary>Deployment cost</summary>
480
+
481
+ | Deployments | Min Gas | Max Gas | Avg Gas | % of Block Limit | USD (avg) |
482
+ | ---------------------------------------- | ------- | ------- | ------- | ---------------- | --------- |
483
+ | AnonAadhaarCheckerFactory | - | - | 567621 | 1.9 % | 10.04 |
484
+ | AnonAadhaarPolicyFactory | - | - | 759390 | 2.5 % | 13.43 |
485
+ | ConstantInitialVoiceCreditProxyFactory | - | - | 379812 | 1.3 % | 6.72 |
486
+ | EASCheckerFactory | - | - | 623304 | 2.1 % | 11.02 |
487
+ | EASPolicyFactory | - | - | 690560 | 2.3 % | 12.21 |
488
+ | ERC20CheckerFactory | - | - | 446429 | 1.5 % | 7.90 |
489
+ | ERC20PolicyFactory | - | - | 684892 | 2.3 % | 12.11 |
490
+ | ERC20VotesCheckerFactory | - | - | 464123 | 1.5 % | 8.21 |
491
+ | ERC20VotesInitialVoiceCreditProxyFactory | - | - | 482127 | 1.6 % | 8.53 |
492
+ | ERC20VotesPolicyFactory | - | - | 685960 | 2.3 % | 12.13 |
493
+ | FreeForAllCheckerFactory | - | - | 329927 | 1.1 % | 5.84 |
494
+ | FreeForAllPolicyFactory | - | - | 653501 | 2.2 % | 11.56 |
495
+ | GitcoinPassportCheckerFactory | - | - | 463912 | 1.5 % | 8.21 |
496
+ | GitcoinPassportPolicyFactory | - | - | 687052 | 2.3 % | 12.15 |
497
+ | Hasher | - | - | 426472 | 1.4 % | 7.54 |
498
+ | HatsCheckerFactory | - | - | 572538 | 1.9 % | 10.13 |
499
+ | HatsPolicyFactory | - | - | 684664 | 2.3 % | 12.11 |
500
+ | MACI | 1803354 | 1803438 | 1803408 | 6 % | 31.90 |
501
+ | MerkleProofCheckerFactory | - | - | 491985 | 1.6 % | 8.70 |
502
+ | MerkleProofPolicyFactory | - | - | 686188 | 2.3 % | 12.14 |
503
+ | MessageProcessorFactory | 1818377 | 1818401 | 1818398 | 6.1 % | 32.16 |
504
+ | PollFactory | 3725815 | 3725863 | 3725858 | 12.4 % | 65.90 |
505
+ | PoseidonT3 | - | - | 2157126 | 7.2 % | 38.15 |
506
+ | PoseidonT4 | - | - | 2745274 | 9.2 % | 48.56 |
507
+ | PoseidonT5 | - | - | 3569887 | 11.9 % | 63.14 |
508
+ | PoseidonT6 | - | - | 4261625 | 14.2 % | 75.38 |
509
+ | SemaphoreCheckerFactory | - | - | 557606 | 1.9 % | 9.86 |
510
+ | SemaphorePolicyFactory | - | - | 749517 | 2.5 % | 13.26 |
511
+ | TallyFactory | 2207358 | 2207382 | 2207379 | 7.4 % | 39.04 |
512
+ | TokenCheckerFactory | - | - | 435769 | 1.5 % | 7.71 |
513
+ | TokenPolicyFactory | - | - | 690920 | 2.3 % | 12.22 |
514
+ | Utilities | - | - | 664356 | 2.2 % | 11.75 |
515
+ | Verifier | - | - | 775226 | 2.6 % | 13.71 |
516
+ | VerifyingKeysRegistry | - | - | 1755862 | 5.9 % | 31.06 |
517
+ | ZupassCheckerFactory | - | - | 640425 | 2.1 % | 11.33 |
518
+ | ZupassGroth16Verifier | - | - | 1108706 | 3.7 % | 19.61 |
519
+ | ZupassPolicyFactory | - | - | 785744 | 2.6 % | 13.90 |
520
+
521
+ </details>
522
+
523
+ ## Costs on Arbitrum
524
+
525
+ Below are the estimated costs for various MACI operations and deployments, assuming:
526
+
527
+ - **Gas price**: 0.012 gwei
528
+ - **ETH price**: $2595
529
+
530
+ <details>
531
+ <summary>Contract calls cost</summary>
532
+
533
+ | Contract | Method | Min | Max | Avg | USD (avg) |
534
+ | ---------------------------------------- | -------------------------- | ------- | ------- | ------- | --------- |
535
+ | AnonAadhaarCheckerFactory | deploy | - | - | 125971 | 0.00402 |
536
+ | AnonAadhaarPolicy | enforce | - | - | 38141 | 0.00122 |
537
+ | AnonAadhaarPolicy | setTarget | 50133 | 50167 | 50149 | 0.0016 |
538
+ | AnonAadhaarPolicyFactory | deploy | - | - | 129387 | 0.00413 |
539
+ | ConstantInitialVoiceCreditProxyFactory | deploy | - | - | 118665 | 0.00379 |
540
+ | EASCheckerFactory | deploy | - | - | 155556 | 0.00497 |
541
+ | EASPolicyFactory | deploy | - | - | 129387 | 0.00413 |
542
+ | ERC20CheckerFactory | deploy | - | - | 125959 | 0.00402 |
543
+ | ERC20PolicyFactory | deploy | - | - | 129365 | 0.00413 |
544
+ | ERC20VotesCheckerFactory | deploy | - | - | 154673 | 0.00494 |
545
+ | ERC20VotesInitialVoiceCreditProxyFactory | deploy | - | - | 176590 | 0.00564 |
546
+ | ERC20VotesPolicyFactory | deploy | - | - | 129365 | 0.00413 |
547
+ | FreeForAllCheckerFactory | deploy | - | - | 89376 | 0.00286 |
548
+ | FreeForAllPolicyFactory | deploy | 129375 | 129387 | 129386 | 0.00413 |
549
+ | GitcoinPassportCheckerFactory | deploy | - | - | 125937 | 0.00402 |
550
+ | GitcoinPassportPolicyFactory | deploy | - | - | 129365 | 0.00413 |
551
+ | HatsCheckerFactory | deploy | - | - | 169023 | 0.0054 |
552
+ | HatsPolicyFactory | deploy | - | - | 129387 | 0.00413 |
553
+ | MACI | deployPoll | 1580765 | 1583829 | 1581626 | 0.05052 |
554
+ | MACI | signUp | 197667 | 730480 | 315320 | 0.01007 |
555
+ | MerkleProofCheckerFactory | deploy | - | - | 119047 | 0.0038 |
556
+ | MerkleProofPolicyFactory | deploy | - | - | 129387 | 0.00413 |
557
+ | MessageProcessor | processMessages | 252019 | 252918 | 252319 | 0.00806 |
558
+ | Poll | joinPoll | 282314 | 503970 | 334837 | 0.0107 |
559
+ | Poll | mergeState | 198686 | 354005 | 255089 | 0.00815 |
560
+ | Poll | padLastBatch | - | - | 81884 | 0.00262 |
561
+ | Poll | publishMessage | - | - | 358725 | 0.01146 |
562
+ | Poll | publishMessageBatch | - | - | 671490 | 0.02145 |
563
+ | Poll | relayMessagesBatch | - | - | 155235 | 0.00496 |
564
+ | PollFactory | deploy | - | - | 1099100 | 0.03511 |
565
+ | SemaphoreCheckerFactory | deploy | - | - | 106047 | 0.00339 |
566
+ | SemaphorePolicyFactory | deploy | - | - | 129387 | 0.00413 |
567
+ | Tally | addTallyResults | 7311562 | 7844012 | 7577787 | 0.24207 |
568
+ | Tally | tallyVotes | 147262 | 204522 | 161585 | 0.00516 |
569
+ | TokenCheckerFactory | deploy | - | - | 97197 | 0.0031 |
570
+ | TokenPolicyFactory | deploy | - | - | 129387 | 0.00413 |
571
+ | VerifyingKeysRegistry | setPollJoinedVerifyingKey | - | - | 453033 | 0.01447 |
572
+ | VerifyingKeysRegistry | setPollJoiningVerifyingKey | - | - | 453011 | 0.01447 |
573
+ | VerifyingKeysRegistry | setVerifyingKeys | 885514 | 885526 | 885517 | 0.02829 |
574
+ | VerifyingKeysRegistry | setVerifyingKeysBatch | - | - | 1787720 | 0.05711 |
575
+ | ZupassCheckerFactory | deploy | - | - | 206318 | 0.00659 |
576
+ | ZupassPolicyFactory | deploy | - | - | 129365 | 0.00413 |
577
+
578
+ </details>
579
+
580
+ <details>
581
+ <summary>Deployment cost</summary>
582
+
583
+ | Deployments | Min Gas | Max Gas | Avg Gas | % of Limit | USD (avg) |
584
+ | ---------------------------------------- | ------- | ------- | ------- | ---------- | --------- |
585
+ | AnonAadhaarCheckerFactory | - | - | 567621 | 1.9% | 0.01813 |
586
+ | AnonAadhaarPolicyFactory | - | - | 759390 | 2.5% | 0.02426 |
587
+ | ConstantInitialVoiceCreditProxyFactory | - | - | 379812 | 1.3% | 0.01213 |
588
+ | EASCheckerFactory | - | - | 623304 | 2.1% | 0.01991 |
589
+ | EASPolicyFactory | - | - | 690560 | 2.3% | 0.02206 |
590
+ | ERC20CheckerFactory | - | - | 446429 | 1.5% | 0.01426 |
591
+ | ERC20PolicyFactory | - | - | 684892 | 2.3% | 0.02188 |
592
+ | ERC20VotesCheckerFactory | - | - | 464123 | 1.5% | 0.01483 |
593
+ | ERC20VotesInitialVoiceCreditProxyFactory | - | - | 482127 | 1.6% | 0.01540 |
594
+ | ERC20VotesPolicyFactory | - | - | 685960 | 2.3% | 0.02191 |
595
+ | FreeForAllCheckerFactory | - | - | 329927 | 1.1% | 0.01054 |
596
+ | FreeForAllPolicyFactory | - | - | 653501 | 2.2% | 0.02088 |
597
+ | GitcoinPassportCheckerFactory | - | - | 463912 | 1.5% | 0.01482 |
598
+ | GitcoinPassportPolicyFactory | - | - | 687052 | 2.3% | 0.02195 |
599
+ | Hasher | - | - | 426472 | 1.4% | 0.01362 |
600
+ | HatsCheckerFactory | - | - | 572538 | 1.9% | 0.01829 |
601
+ | HatsPolicyFactory | - | - | 684664 | 2.3% | 0.02187 |
602
+ | MACI | 1803354 | 1803438 | 1803408 | 6.0% | 0.05761 |
603
+ | MerkleProofCheckerFactory | - | - | 491985 | 1.6% | 0.01572 |
604
+ | MerkleProofPolicyFactory | - | - | 686188 | 2.3% | 0.02192 |
605
+ | MessageProcessorFactory | 1818377 | 1818401 | 1818398 | 6.1% | 0.05809 |
606
+ | PollFactory | 3720635 | 3720683 | 3720678 | 12.4% | 0.11885 |
607
+ | PoseidonT3 | - | - | 2157126 | 7.2% | 0.06891 |
608
+ | PoseidonT4 | - | - | 2745274 | 9.2% | 0.0877 |
609
+ | PoseidonT5 | - | - | 3569887 | 11.9% | 0.11404 |
610
+ | PoseidonT6 | - | - | 4261625 | 14.2% | 0.13613 |
611
+ | SemaphoreCheckerFactory | - | - | 557606 | 1.9% | 0.01781 |
612
+ | SemaphorePolicyFactory | - | - | 749517 | 2.5% | 0.02394 |
613
+ | TallyFactory | 2176647 | 2176671 | 2176668 | 7.3% | 0.06953 |
614
+ | TokenCheckerFactory | - | - | 435769 | 1.5% | 0.01392 |
615
+ | TokenPolicyFactory | - | - | 690920 | 2.3% | 0.02207 |
616
+ | Utilities | - | - | 664356 | 2.2% | 0.02122 |
617
+ | Verifier | - | - | 775226 | 2.6% | 0.02476 |
618
+ | VerifyingKeysRegistry | - | - | 1755862 | 5.9% | 0.05609 |
619
+ | ZupassCheckerFactory | - | - | 640425 | 2.1% | 0.02046 |
620
+ | ZupassGroth16Verifier | - | - | 1108706 | 3.7% | 0.03542 |
621
+ | ZupassPolicyFactory | - | - | 785744 | 2.6% | 0.0251 |
622
+
623
+ </details>
624
+
625
+ ## Costs on Optimism
626
+
627
+ Below are the estimated costs for various MACI operations and deployments, assuming:
628
+
629
+ - **Gas price**: 0.016 gwei
630
+ - **ETH price**: $2493
631
+
632
+ <details>
633
+ <summary>Contract calls cost</summary>
634
+
635
+ | Contract | Method | Min | Max | Avg | USD (avg) |
636
+ | ---------------------------------------- | -------------------------- | ------- | ------- | ------- | --------- |
637
+ | AnonAadhaarCheckerFactory | deploy | - | - | 125971 | 0.00496 |
638
+ | AnonAadhaarPolicy | enforce | - | - | 38141 | 0.0016 |
639
+ | AnonAadhaarPolicy | setTarget | 50133 | 50167 | 50149 | 0.00208 |
640
+ | AnonAadhaarPolicyFactory | deploy | - | - | 129387 | 0.00512 |
641
+ | ConstantInitialVoiceCreditProxyFactory | deploy | - | - | 118665 | 0.0048 |
642
+ | EASCheckerFactory | deploy | - | - | 155556 | 0.00624 |
643
+ | EASPolicyFactory | deploy | - | - | 129387 | 0.00512 |
644
+ | ERC20CheckerFactory | deploy | - | - | 125959 | 0.00496 |
645
+ | ERC20PolicyFactory | deploy | - | - | 129365 | 0.00512 |
646
+ | ERC20VotesCheckerFactory | deploy | - | - | 154673 | 0.00624 |
647
+ | ERC20VotesInitialVoiceCreditProxyFactory | deploy | - | - | 176590 | 0.00704 |
648
+ | ERC20VotesPolicyFactory | deploy | - | - | 129365 | 0.00512 |
649
+ | FreeForAllCheckerFactory | deploy | - | - | 89376 | 0.00352 |
650
+ | FreeForAllPolicyFactory | deploy | 129375 | 129387 | 129386 | 0.00512 |
651
+ | GitcoinPassportCheckerFactory | deploy | - | - | 125937 | 0.00496 |
652
+ | GitcoinPassportPolicyFactory | deploy | - | - | 129365 | 0.00512 |
653
+ | HatsCheckerFactory | deploy | - | - | 169023 | 0.00672 |
654
+ | HatsPolicyFactory | deploy | - | - | 129387 | 0.00512 |
655
+ | MACI | deployPoll | 1580765 | 1583829 | 1581630 | 0.06304 |
656
+ | MACI | signUp | 197667 | 730492 | 315320 | 0.01264 |
657
+ | MerkleProofCheckerFactory | deploy | - | - | 119047 | 0.0048 |
658
+ | MerkleProofPolicyFactory | deploy | - | - | 129387 | 0.00512 |
659
+ | MessageProcessor | processMessages | 252007 | 252918 | 252317 | 0.01008 |
660
+ | Poll | joinPoll | 282314 | 503970 | 334835 | 0.01328 |
661
+ | Poll | mergeState | 198686 | 354005 | 255089 | 0.01024 |
662
+ | Poll | padLastBatch | - | - | 81884 | 0.0032 |
663
+ | Poll | publishMessage | - | - | 358725 | 0.01424 |
664
+ | Poll | publishMessageBatch | - | - | 671502 | 0.02672 |
665
+ | Poll | relayMessagesBatch | - | - | 155235 | 0.00624 |
666
+ | PollFactory | deploy | - | - | 1099088 | 0.04384 |
667
+ | SemaphoreCheckerFactory | deploy | - | - | 106047 | 0.00416 |
668
+ | SemaphorePolicyFactory | deploy | - | - | 129387 | 0.00512 |
669
+ | Tally | addTallyResults | 7311562 | 7844012 | 7577787 | 0.30224 |
670
+ | Tally | tallyVotes | 147262 | 204522 | 161585 | 0.0064 |
671
+ | TokenCheckerFactory | deploy | - | - | 97197 | 0.00384 |
672
+ | TokenPolicyFactory | deploy | - | - | 129387 | 0.00512 |
673
+ | VerifyingKeysRegistry | setPollJoinedVerifyingKey | - | - | 453033 | 0.01808 |
674
+ | VerifyingKeysRegistry | setPollJoiningVerifyingKey | - | - | 453011 | 0.01808 |
675
+ | VerifyingKeysRegistry | setVerifyingKeys | 885514 | 885526 | 885517 | 0.03536 |
676
+ | VerifyingKeysRegistry | setVerifyingKeysBatch | - | - | 1787720 | 0.07136 |
677
+ | ZupassCheckerFactory | deploy | - | - | 206318 | 0.00816 |
678
+ | ZupassPolicyFactory | deploy | - | - | 129365 | 0.00512 |
679
+
680
+ </details>
681
+
682
+ <details>
683
+ <summary>Deployment cost</summary>
684
+
685
+ | Deployments | Min Gas | Max Gas | Avg Gas | % of Block Limit | USD (avg) |
686
+ | ---------------------------------------- | ------- | ------- | ------- | ---------------- | --------- |
687
+ | AnonAadhaarCheckerFactory | - | - | 567621 | 1.9 % | 0.02272 |
688
+ | AnonAadhaarPolicyFactory | - | - | 759390 | 2.5 % | 0.03024 |
689
+ | ConstantInitialVoiceCreditProxyFactory | - | - | 379812 | 1.3 % | 0.0152 |
690
+ | EASCheckerFactory | - | - | 623304 | 2.1 % | 0.0248 |
691
+ | EASPolicyFactory | - | - | 690560 | 2.3 % | 0.02752 |
692
+ | ERC20CheckerFactory | - | - | 446429 | 1.5 % | 0.01776 |
693
+ | ERC20PolicyFactory | - | - | 684892 | 2.3 % | 0.02736 |
694
+ | ERC20VotesCheckerFactory | - | - | 464123 | 1.5 % | 0.01856 |
695
+ | ERC20VotesInitialVoiceCreditProxyFactory | - | - | 482127 | 1.6 % | 0.0192 |
696
+ | ERC20VotesPolicyFactory | - | - | 685960 | 2.3 % | 0.02736 |
697
+ | FreeForAllCheckerFactory | - | - | 329927 | 1.1 % | 0.01312 |
698
+ | FreeForAllPolicyFactory | - | - | 653501 | 2.2 % | 0.02608 |
699
+ | GitcoinPassportCheckerFactory | - | - | 463912 | 1.5 % | 0.01856 |
700
+ | GitcoinPassportPolicyFactory | - | - | 687052 | 2.3 % | 0.02736 |
701
+ | Hasher | - | - | 426472 | 1.4 % | 0.01696 |
702
+ | HatsCheckerFactory | - | - | 572538 | 1.9 % | 0.02288 |
703
+ | HatsPolicyFactory | - | - | 684664 | 2.3 % | 0.02736 |
704
+ | MACI | 1803354 | 1803438 | 1803408 | 6.0 % | 0.072 |
705
+ | MerkleProofCheckerFactory | - | - | 491985 | 1.6 % | 0.01968 |
706
+ | MerkleProofPolicyFactory | - | - | 686188 | 2.3 % | 0.02736 |
707
+ | MessageProcessorFactory | 1818377 | 1818401 | 1818398 | 6.1 % | 0.07248 |
708
+ | PollFactory | 3720635 | 3720683 | 3720678 | 12.4 % | 0.14848 |
709
+ | PoseidonT3 | - | - | 2157126 | 7.2 % | 0.08608 |
710
+ | PoseidonT4 | - | - | 2745274 | 9.2 % | 0.1096 |
711
+ | PoseidonT5 | - | - | 3569887 | 11.9 % | 0.1424 |
712
+ | PoseidonT6 | - | - | 4261625 | 14.2 % | 0.17008 |
713
+ | SemaphoreCheckerFactory | - | - | 557606 | 1.9 % | 0.02224 |
714
+ | SemaphorePolicyFactory | - | - | 749517 | 2.5 % | 0.02992 |
715
+ | TallyFactory | 2176647 | 2176671 | 2176668 | 7.3 % | 0.08688 |
716
+ | TokenCheckerFactory | - | - | 435769 | 1.5 % | 0.01744 |
717
+ | TokenPolicyFactory | - | - | 690920 | 2.3 % | 0.02752 |
718
+ | Utilities | - | - | 664356 | 2.2 % | 0.02656 |
719
+ | Verifier | - | - | 775226 | 2.6 % | 0.03088 |
720
+ | VerifyingKeysRegistry | - | - | 1755862 | 5.9 % | 0.07008 |
721
+ | ZupassCheckerFactory | - | - | 640425 | 2.1 % | 0.0256 |
722
+ | ZupassGroth16Verifier | - | - | 1108706 | 3.7 % | 0.04416 |
723
+ | ZupassPolicyFactory | - | - | 785744 | 2.6 % | 0.03136 |
724
+
725
+ </details>
@@ -7,14 +7,14 @@ sidebar_position: 2
7
7
 
8
8
  There are a number of MACI's smart contracts which can be re-used by different deployments. These are the following:
9
9
 
10
- - [VerifyingKeysRegistry](https://github.com/privacy-scaling-explorations/maci/blob/dev/packages/contracts/contracts/VerifyingKeysRegistry.sol)
11
- - [PoseidonHashers](https://github.com/privacy-scaling-explorations/maci/blob/dev/packages/contracts/contracts/crypto/Hasher.sol)
12
- - [PollFactory](https://github.com/privacy-scaling-explorations/maci/blob/dev/packages/contracts/contracts/PollFactory.sol)
13
- - [MessageProcessorFactory](https://github.com/privacy-scaling-explorations/maci/blob/dev/packages/contracts/contracts/MessageProcessorFactory.sol)
14
- - [TallyFactory](https://github.com/privacy-scaling-explorations/maci/blob/dev/packages/contracts/contracts/TallyFactory.sol)
15
- - [Verifier](https://github.com/privacy-scaling-explorations/maci/blob/dev/packages/contracts/contracts/crypto/Verifier.sol)
10
+ - [VerifyingKeysRegistry](https://github.com/privacy-scaling-explorations/maci/blob/main/packages/contracts/contracts/VerifyingKeysRegistry.sol)
11
+ - [PoseidonHashers](https://github.com/privacy-scaling-explorations/maci/blob/main/packages/contracts/contracts/crypto/Hasher.sol)
12
+ - [PollFactory](https://github.com/privacy-scaling-explorations/maci/blob/main/packages/contracts/contracts/PollFactory.sol)
13
+ - [MessageProcessorFactory](https://github.com/privacy-scaling-explorations/maci/blob/main/packages/contracts/contracts/MessageProcessorFactory.sol)
14
+ - [TallyFactory](https://github.com/privacy-scaling-explorations/maci/blob/main/packages/contracts/contracts/TallyFactory.sol)
15
+ - [Verifier](https://github.com/privacy-scaling-explorations/maci/blob/main/packages/contracts/contracts/crypto/Verifier.sol)
16
16
  - [FreeForAllPolicy](https://github.com/privacy-scaling-explorations/excubiae/tree/main/packages/contracts/contracts/extensions/freeForAll)
17
- - [ConstantInitialVoiceCreditProxy](https://github.com/privacy-scaling-explorations/maci/blob/dev/packages/contracts/contracts/initialVoiceCreditProxy/ConstantInitialVoiceCreditProxy.sol) - if you are happy to work with a fixed amount of credits
17
+ - [ConstantInitialVoiceCreditProxy](https://github.com/privacy-scaling-explorations/maci/blob/main/packages/contracts/contracts/initialVoiceCreditProxy/ConstantInitialVoiceCreditProxy.sol) - if you are happy to work with a fixed amount of credits
18
18
 
19
19
  VkRegistries can be re-used by different protocols to share the same set of verifying keys. Please be advised that you should be verifying that those verifying keys are the ones that have undergone a trusted setup ceremony.
20
20
 
@@ -7,4 +7,18 @@ sidebar_position: 1
7
7
 
8
8
  # Coordinator Service
9
9
 
10
- Welcome to the Coordinator Service technical reference. Here you will find the technical details of the Coordinator Service, including the API endpoints and code examples.
10
+ Welcome to the Coordinator Service technical reference. This guide describes how the Coordinator Service works, its workflow, and how to interact with it. For more technical code documentation regarding API endpoints and data transfer objects, please refer to the [API documentation](https://coordinator.maci.vote/api).
11
+
12
+ ## Responsibilities
13
+
14
+ A MACI coordinator is responsible for running voting processes. In quadratic funding rounds or authority election rounds, the coordinator is the entity that defines who can vote, which projects or candidates are eligible for funding, and the duration of the voting round.
15
+
16
+ First of all, the coordinator needs to deploy the MACI smart contracts with the desired configuration: gatekeeper policy, which defines who can sign up as a voter; the state Merkle tree depth which defines the maximum number of voters; and the voting mode which defines how votes will be counted (more info in [Poll types](https://maci.pse.dev/docs/core-concepts/poll-types#quadratic-voting)).
17
+
18
+ After deploying the MACI contracts, the coordinator can deploy a poll (which represents a voting process). To deploy the poll, the coordinator needs to specify: the gatekeeper policy, which defines who can join the poll as a voter; the start and end dates of the poll; the number of options to vote for; the maximum number of votes per voter; and the voting mode.
19
+
20
+ The coordinator will then wait until the poll ends, after which they will need to finalize the poll. This involves processing all published messages, extracting the votes, tallying them, and submitting the results on-chain.
21
+
22
+ ## Conclusion
23
+
24
+ In the following documents, we will go through the details of setting up the Coordinator Service and how to interact with it to perform the tasks described above.
@@ -5,39 +5,11 @@ sidebar_label: Installation
5
5
  sidebar_position: 2
6
6
  ---
7
7
 
8
- 1. Add `.env` file (see `.env.example`).
9
- 2. Generate RSA key pair with `pnpm run generate-keypair`.
10
- 3. Download zkey files using `pnpm run download-zkeys:{type}` (only test type is available for now).
11
- 4. Make sure you copied RSA public key to your application. This will be needed for encrypting `Authorization` header and coordinator private key for proof generation. Also it can be accessed through API method `GET v1/proof/publicKey`.
12
- 5. Run `pnpm run start` to run the service.
13
- 6. All API calls must be called with `Authorization` header, where the value is encrypted with RSA public key you generated before. Header value contains message signature and message digest created by `COORDINATOR_ADDRESSES`. The format is `publicEncrypt({signature}:{digest})`.
14
- Make sure you set `COORDINATOR_ADDRESSES` env variable and sign any message with the addresses from your application (see [AccountSignatureGuard](./ts/auth/AccountSignatureGuard.service.ts)).
15
- 7. Proofs can be generated with `POST v1/proof/generate` API method or with Websockets (see [dto spec](./ts/proof/dto.ts), [controller](./ts/app.controller.ts) and [wsgateway](./ts/events/events.gateway.ts)).
16
-
17
- ## Subgraph deployment
18
-
19
- It is possible to deploy subgraph using coordinator service.
20
-
21
- First, you need to setup subgraph and create a project. [Subgraph dashboard](https://thegraph.com/studio/).
22
-
23
- Then, set env variables:
8
+ There are two ways to run the coordinator service: building it from source or using Docker. Both methods require you to clone the MACI repository and move to the project root directory.
24
9
 
10
+ ```bash
11
+ git clone https://github.com/privacy-scaling-explorations/maci
12
+ cd maci
25
13
  ```
26
- # Subgraph name
27
- SUBGRAPH_NAME="maci-subgraph"
28
-
29
- # Subgraph provider url
30
- SUBGRAPH_PROVIDER_URL=https://api.studio.thegraph.com/deploy/
31
-
32
- # Subgraph deploy key
33
- SUBGRAPH_DEPLOY_KEY=*******
34
14
 
35
- # Subgraph project folder
36
- SUBGRAPH_FOLDER=../subgraph
37
- ```
38
-
39
- After deployment, subgraph url will be available in studio dashboard and you can use this type of url to get latest deployed version in your application:
40
-
41
- ```
42
- https://api.studio.thegraph.com/.../{SUBGRAPH_NAME}/version/latest
43
- ```
15
+ You need to check the latest [README.md](https://github.com/privacy-ethereum/maci/tree/main/apps/coordinator) instructions in the coordinator service app for detailed information about requirements and steps to install, build, and run the service.
@@ -0,0 +1,64 @@
1
+ ---
2
+ title: Usage
3
+ description: Learn how to interact with a running MACI coordinator service instance.
4
+ sidebar_label: Usage
5
+ sidebar_position: 3
6
+ ---
7
+
8
+ After setting up and running the MACI coordinator service, you can interact with it through its RESTful API. The service provides various endpoints for deployment and finalization of polls. Please refer to the API documentation at [https://coordinator.maci.vote/api](https://coordinator.maci.vote/api) for the exact request format and required parameters for all endpoint calls described below.
9
+
10
+ # Authentication
11
+
12
+ The coordinator service uses a custom signature authentication mechanism to guard the deploy endpoints. To interact with these endpoints, you need to:
13
+
14
+ 1. Make sure you have run the command to set up and generate the RSA keypair, as described in the instructions section.
15
+
16
+ 2. Ensure that your Ethereum public key is set in the `.env` file under the `COORDINATOR_ADDRESSES` variable.
17
+
18
+ 3. Get the RSA public key from the coordinator service with [https://coordinator.maci.vote/v1/proof/publicKey](https://coordinator.maci.vote/v1/proof/publicKey).
19
+
20
+ 4. Sign a message such as "authenticate-me" using the coordinator's Ethereum private key.
21
+
22
+ 5. Encrypt both the message (also called digest) and its signature using the RSA public key. For example, you can use RSA public-key encryption in the format:
23
+
24
+ ```javascript
25
+ const payload: string = "signature:digest";
26
+ ```
27
+
28
+ Then encrypt this payload using the coordinator’s RSA public key.
29
+
30
+ # Deploy MACI
31
+
32
+ To deploy the set of MACI smart contracts, you need to call the endpoint [https://coordinator.maci.vote/v1/deploy/maci](https://coordinator.maci.vote/v1/deploy/maci) with a POST request. The request body should include the necessary parameters for the deployment, such as the gatekeeper policy, state tree depth, and voting mode.
33
+
34
+ # Deploy Poll
35
+
36
+ To deploy a new poll to an existing MACI instance, you need to call the endpoint [https://coordinator.maci.vote/v1/deploy/poll](https://coordinator.maci.vote/v1/deploy/poll) with a POST request. The request body should include the necessary parameters for the poll deployment, such as the gatekeeper policy, start and end dates, number of options, and voting mode.
37
+
38
+ # Deploy Subgraph
39
+
40
+ To deploy a subgraph for a MACI instance and its corresponding polls, you need to call the endpoint [https://coordinator.maci.vote/v1/subgraph/deploy](https://coordinator.maci.vote/v1/subgraph/deploy) with a POST request. The request body should include the necessary parameters for the subgraph deployment, such as the MACI contract address and the subgraph name.
41
+
42
+ # Finalize Poll
43
+
44
+ To finalize a poll, you need to follow a series of steps that involve processing messages, merging state trees, generating proofs, and submitting the final tally on-chain. The Coordinator Service provides endpoints for each of these steps.
45
+
46
+ ## Merge
47
+
48
+ To merge the published messages and create the required state tree, you need to call the endpoint [https://coordinator.maci.vote/v1/proof/merge](https://coordinator.maci.vote/v1/proof/merge) with a POST request. The request body should include the necessary parameters for the merge operation, such as the MACI contract address and the poll ID.
49
+
50
+ ## Generate
51
+
52
+ Once the Merkle trees are ready, you can generate the zk-SNARK proof for the final tally by calling the endpoint [https://coordinator.maci.vote/v1/proof/generate](https://coordinator.maci.vote/v1/proof/generate) with a POST request. The request body should include the necessary parameters for the proof generation, such as the MACI contract address and the poll ID.
53
+
54
+ ## Submit
55
+
56
+ After generating the proof, you can submit the final tally on-chain by calling the endpoint [https://coordinator.maci.vote/v1/proof/submit](https://coordinator.maci.vote/v1/proof/submit) with a POST request. The request body should include the necessary parameters for the submission, such as the MACI contract address, poll ID, and the generated proof.
57
+
58
+ # Schedule Poll
59
+
60
+ After deploying a poll, you can schedule it to be finalized automatically after it ends. Make sure to set the MACI coordinator private key in the `.env` file. To do so, you need to call the endpoint [https://coordinator.maci.vote/v1/schedule/poll](https://coordinator.maci.vote/v1/schedule/poll) with a POST request. The request body should include the necessary parameters for scheduling the poll, such as the MACI contract address and the poll ID.
61
+
62
+ # Health
63
+
64
+ To check that the env variables are set correctly and the service is running, you can call the health endpoint [https://coordinator.maci.vote/v1/health](https://coordinator.maci.vote/v1/health) with a GET request. This endpoint will return a status message indicating the rapidsnark access, redis database connection, zkeys access, and the MACI coordinator address with its funds in each MACI-compatible network.