@maci-protocol/website 0.0.0-ci.86ec64f → 0.0.0-ci.895cd6f

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.
@@ -0,0 +1,107 @@
1
+ ---
2
+ slug: maci-aragon-plugin
3
+ title: MACI Aragon Plugin
4
+ description: A MACI plugin for Aragon OSx to enable private voting in DAOs
5
+ authors:
6
+ - name: ctrlc03
7
+ title: MACI former team lead
8
+ url: https://x.com/ctrlc03
9
+ image_url: https://avatars.githubusercontent.com/u/93448202?v=4
10
+ - name: John Guilding
11
+ title: MACI team lead
12
+ url: https://x.com/john_guilding
13
+ image_url: https://pbs.twimg.com/profile_images/1629144990914945024/C6_xsK78_400x400.jpg
14
+ - name: NicoSerranoP
15
+ title: MACI team member
16
+ url: https://x.com/NicoSerranoP
17
+ image_url: https://avatars.githubusercontent.com/u/38594836?v=4
18
+ tags: [voting, security, anonymity, Aragon, MACI, development]
19
+ excerpt: "A MACI plugin for Aragon OSx to enable private voting in DAOs"
20
+ ---
21
+
22
+ Hey Anon,
23
+
24
+ Welcome to another MACI blogpost. Today we are going to be looking at a voting plugin we have been developing to work with the [Aragon OSx stack](https://www.aragon.org/osx).
25
+
26
+ As mentioned in our [latest roadmap blog post](https://maci.pse.dev/blog/2025-Roadmap#2025---what-will-we-focus-the-rest-of-the-year), our team decided to focus on supporting governance projects by integrating with tooling providers such as [Aragon](https://www.aragon.org/). Look out for further announcements over the next month. We're working on some exciting additions to the roadmap to accelerate private governance on Ethereum.
27
+
28
+ So why integrate MACI with Aragon OSx? Our thesis is simple: \***\*private voting will increase voter participation and protect those voting. It will also lead to more honest and accurate outcomes as people can vote more honestly.\*\***
29
+
30
+ Current public voting systems create barriers to honest participation. Voters face social pressure, fear of retaliation, and concerns about how their choices might affect future opportunities. Private voting removes these barriers, enabling DAOs to capture the true preferences of their communities.
31
+
32
+ We chose to integrate with Aragon because their OSx platform provides an excellent foundation for custom DAO governance, and as a reputable team building in the open, they're the perfect partner for this integration.
33
+
34
+ ### The real cost of public voting
35
+
36
+ While transparency is often celebrated in crypto, public voting creates serious barriers to honest participation that threaten the legitimacy of DAO governance.
37
+
38
+ **Fear of retaliation keeps voters silent.** Large token holders can pressure smaller voters by threatening to exclude them from future opportunities, airdrops, or partnerships. When voting records are public, retaliation becomes easy to execute, leading many to abstain rather than risk consequences.
39
+
40
+ **Social pressure distorts genuine preferences.** Voters often wait to see how others vote before casting their own ballot, leading to herding behavior that doesn't reflect genuine preferences. Some even [say](https://x.com/LefterisJP/status/1921562225333916094) governance voting has devolved into a game of politics. The "follow the whale" mentality and politics involved undermine the democratic ideals DAOs strive for.
41
+
42
+ **Vote verification enables problematic markets.** When votes are public, it also creates conditions where governance power can be openly [traded](https://www.tronweekly.com/arbitrum-vote-buying-scandal-how-5-eth-shook/), as buyers can verify they received what they paid for.
43
+
44
+ **Public real time results can enable whales intervention.** If the votes are public and visible in real time while the voting period is happening, whales (or users through token loans) could influence the decision by using their voting power to overpower the community decision.
45
+
46
+ ### Why MACI
47
+
48
+ MACI (Minimal Anti Collusion Infrastructure) is a private voting protocol that aims to reduce collusion and coercion with receipt freeness - this makes it the logical next step for DAOs that really care about the problems highlighted above.
49
+
50
+ In more detail, every vote is encrypted and can only be decrypted for tallying, by a trusted entity referred to as the coordinator. Voters can override their votes at any point during the voting period, and thus without a clear receipt for their vote, they are not able to prove beyond reasonable doubt that they actually voted for an option. This discourages bribers from buying votes and other voters from attempting to collude.
51
+
52
+ While the coordinator can decrypt votes, they cannot produce an incorrect tally or censor votes, thanks to zero knowledge proofs and smart contracts.
53
+
54
+ For more details about MACI and how it works, we recommend reading our other blogposts such as this introductory [article](https://maci.pse.dev/blog/maci-for-beginners) and our comprehensive documentation [website](https://maci.pse.dev/docs/introduction).
55
+
56
+ ### How does Aragon OSx work
57
+
58
+ Aragon OSx is a smart contract framework that works on EVM compatible chains. DAOs can easily deploy custom governance stacks using Aragon OSx, and can benefit from several plugins to extend their functionality over time. This plugin architecture allows DAOs to customise their governance without rebuilding from scratch.
59
+
60
+ A plugin is a smart contract with custom governance logic, limited in scope, and with single-purpose logic that can be used to extend OSx-based organisations. Examples include [token voting](https://docs.aragon.org/token-voting/1.x/index.html) and [multisig](https://docs.aragon.org/multisig/1.x/index.html), and now.. privacy-preserving voting through MACI.
61
+
62
+ ### How does the MACI plugin work
63
+
64
+ The plugin allows DAO members to create new proposals by calling a smart contract function: `createProposal`. The function checks that the caller has enough governance tokens - this minimum amount is set by the DAO at deployment time. The plugin creates a new MACI poll that hosts the encrypted private votes for that particular proposal.
65
+
66
+ The plugin then captures the current block number (minus one) as a snapshot to determine voter eligibility. Once they decide to vote, they can register their interest to vote via their DAO frontend (in MACI's context we call this process _join a poll_), and their voting power is determined by their token balance at the time of proposal creation. Voters can use their real wallet holding their tokens to register themselves by publishing a MACI public key created on their devices. After that, the voter can use any wallet to submit an encrypted message containing the registered public key and their selected option.
67
+
68
+ Voters are then able to vote using their full voting power by choosing one of the options available, which at this time are Yes, No or Abstain. Voting is completely handled by MACI’s smart contracts, therefore voters do not actually ever interact with the DAO plugin.
69
+
70
+ Once the proposal ends, MACI’s backend service (the [coordinator service](https://github.com/privacy-scaling-explorations/maci/tree/dev/apps/coordinator)), starts processing the votes, and generate zk-SNARK proofs to be validated on chain. Voters can be sure of the correct execution thanks to those proofs verifying on chain. Finally, the results are uploaded and the proposal execution can be triggered.
71
+
72
+ The full flow can be observed in the diagram below:
73
+
74
+ ![new-flow-maci](https://hackmd.io/_uploads/Sktza18Xge.png)
75
+
76
+ A proposal execution can range from transferring funds, calling a function on the DAO smart contract itself, calling out an external contract (for instance to initiate a token swap), or setting up a new plugin.
77
+
78
+ An example proposal shown below, with a proposal requesting users to vote on whether they are happy to convert part of the DAOs USDC reserves to ETH.
79
+
80
+ ![dao1](https://hackmd.io/_uploads/rk7C3dHXll.png)
81
+
82
+ The familiar voting interface makes privacy seamless - voters simply select their choice without needing to understand the cryptography running behind the scenes.
83
+
84
+ ![voting1](https://hackmd.io/_uploads/H1TR3OHXxg.png)
85
+
86
+ ### Implementation Considerations
87
+
88
+ - **Network Support:** Currently compatible with all EVM chains such as Ethereum, Arbitrum, Optimism, and some zkEVM networks such as Scroll and Linea. [Here](https://maci.pse.dev/docs/supported-networks/) is a list of all compatible networks.
89
+ - **Timeline:** Vote processing is not immediate due to the need to process votes offchain and to generate zk-SNARK proofs of correct execution. The time it takes to process votes can be reduced by using more powerful hardware.
90
+ - **Reliance on trusted coordinator:** MACI in its current form relies on a trusted coordinator entity which can decrypt the votes - this is an automated piece of software that can run on a server or a Trusted Execution Environment for more security. The team is working on decentralising the coordinator entity and will soon begin working on an upgraded version that uses homomorphic encryption and threshold encryption to distribute the responsibilities across multiple entities. Please note that while the coordinator can see the votes, they cannot censor users nor provide incorrect results.
91
+ - **Costs:** Using MACI can be more costly than traditional blockchain-based voting. While these costs are negligible in layer 2 networks, costs can increase in Ethereum mainnet. Please refer to our [costs](https://maci.pse.dev/docs/supported-networks/costs) section in the documentation website for more details on current benchmarks.
92
+
93
+ ### Next steps
94
+
95
+ As DAOs evolve from experimental communities to serious organisations managing significant resources, governance systems must evolve too. The current landscape presents an ideal opportunity for DAOs to pioneer MACI, thus we are looking for forward-thinking DAOs to pilot MACI’s governance plugin - especially those facing challenges around voter participation, sensitive decision-making, or community pressure. Ready to be among the first? Reach out at [maci@pse.dev](mailto:maci@pse.dev) or join our [Discord](https://discord.com/invite/sF5CT5rzrR). Governance on Ethereum needs a privacy shake up, stay in the loop if you're interested in hearing what else the team has been working on.
96
+
97
+ ### References and resources
98
+
99
+ - [MACI repo](https://github.com/privacy-scaling-explorations/maci)
100
+ - [MACI voting plugin](https://github.com/privacy-scaling-explorations/maci-voting-plugin-aragon)
101
+ - [MACI -Aragon sample frontend](https://github.com/privacy-scaling-explorations/maci-aragon-osx-gov-app)
102
+ - [Aragon OSx](https://github.com/aragon/osx)
103
+ - [Aragon docs](https://docs.aragon.org/)
104
+
105
+ ## Acknowledgements
106
+
107
+ Thanks to the Aragon team for review.
@@ -0,0 +1,167 @@
1
+ ---
2
+ slug: maci-coordinator-service
3
+ title: MACI Coordinator Service
4
+ description: Announcing our coordinator service for MACI
5
+ authors:
6
+ - name: ctrlc03
7
+ title: MACI former team lead
8
+ url: https://x.com/ctrlc03
9
+ image_url: https://avatars.githubusercontent.com/u/93448202?v=4c
10
+ - name: NicoSerranoP
11
+ title: MACI team member
12
+ url: https://x.com/NicoSerranoP
13
+ image_url: https://avatars.githubusercontent.com/u/38594836?v=4
14
+ tags: [voting, security, anonymity, MACI, coordinator]
15
+ excerpt: "A MACI plugin for Aragon OSx to enable private voting in DAOs"
16
+ ---
17
+
18
+ Hey Anon,
19
+
20
+ Welcome back to our MACI blog.
21
+
22
+ Today, we are excited to officially announce something we have referenced frequently: the Coordinator Service.
23
+
24
+ If you ever used MACI, for instance to run a Retroactive Public Goods Funding (RPGF) or Quadratic Funding (QF) round, you might be aware of how tedious it was to operate. The manual process of running scripts to finalise a round and calculate the tally as well as all of the zk-SNARK proofs could require some time and technical expertise. All these steps had to be done in the terminal and you needed to be familiar with MACI's inner workings to understand the process.
25
+
26
+ **Fear no more - the coordinator service is here to make your life easier.**
27
+
28
+ ## The vision: MACI for everyone
29
+
30
+ Our goal is ambitious, yet simple: **completely eliminate the need for any technical knowledge to use MACI**. No more terminal commands, no more manual proof generation, no more complex scripts. Just configure once, run inside a Docker container on your server, and enjoy the full power of MACI's privacy-preserving voting infrastructure.
31
+
32
+ ## Technical implementation
33
+
34
+ The service was built with the following technologies for reliability and scalability:
35
+
36
+ - TypeScript for type-safe, maintainable code
37
+ - Nest.js framework for enterprise-grade architecture
38
+ - REST API for standard CRUD operations
39
+ - WebSocket endpoints for real-time updates during intensive computations
40
+ - MACI SDK package to have all the logic and functions ready to use
41
+ - Docker-ready for simple deployment anywhere
42
+
43
+ The core functionalities of the service are as follows:
44
+
45
+ - Deploy a MACI [subgraph](https://github.com/privacy-scaling-explorations/maci/tree/dev/apps/coordinator/ts/subgraph) to query on-chain data easily
46
+ - [Deploy](https://github.com/privacy-scaling-explorations/maci/tree/dev/apps/coordinator/ts/deployer) the MACI smart contracts, including polls
47
+ - [Finalise](https://github.com/privacy-scaling-explorations/maci/tree/dev/apps/coordinator/ts/proof) polls by processing votes and tallying the results
48
+ - [Schedule](https://github.com/privacy-scaling-explorations/maci/tree/main/apps/coordinator/ts/scheduler) polls for automatic finalization when the voting period ends
49
+ - [Health](https://github.com/privacy-scaling-explorations/maci/tree/main/apps/coordinator/ts/health) endpoint to check everything is setup and working
50
+
51
+ Let's dive into more details in the following sections.
52
+
53
+ ### Subraph deployment
54
+
55
+ The endpoint to deploy a subgraph requires some configuration in the `.env` file, as well as an HTTP request to the endpoint responsible for this `https://coordinator.maci.vote/v1/subgraph/deploy`. Make sure you have an account in [The Graph](https://thegraph.com/studio/) to setup your `.env` file before starting the coordinator service.
56
+
57
+ ### Contracts deployment
58
+
59
+ There are two endpoints in this module: deploy maci (`https://coordinator.maci.vote/v1/deploy/maci`) and deploy poll (`https://coordinator.maci.vote/v1/deploy/poll`). This will take care of all contracts deployment and configuration. It is worth pointing out that you should read the [coordinator service API documentation](https://coordinator.maci.vote/api) and the [MACI guides](https://maci.pse.dev/docs/core-concepts/workflow) to understand the roles of each contract (MACI, poll, policy, initialVoiceCredit).
60
+
61
+ You can deploy one MACI contract (and its internal smart contracts) that will have one gatekeeper policy (e.g. FreeForAll) for all voters to sign up. After that you can deploy multiple polls with different settings (start date, end date, gatekeeper policy, etc). Each voter will have to join each poll to be eligible to participate in. The poll's gatekeeper will check the voter eligibility to join the poll.
62
+
63
+ ### Finalisation
64
+
65
+ This step includes three separate actions:
66
+
67
+ 1. Merge - calculate the state merkle tree root and store a commitment to its root (`https://coordinator.maci.vote/v1/proof/merge`)
68
+ 2. Process - fetch all smart contracts events to reconstruct the state locally and process all votes. This includes decrypting votes, checking validity, and finally tallying them. zk-SNARK proofs are generated for each batch of votes processed (`https://coordinator.maci.vote/v1/proof/generate`)
69
+ 3. Submit - submitting all of the zk-SNARK proofs on chain to prove that the poll was processed correctly. Finally, submit the tally results on chain so that they can be seen by everyone (`https://coordinator.maci.vote/v1/proof/submit`)
70
+
71
+ We chose to separate each action into its own endpoint to avoid long-running computations that could lead to network errors or timeouts.
72
+
73
+ ### Schedule
74
+
75
+ After finishing up the finalisation module, we realized that it would be a lot easier for users to create polls and schedule the finalization process. This removes the need for users to manually call the finalization endpoints described above.
76
+
77
+ 1. To schedule a deployed poll you can use `https://coordinator.maci.vote/v1/scheduler/register`.
78
+ 2. To check if a poll is scheduled you can use `https://coordinator.maci.vote/v1/scheduler/status`
79
+ 3. To delete a scheduled poll you can use `https://coordinator.maci.vote/v1/scheduler/delete`
80
+
81
+ ## How to use
82
+
83
+ ### Run it from source
84
+
85
+ 1. Clone the MACI repository: [https://github.com/privacy-scaling-explorations/maci](https://github.com/privacy-scaling-explorations/maci)
86
+ 2. Install dependencies and build the project
87
+
88
+ ```bash
89
+ pnpm install
90
+ pnpm run build
91
+ ```
92
+
93
+ 3. Download the zkeys for the coordinator
94
+
95
+ ```bash
96
+ pnpm run download-zkeys:ceremony:coordinator
97
+ ```
98
+
99
+ 4. Generate a coordinator MACI keypair. Remember to store those values for later.
100
+
101
+ ```bash
102
+ pnpm run generate-maci-keypair
103
+ ```
104
+
105
+ 5. Move to the coordinator service directory
106
+
107
+ ```bash
108
+ cd apps/coordinator
109
+ ```
110
+
111
+ 6. Configure your `.env` file. Make sure to configure it with your own secure values. The coordinator MACI private key from the previous step should be set here
112
+
113
+ ```bash
114
+ cp .env.example .env
115
+ ```
116
+
117
+ 7. Start the service
118
+
119
+ ```bash
120
+ pnpm run start
121
+ # or
122
+ pnpm run start:prod
123
+ ```
124
+
125
+ ### Run it with Docker
126
+
127
+ 1. Clone the MACI repository: [https://github.com/privacy-scaling-explorations/maci](https://github.com/privacy-scaling-explorations/maci)
128
+ 2. Go inside the project directory
129
+
130
+ ```bash
131
+ cd maci
132
+ ```
133
+
134
+ 3. Build the docker image and run the container
135
+
136
+ ```bash
137
+ # Build docker
138
+ docker compose -f apps/coordinator/docker-compose.yml build
139
+
140
+ # Run container detached
141
+ docker compose -f apps/coordinator/docker-compose.yml up -d
142
+ ```
143
+
144
+ ## Usage notes
145
+
146
+ 1. You can check out the documentation while the service is running in [http://localhost:3001/api](http://localhost:3001/api)
147
+
148
+ 2. We have a [e2e.deploy.test.ts](https://github.com/privacy-scaling-explorations/maci/blob/main/apps/coordinator/tests/e2e.deploy.test.ts) file that performs a complete process: deployment, voting and finalization. You can use it to guide yourself.
149
+
150
+ ## Future work
151
+
152
+ We are researching about different cryptographic methods to decentralize the coordinator. The idea is to eliminate reliance on a single centralized service for finalizing polls. A group of people would be able to spin up their own coordinator services and finalize the poll in a multi-party computation. For more info check out our MACI v4 research.
153
+
154
+ ## Conclusion
155
+
156
+ The MACI Coordinator Service represents a significant leap forward in making MACI accessible to everyone. Whether you're running a small community poll or a large-scale funding round, the coordinator service handles the complexity so you can focus on what matters - empowering your community with private, secure voting.
157
+
158
+ Ready to get started? Head over to our documentation and deploy your first MACI round today!
159
+
160
+ Please reach out if you would like to integrate the service into your frontend.
161
+
162
+ ## References
163
+
164
+ - [MACI repo](https://github.com/privacy-scaling-explorations/maci)
165
+ - [Sample frontend](https://github.com/privacy-scaling-explorations/maci-aragon-osx-gov-app) using the coordinator service
166
+ - [Code examples](https://github.com/privacy-scaling-explorations/maci-aragon-osx-gov-app/blob/main/plugins/maciVoting/contexts/CoordinatorContext.tsx)
167
+ - [Documentation](https://maci.pse.dev/docs/category/coordinator-service)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@maci-protocol/website",
3
- "version": "0.0.0-ci.86ec64f",
3
+ "version": "0.0.0-ci.895cd6f",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -45,7 +45,7 @@
45
45
  "@types/node": "^24.2.0",
46
46
  "@types/react": "^19.1.9",
47
47
  "ts-node": "^10.9.2",
48
- "typescript": "^5.8.3"
48
+ "typescript": "^5.9.2"
49
49
  },
50
50
  "browserslist": {
51
51
  "production": [
@@ -62,5 +62,5 @@
62
62
  "engines": {
63
63
  "node": ">=18.0"
64
64
  },
65
- "gitHead": "c60edfc68d77f84d132590938967d6ed651a591a"
65
+ "gitHead": "891089114253b0a313ada2b33ca7bf275f10d144"
66
66
  }
@@ -60,12 +60,18 @@ Pull requests are great if you want to add a feature or fix a bug. Here's a quic
60
60
  8. Commit your changes. Please make sure your forked `main` branch is synced as well feature/fix branch and there are no "temp" commits (like wip, fix typo/lint/types and etc). We recommend to squash the feature/fix branch commits before creating PR. You can use this command for it:
61
61
 
62
62
  ```bash
63
+ git checkout main
64
+ git pull
65
+ git checkout your-branch
66
+ git rebase main
63
67
  git reset $(git merge-base main $(git rev-parse --abbrev-ref HEAD))
64
68
  ```
65
69
 
66
- 9. Push to your fork and submit a pull request on our `main` branch. Please provide us with some explanation of why you made the changes you made. For new features make sure to explain a standard use case to us.
70
+ 9. Before creating a pull request make sure your work is ready. Do not create WIP pull requests and do not skip pre-commit hooks.
67
71
 
68
- 10. Link any issues that the PR is addressing as described in our processes documentation.
72
+ 10. Push to your fork and submit a pull request on our `main` branch. Please provide us with some explanation of why you made the changes you made. For new features make sure to explain a standard use case to us. Do not remove our PR template and follow all the steps defined in it.
73
+
74
+ 11. Link any issues that the PR is addressing as described in our processes documentation.
69
75
 
70
76
  ## CI (Github Actions) Tests
71
77
 
@@ -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.