@maci-protocol/website 0.0.0-ci.8198a70 → 0.0.0-ci.842952c
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.
- package/package.json +12 -12
- package/versioned_docs/version-v0.x/introduction.md +0 -4
- package/versioned_docs/version-v3.x/guides/sdk.md +121 -0
- package/versioned_docs/version-v3.x/guides/testing/testing-introduction.md +26 -0
- package/versioned_docs/version-v3.x/supported-networks/costs.md +306 -0
- package/versioned_docs/version-v3.x/technical-references/technical-references.md +8 -8
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@maci-protocol/website",
|
|
3
|
-
"version": "0.0.0-ci.
|
|
3
|
+
"version": "0.0.0-ci.842952c",
|
|
4
4
|
"private": false,
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -21,11 +21,11 @@
|
|
|
21
21
|
"types": "tsc -p tsconfig.json --noEmit"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@docusaurus/core": "^3.
|
|
25
|
-
"@docusaurus/preset-classic": "^3.
|
|
26
|
-
"@docusaurus/theme-classic": "^3.
|
|
27
|
-
"@docusaurus/theme-common": "^3.
|
|
28
|
-
"@easyops-cn/docusaurus-search-local": "^0.
|
|
24
|
+
"@docusaurus/core": "^3.8.1",
|
|
25
|
+
"@docusaurus/preset-classic": "^3.8.1",
|
|
26
|
+
"@docusaurus/theme-classic": "^3.8.1",
|
|
27
|
+
"@docusaurus/theme-common": "^3.8.1",
|
|
28
|
+
"@easyops-cn/docusaurus-search-local": "^0.51.1",
|
|
29
29
|
"@mdx-js/react": "^3.1.0",
|
|
30
30
|
"clsx": "^2.1.1",
|
|
31
31
|
"docusaurus-plugin-image-zoom": "^3.0.1",
|
|
@@ -38,11 +38,11 @@
|
|
|
38
38
|
"remark-math": "^6.0.0"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"@docusaurus/module-type-aliases": "^3.
|
|
42
|
-
"@docusaurus/tsconfig": "^3.
|
|
43
|
-
"@docusaurus/types": "^3.
|
|
44
|
-
"@types/node": "^
|
|
45
|
-
"@types/react": "^19.1.
|
|
41
|
+
"@docusaurus/module-type-aliases": "^3.8.1",
|
|
42
|
+
"@docusaurus/tsconfig": "^3.8.1",
|
|
43
|
+
"@docusaurus/types": "^3.8.1",
|
|
44
|
+
"@types/node": "^24.0.7",
|
|
45
|
+
"@types/react": "^19.1.8",
|
|
46
46
|
"ts-node": "^10.9.2",
|
|
47
47
|
"typescript": "^5.8.3"
|
|
48
48
|
},
|
|
@@ -61,5 +61,5 @@
|
|
|
61
61
|
"engines": {
|
|
62
62
|
"node": ">=18.0"
|
|
63
63
|
},
|
|
64
|
-
"gitHead": "
|
|
64
|
+
"gitHead": "f2cee65ec7b4b717760fb1b0be62efd8eac03693"
|
|
65
65
|
}
|
|
@@ -41,9 +41,7 @@ Refer to the [Glossary](#glossary) for definitions of terms.
|
|
|
41
41
|
3. The signup period ends after a fixed amount of time. From that point onwards, users may no longer invoke `signUp()` in this contract.
|
|
42
42
|
|
|
43
43
|
4. Each user votes. To do this, they:
|
|
44
|
-
|
|
45
44
|
- Sign their command using the key which they had signed up with and then use a random (ephemeral) key as well as the coordinator's public key to generate a shared key (via ECDH) encrypt it.
|
|
46
|
-
|
|
47
45
|
- If they are bribed, the user should sign it using an old public key which has already been replaced with a new one.
|
|
48
46
|
|
|
49
47
|
- Otherwise, the user should use the most current public key they have registered.
|
|
@@ -53,9 +51,7 @@ Refer to the [Glossary](#glossary) for definitions of terms.
|
|
|
53
51
|
5. The coordinator processes all the commands after the voting period ends.
|
|
54
52
|
|
|
55
53
|
6. For each batch of commands, they perform the following steps:
|
|
56
|
-
|
|
57
54
|
- Generate a new state root which is the result of:
|
|
58
|
-
|
|
59
55
|
- For each valid command, in reverse order, update the state leaf accordingly
|
|
60
56
|
|
|
61
57
|
- Ignore all invalid commands
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: MACI SDK
|
|
3
|
+
description: How to use the MACI SDK
|
|
4
|
+
sidebar_label: MACI SDK
|
|
5
|
+
sidebar_position: 6
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
In this guide we will be looking at how to use the MACI SDK to interact with the MACI protocol.
|
|
9
|
+
|
|
10
|
+
## Installation
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
npm install @maci-protocol/sdk
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Browser compatibility
|
|
17
|
+
|
|
18
|
+
As the SDK imports functions from the `@maci-protocol/contracts` package which uses hardhat, certain functionality is not browser compatible.
|
|
19
|
+
However, all it takes to use browser compatible functions is to import from `@maci-protocol/sdk/browser`.
|
|
20
|
+
|
|
21
|
+
As an example, we can import the `signUp` function from the `@maci-protocol/sdk/browser` package.
|
|
22
|
+
|
|
23
|
+
```typescript
|
|
24
|
+
import { signUp } from "@maci-protocol/sdk/browser";
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Let's take a look at an example of how to use the `joinPoll` function to register a user to a poll.
|
|
28
|
+
|
|
29
|
+
### JoinPoll
|
|
30
|
+
|
|
31
|
+
This step is required to register a user to a specific poll for which they want to vote. In short, it requires the user to generate a zk-SNARK proof that they know the private key to a public key registered to the MACI contract (proving they passed the initial gatekeeping requirements). This forces them to join with the same MACI key to each poll, greatly increasing the value of the key. Should they have been allowed to join with a throwaway key, they could simply sell their key for polls they do not care about.
|
|
32
|
+
|
|
33
|
+
**How does the flow look like?**
|
|
34
|
+
|
|
35
|
+
1. Reconstruct the MACI state tree by pulling all public keys from the MACI contract (events from RPC or from Subgraph)
|
|
36
|
+
2. Generate a merkle tree inclusion proof for the user's public key
|
|
37
|
+
3. Generate a zk-SNARK proof that the user knows the private key to the public key in the merkle tree inclusion proof
|
|
38
|
+
4. Call the `joinPoll` function on the Poll smart contract
|
|
39
|
+
|
|
40
|
+
**How to use the SDK for this?**
|
|
41
|
+
|
|
42
|
+
> This example is browser specific, as it uses the `@maci-protocol/sdk/browser` package and WASM for witness generation
|
|
43
|
+
|
|
44
|
+
Option 1: Use the `joinPoll` function from the `@maci-protocol/sdk/browser` package.
|
|
45
|
+
|
|
46
|
+
1. Download the `pollJoining` zk artifacts using [downloadPollJoiningArtifactsBrowser](https://github.com/privacy-scaling-explorations/maci/blob/dev/packages/sdk/ts/proof/download.ts#L46)
|
|
47
|
+
|
|
48
|
+
```typescript
|
|
49
|
+
import { downloadPollJoiningArtifactsBrowser } from "@maci-protocol/sdk/browser";
|
|
50
|
+
|
|
51
|
+
const artifacts = await downloadPollJoiningArtifactsBrowser({
|
|
52
|
+
testing: true,
|
|
53
|
+
stateTreeDepth: 10,
|
|
54
|
+
});
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
2. Use the `joinPoll` function to join the poll
|
|
58
|
+
|
|
59
|
+
```typescript
|
|
60
|
+
import { joinPoll } from "@maci-protocol/sdk/browser";
|
|
61
|
+
|
|
62
|
+
const joinedPollData = await joinPoll({
|
|
63
|
+
maciAddress: PUBLIC_MACI_ADDRESS,
|
|
64
|
+
privateKey: maciKeypair.privateKey.serialize(),
|
|
65
|
+
signer,
|
|
66
|
+
pollId,
|
|
67
|
+
inclusionProof,
|
|
68
|
+
pollJoiningZkey: artifacts.zKey as unknown as string,
|
|
69
|
+
pollWasm: artifacts.wasm as unknown as string,
|
|
70
|
+
sgDataArg: DEFAULT_SG_DATA,
|
|
71
|
+
ivcpDataArg: DEFAULT_IVCP_DATA,
|
|
72
|
+
blocksPerBatch: 1000,
|
|
73
|
+
});
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
This is not really efficient, as we are using the user RPC to fetch events, which can be quite slow and prone to errors. A better approach is to use a Subgraph to fetch the events.
|
|
77
|
+
|
|
78
|
+
Option 2: Fetch the MACI keys using a subgraph and reconstruct the state tree locally.
|
|
79
|
+
|
|
80
|
+
1. Deploy the subgraph - instructions [here](/guides/subgraph)
|
|
81
|
+
2. Fetch the MACI keys
|
|
82
|
+
|
|
83
|
+
```typescript
|
|
84
|
+
import { MaciSubgraph } from "@maci-protocol/sdk/browser";
|
|
85
|
+
|
|
86
|
+
const subgraph = new MaciSubgraph("https://api.studio.thegraph.com/query/x/maci/version/latest");
|
|
87
|
+
|
|
88
|
+
const keys = await subgraph.getKeys();
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
3. Generate the merkle tree
|
|
92
|
+
|
|
93
|
+
```typescript
|
|
94
|
+
import { generateSignUpTreeFromKeys } from "@maci-protocol/sdk/browser";
|
|
95
|
+
|
|
96
|
+
const signUpTree = generateSignUpTreeFromKeys(keys);
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
4. Generate the inclusion proof - you will need to know the index of the user's public key in the merkle tree
|
|
100
|
+
|
|
101
|
+
```typescript
|
|
102
|
+
const inclusionProof = signUpTree.generateProof(publicKeyIndex);
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
5. Generate the zk-SNARK proof and join the poll
|
|
106
|
+
|
|
107
|
+
```typescript
|
|
108
|
+
import { joinPoll } from "@maci-protocol/sdk/browser";
|
|
109
|
+
|
|
110
|
+
const joinedPollData = await joinPoll({
|
|
111
|
+
maciAddress: PUBLIC_MACI_ADDRESS,
|
|
112
|
+
privateKey: maciKeypair.privateKey.serialize(),
|
|
113
|
+
signer,
|
|
114
|
+
pollId,
|
|
115
|
+
inclusionProof,
|
|
116
|
+
pollJoiningZkey: artifacts.zKey as unknown as string,
|
|
117
|
+
pollWasm: artifacts.wasm as unknown as string,
|
|
118
|
+
sgDataArg: DEFAULT_SG_DATA,
|
|
119
|
+
ivcpDataArg: DEFAULT_IVCP_DATA,
|
|
120
|
+
});
|
|
121
|
+
```
|
|
@@ -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:
|
|
@@ -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>
|
|
@@ -19,7 +19,7 @@ The MACI smart contracts handle the on-chain aspects - both the functionality an
|
|
|
19
19
|
|
|
20
20
|
The MACI smart contracts are written in [Solidity](https://soliditylang.org/).
|
|
21
21
|
|
|
22
|
-
Contracts are released through the [`@maci-contracts`](https://www.npmjs.com/package
|
|
22
|
+
Contracts are released through the [`@maci-protocol/contracts`](https://www.npmjs.com/package/@maci-protocol/contracts) NPM package.
|
|
23
23
|
|
|
24
24
|
[Learn more about MACI contracts](/docs/technical-references/smart-contracts/)
|
|
25
25
|
|
|
@@ -29,12 +29,12 @@ The TypeScript libraries manage the business logic between the smart contracts a
|
|
|
29
29
|
|
|
30
30
|
The MACI [TypeScript](https://www.typescriptlang.org/) libraries are released through the following NPM packages:
|
|
31
31
|
|
|
32
|
-
- [`@maci-cli`](https://www.npmjs.com/package
|
|
33
|
-
- [`@maci-core`](https://www.npmjs.com/package
|
|
34
|
-
- [`@maci-crypto`](https://www.npmjs.com/package
|
|
35
|
-
- [`@maci-domainobjs`](https://www.npmjs.com/package
|
|
36
|
-
- [`@maci-integrationtests`](https://www.npmjs.com/package
|
|
37
|
-
- [`@maci-sdk`](https://www.npmjs.com/package
|
|
32
|
+
- [`@maci-protocol/cli`](https://www.npmjs.com/package/@maci-protocol/cli)
|
|
33
|
+
- [`@maci-protocol/core`](https://www.npmjs.com/package/@maci-protocol/core)
|
|
34
|
+
- [`@maci-protocol/crypto`](https://www.npmjs.com/package/@maci-protocol/crypto)
|
|
35
|
+
- [`@maci-protocol/domainobjs`](https://www.npmjs.com/package/@maci-protocol/domainobjs)
|
|
36
|
+
- [`@maci-protocol/integrationtests`](https://www.npmjs.com/package/@maci-protocol/integrationtests)
|
|
37
|
+
- [`@maci-protocol/sdk`](https://www.npmjs.com/package/@maci-protocol/sdk)
|
|
38
38
|
|
|
39
39
|
## Circuits
|
|
40
40
|
|
|
@@ -43,6 +43,6 @@ MACI has multiple circuits that ensure all off-chain computation is completed co
|
|
|
43
43
|
The circuits for these zero-knowledge proofs are written
|
|
44
44
|
in [Circom](https://iden3.io/circom).
|
|
45
45
|
|
|
46
|
-
The MACI circuits are released through the [`@maci-circuits`](https://www.npmjs.com/package
|
|
46
|
+
The MACI circuits are released through the [`@maci-protocol/circuits`](https://www.npmjs.com/package/@maci-protocol/circuits) NPM package.
|
|
47
47
|
|
|
48
48
|
[Learn more about MACI circuits](/docs/technical-references/zk-snark-circuits/)
|