@maci-protocol/website 0.0.0-ci.26f28d6

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 (406) hide show
  1. package/.eslintrc.js +157 -0
  2. package/CHANGELOG.md +566 -0
  3. package/LICENSE +22 -0
  4. package/README.md +58 -0
  5. package/babel.config.js +3 -0
  6. package/blog/2021-10-12-maci-v1.md +100 -0
  7. package/blog/2022-09-22-maci-v1-technical-introduction.md +180 -0
  8. package/blog/2023-01-18-maci-v1.1.1.md +121 -0
  9. package/blog/2024-01-18-roadmap.md +106 -0
  10. package/blog/2024-02-28-maci-v1.2.0.md +121 -0
  11. package/blog/2024-04-10-roadmap-q2.md +96 -0
  12. package/blog/2024-05-08-ethdam.md +169 -0
  13. package/blog/2024-05-22-the-origins-of-maci.md +38 -0
  14. package/blog/2024-05-28-upcoming-grants.md +85 -0
  15. package/blog/2024-06-17-understanding-maci.md +63 -0
  16. package/blog/2024-06-21-deciphering-maci.md +48 -0
  17. package/blog/2024-06-28-revolusioning-public-goods-funding.md +32 -0
  18. package/blog/2024-07-23-q2-review.md +72 -0
  19. package/blog/2024-07-30-roadmap-q3.md +61 -0
  20. package/blog/2024-08-10-maci-v2.md +102 -0
  21. package/blog/2024-08-29-anonymous-poll-joining.md +47 -0
  22. package/blog/2024-10-29-q3-review.md +63 -0
  23. package/blog/2024-11-20-maci-platform.md +93 -0
  24. package/blog/2024-12-01-maci-getting-started.md +294 -0
  25. package/blog/2025-03-21-roadmap-2025.md +112 -0
  26. package/blog/assets/MACI_Bob_SignUp_1.png +0 -0
  27. package/blog/assets/MACI_Bob_SignUp_2.png +0 -0
  28. package/blog/assets/MACI_Complex_Message.png +0 -0
  29. package/blog/assets/MACI_Contracts.png +0 -0
  30. package/blog/assets/MACI_Sign_Up.png +0 -0
  31. package/blog/assets/MACI_Simple_Message.png +0 -0
  32. package/blog/assets/MACI_Verifier_1.png +0 -0
  33. package/blog/authors.yml +5 -0
  34. package/docusaurus.config.ts +213 -0
  35. package/package.json +65 -0
  36. package/src/components/ActionCard/index.tsx +30 -0
  37. package/src/components/ActionCard/styles.module.css +96 -0
  38. package/src/components/HomepageFeatures/index.tsx +91 -0
  39. package/src/components/HomepageFeatures/styles.module.css +17 -0
  40. package/src/components/ProjectCard/index.tsx +74 -0
  41. package/src/components/ProjectCard/styles.module.css +77 -0
  42. package/src/components/ProjectList/index.tsx +218 -0
  43. package/src/components/ProjectList/styles.module.css +180 -0
  44. package/src/content/projects.json +294 -0
  45. package/src/css/card.module.css +130 -0
  46. package/src/css/custom.css +91 -0
  47. package/src/icons/IconDiscord.tsx +16 -0
  48. package/src/icons/IconGithub.tsx +16 -0
  49. package/src/icons/IconWebsite.tsx +16 -0
  50. package/src/pages/blogs.tsx +58 -0
  51. package/src/pages/index.module.css +152 -0
  52. package/src/pages/index.tsx +66 -0
  53. package/src/pages/projects.tsx +44 -0
  54. package/src/pages/roadmap.md +150 -0
  55. package/src/pages/typedoc.tsx +11 -0
  56. package/src/plugins/blog-plugin/index.ts +86 -0
  57. package/src/react-app-env.d.ts +1 -0
  58. package/src/scripts/setupSolidityDocs.ts +67 -0
  59. package/src/scripts/setupTypedoc.ts +112 -0
  60. package/src/scripts/utils.ts +115 -0
  61. package/src/utils/getProjectsByFilter.ts +40 -0
  62. package/static/.nojekyll +0 -0
  63. package/static/audit_reports/20210922_Hashcloak_audit_report.pdf +0 -0
  64. package/static/audit_reports/202220930_Hashcloak_audit_report.pdf +0 -0
  65. package/static/audit_reports/20240223_PSE_Audit_audit_report.pdf +0 -0
  66. package/static/audit_reports/20240731_PSE_Audit_audit_report.pdf +0 -0
  67. package/static/fonts/DM_Sans.woff2 +0 -0
  68. package/static/fonts/Share_Tech_Mono.woff2 +0 -0
  69. package/static/img/box.png +0 -0
  70. package/static/img/box_dark.png +0 -0
  71. package/static/img/chain.png +0 -0
  72. package/static/img/chain_dark.png +0 -0
  73. package/static/img/chart.png +0 -0
  74. package/static/img/chart_dark.png +0 -0
  75. package/static/img/circuits/MACI-Circuits.excalidraw +39652 -0
  76. package/static/img/circuits/calculateTotal.svg +21 -0
  77. package/static/img/circuits/ecdh.svg +21 -0
  78. package/static/img/circuits/messageToCommand.svg +21 -0
  79. package/static/img/circuits/messageValidator.svg +21 -0
  80. package/static/img/circuits/poseidonHasher13.svg +21 -0
  81. package/static/img/circuits/privToPubkey.svg +21 -0
  82. package/static/img/circuits/processMessages.svg +21 -0
  83. package/static/img/circuits/processMessagesInputHasher.svg +21 -0
  84. package/static/img/circuits/processMessages_2_0.svg +21 -0
  85. package/static/img/circuits/processOne.svg +21 -0
  86. package/static/img/circuits/processTopup.svg +21 -0
  87. package/static/img/circuits/processingAfterPollEnds.svg +21 -0
  88. package/static/img/circuits/quinBatchLeavesExists.svg +21 -0
  89. package/static/img/circuits/quinCheckRoot.svg +21 -0
  90. package/static/img/circuits/quinGeneratePathIndices.svg +21 -0
  91. package/static/img/circuits/quinSelector.svg +21 -0
  92. package/static/img/circuits/resultsCommitmentVerifier.svg +21 -0
  93. package/static/img/circuits/splicer.svg +21 -0
  94. package/static/img/circuits/tallyInputHasher.svg +21 -0
  95. package/static/img/circuits/tallyVotes.svg +21 -0
  96. package/static/img/circuits/unpackElement.svg +21 -0
  97. package/static/img/circuits/verifySignature.svg +21 -0
  98. package/static/img/completingAPoll.svg +4 -0
  99. package/static/img/contracts.svg +16 -0
  100. package/static/img/coordinatorComponents.svg +21 -0
  101. package/static/img/favicon.ico +0 -0
  102. package/static/img/generateProofs.svg +4 -0
  103. package/static/img/hero.svg +9 -0
  104. package/static/img/maci-card.png +0 -0
  105. package/static/img/maci-rpgf-design.jpg +0 -0
  106. package/static/img/messageProcessingLocal.svg +21 -0
  107. package/static/img/offlineProcessing.svg +21 -0
  108. package/static/img/pse-logo-round.png +0 -0
  109. package/static/img/tallyCommitments.svg +4 -0
  110. package/static/img/voteTallyingLocal.svg +21 -0
  111. package/tsconfig.json +34 -0
  112. package/versioned_docs/version-v0.x/circuits.md +22 -0
  113. package/versioned_docs/version-v0.x/contract.md +186 -0
  114. package/versioned_docs/version-v0.x/faq.md +67 -0
  115. package/versioned_docs/version-v0.x/introduction.md +119 -0
  116. package/versioned_docs/version-v0.x/quadratic-vote-tallying-circuit.md +138 -0
  117. package/versioned_docs/version-v0.x/state-root-transition-circuit.md +230 -0
  118. package/versioned_docs/version-v1.2/audit.md +160 -0
  119. package/versioned_docs/version-v1.2/ci-pipeline.md +38 -0
  120. package/versioned_docs/version-v1.2/circuits.md +508 -0
  121. package/versioned_docs/version-v1.2/cli.md +689 -0
  122. package/versioned_docs/version-v1.2/contracts.md +445 -0
  123. package/versioned_docs/version-v1.2/contributing/code-of-conduct.md +91 -0
  124. package/versioned_docs/version-v1.2/contributing/contributing.md +129 -0
  125. package/versioned_docs/version-v1.2/coordinator-processing.md +46 -0
  126. package/versioned_docs/version-v1.2/deployment.md +122 -0
  127. package/versioned_docs/version-v1.2/installation.md +175 -0
  128. package/versioned_docs/version-v1.2/integrating.md +200 -0
  129. package/versioned_docs/version-v1.2/introduction.md +94 -0
  130. package/versioned_docs/version-v1.2/key-change.md +182 -0
  131. package/versioned_docs/version-v1.2/overview.md +47 -0
  132. package/versioned_docs/version-v1.2/poll-types.md +68 -0
  133. package/versioned_docs/version-v1.2/primitives.md +216 -0
  134. package/versioned_docs/version-v1.2/project-ideas.md +14 -0
  135. package/versioned_docs/version-v1.2/purpose.md +62 -0
  136. package/versioned_docs/version-v1.2/solidity-docs/MACI.md +345 -0
  137. package/versioned_docs/version-v1.2/solidity-docs/MessageProcessor.md +266 -0
  138. package/versioned_docs/version-v1.2/solidity-docs/MessageProcessorFactory.md +26 -0
  139. package/versioned_docs/version-v1.2/solidity-docs/Poll.md +381 -0
  140. package/versioned_docs/version-v1.2/solidity-docs/PollFactory.md +50 -0
  141. package/versioned_docs/version-v1.2/solidity-docs/SignUpToken.md +27 -0
  142. package/versioned_docs/version-v1.2/solidity-docs/Subsidy.md +218 -0
  143. package/versioned_docs/version-v1.2/solidity-docs/SubsidyFactory.md +27 -0
  144. package/versioned_docs/version-v1.2/solidity-docs/Tally.md +311 -0
  145. package/versioned_docs/version-v1.2/solidity-docs/TallyFactory.md +27 -0
  146. package/versioned_docs/version-v1.2/solidity-docs/TallyNonQv.md +296 -0
  147. package/versioned_docs/version-v1.2/solidity-docs/TallyNonQvFactory.md +27 -0
  148. package/versioned_docs/version-v1.2/solidity-docs/TopupCredit.md +61 -0
  149. package/versioned_docs/version-v1.2/solidity-docs/VkRegistry.md +457 -0
  150. package/versioned_docs/version-v1.2/solidity-docs/benchmarks/HasherBenchmarks.md +44 -0
  151. package/versioned_docs/version-v1.2/solidity-docs/crypto/Hasher.md +125 -0
  152. package/versioned_docs/version-v1.2/solidity-docs/crypto/IVerifier.md +11 -0
  153. package/versioned_docs/version-v1.2/solidity-docs/crypto/MockVerifier.md +17 -0
  154. package/versioned_docs/version-v1.2/solidity-docs/crypto/Pairing.md +85 -0
  155. package/versioned_docs/version-v1.2/solidity-docs/crypto/PoseidonT3.md +9 -0
  156. package/versioned_docs/version-v1.2/solidity-docs/crypto/PoseidonT4.md +9 -0
  157. package/versioned_docs/version-v1.2/solidity-docs/crypto/PoseidonT5.md +9 -0
  158. package/versioned_docs/version-v1.2/solidity-docs/crypto/PoseidonT6.md +9 -0
  159. package/versioned_docs/version-v1.2/solidity-docs/crypto/SnarkCommon.md +16 -0
  160. package/versioned_docs/version-v1.2/solidity-docs/crypto/SnarkConstants.md +40 -0
  161. package/versioned_docs/version-v1.2/solidity-docs/crypto/Verifier.md +61 -0
  162. package/versioned_docs/version-v1.2/solidity-docs/gatekeepers/EASGatekeeper.md +121 -0
  163. package/versioned_docs/version-v1.2/solidity-docs/gatekeepers/FreeForAllSignUpGatekeeper.md +40 -0
  164. package/versioned_docs/version-v1.2/solidity-docs/gatekeepers/SignUpGatekeeper.md +26 -0
  165. package/versioned_docs/version-v1.2/solidity-docs/gatekeepers/SignUpTokenGatekeeper.md +93 -0
  166. package/versioned_docs/version-v1.2/solidity-docs/gatekeepers/hatsGatekeepers/HatsGatekeeperBase.md +79 -0
  167. package/versioned_docs/version-v1.2/solidity-docs/gatekeepers/hatsGatekeepers/HatsGatekeeperMultiple.md +48 -0
  168. package/versioned_docs/version-v1.2/solidity-docs/gatekeepers/hatsGatekeepers/HatsGatekeeperSingle.md +42 -0
  169. package/versioned_docs/version-v1.2/solidity-docs/index.md +4 -0
  170. package/versioned_docs/version-v1.2/solidity-docs/initialVoiceCreditProxy/ConstantInitialVoiceCreditProxy.md +40 -0
  171. package/versioned_docs/version-v1.2/solidity-docs/initialVoiceCreditProxy/InitialVoiceCreditProxy.md +26 -0
  172. package/versioned_docs/version-v1.2/solidity-docs/interfaces/IEAS.md +40 -0
  173. package/versioned_docs/version-v1.2/solidity-docs/interfaces/IHats.md +103 -0
  174. package/versioned_docs/version-v1.2/solidity-docs/interfaces/IMPFactory.md +26 -0
  175. package/versioned_docs/version-v1.2/solidity-docs/interfaces/IMessageProcessor.md +31 -0
  176. package/versioned_docs/version-v1.2/solidity-docs/interfaces/IPoll.md +217 -0
  177. package/versioned_docs/version-v1.2/solidity-docs/interfaces/IPollFactory.md +29 -0
  178. package/versioned_docs/version-v1.2/solidity-docs/interfaces/ITallyFactory.md +28 -0
  179. package/versioned_docs/version-v1.2/solidity-docs/interfaces/ITallySubsidyFactory.md +27 -0
  180. package/versioned_docs/version-v1.2/solidity-docs/interfaces/IVerifier.md +25 -0
  181. package/versioned_docs/version-v1.2/solidity-docs/interfaces/IVkRegistry.md +70 -0
  182. package/versioned_docs/version-v1.2/solidity-docs/mocks/MockHatsProtocol.md +133 -0
  183. package/versioned_docs/version-v1.2/solidity-docs/trees/AccQueue.md +464 -0
  184. package/versioned_docs/version-v1.2/solidity-docs/trees/AccQueueBinary.md +60 -0
  185. package/versioned_docs/version-v1.2/solidity-docs/trees/AccQueueBinary0.md +40 -0
  186. package/versioned_docs/version-v1.2/solidity-docs/trees/AccQueueBinaryMaci.md +34 -0
  187. package/versioned_docs/version-v1.2/solidity-docs/trees/AccQueueQuinary.md +75 -0
  188. package/versioned_docs/version-v1.2/solidity-docs/trees/AccQueueQuinary0.md +40 -0
  189. package/versioned_docs/version-v1.2/solidity-docs/trees/AccQueueQuinaryBlankSl.md +40 -0
  190. package/versioned_docs/version-v1.2/solidity-docs/trees/AccQueueQuinaryMaci.md +40 -0
  191. package/versioned_docs/version-v1.2/solidity-docs/trees/EmptyBallotRoots.md +13 -0
  192. package/versioned_docs/version-v1.2/solidity-docs/utilities/CommonUtilities.md +25 -0
  193. package/versioned_docs/version-v1.2/solidity-docs/utilities/DomainObjs.md +40 -0
  194. package/versioned_docs/version-v1.2/solidity-docs/utilities/Params.md +36 -0
  195. package/versioned_docs/version-v1.2/solidity-docs/utilities/Utilities.md +79 -0
  196. package/versioned_docs/version-v1.2/spec.md +944 -0
  197. package/versioned_docs/version-v1.2/testing-in-detail.md +209 -0
  198. package/versioned_docs/version-v1.2/testing.md +472 -0
  199. package/versioned_docs/version-v1.2/topup.md +43 -0
  200. package/versioned_docs/version-v1.2/troubleshooting.md +51 -0
  201. package/versioned_docs/version-v1.2/trusted-setup.md +76 -0
  202. package/versioned_docs/version-v1.2/typedoc/cli/.nojekyll +1 -0
  203. package/versioned_docs/version-v1.2/typedoc/cli/index.md +15 -0
  204. package/versioned_docs/version-v1.2/typedoc/cli/interfaces/AirdropArgs.md +89 -0
  205. package/versioned_docs/version-v1.2/typedoc/cli/interfaces/DeployArgs.md +154 -0
  206. package/versioned_docs/version-v1.2/typedoc/cli/interfaces/DeployPollArgs.md +154 -0
  207. package/versioned_docs/version-v1.2/typedoc/cli/interfaces/DeployedContracts.md +130 -0
  208. package/versioned_docs/version-v1.2/typedoc/cli/interfaces/GenLocalStateArgs.md +168 -0
  209. package/versioned_docs/version-v1.2/typedoc/cli/interfaces/GenProofsArgs.md +388 -0
  210. package/versioned_docs/version-v1.2/typedoc/cli/interfaces/IGenKeypairArgs.md +37 -0
  211. package/versioned_docs/version-v1.2/typedoc/cli/interfaces/IRegisteredUserArgs.md +63 -0
  212. package/versioned_docs/version-v1.2/typedoc/cli/interfaces/MergeMessagesArgs.md +76 -0
  213. package/versioned_docs/version-v1.2/typedoc/cli/interfaces/MergeSignupsArgs.md +76 -0
  214. package/versioned_docs/version-v1.2/typedoc/cli/interfaces/PollContracts.md +53 -0
  215. package/versioned_docs/version-v1.2/typedoc/cli/interfaces/ProveOnChainArgs.md +128 -0
  216. package/versioned_docs/version-v1.2/typedoc/cli/interfaces/PublishArgs.md +154 -0
  217. package/versioned_docs/version-v1.2/typedoc/cli/interfaces/SignupArgs.md +89 -0
  218. package/versioned_docs/version-v1.2/typedoc/cli/interfaces/SubsidyData.md +73 -0
  219. package/versioned_docs/version-v1.2/typedoc/cli/interfaces/TallyData.md +166 -0
  220. package/versioned_docs/version-v1.2/typedoc/cli/interfaces/TopupArgs.md +89 -0
  221. package/versioned_docs/version-v1.2/typedoc/cli/interfaces/VerifyArgs.md +128 -0
  222. package/versioned_docs/version-v1.2/typedoc/cli/modules.md +556 -0
  223. package/versioned_docs/version-v1.2/typedoc/core/.nojekyll +1 -0
  224. package/versioned_docs/version-v1.2/typedoc/core/classes/MaciState.md +295 -0
  225. package/versioned_docs/version-v1.2/typedoc/core/classes/Poll.md +1098 -0
  226. package/versioned_docs/version-v1.2/typedoc/core/index.md +110 -0
  227. package/versioned_docs/version-v1.2/typedoc/core/interfaces/BatchSizes.md +50 -0
  228. package/versioned_docs/version-v1.2/typedoc/core/interfaces/IJsonMaciState.md +77 -0
  229. package/versioned_docs/version-v1.2/typedoc/core/interfaces/IProcessMessagesCircuitInputs.md +242 -0
  230. package/versioned_docs/version-v1.2/typedoc/core/interfaces/ISubsidyCircuitInputs.md +198 -0
  231. package/versioned_docs/version-v1.2/typedoc/core/interfaces/ITallyCircuitInputs.md +231 -0
  232. package/versioned_docs/version-v1.2/typedoc/core/interfaces/MaxValues.md +37 -0
  233. package/versioned_docs/version-v1.2/typedoc/core/interfaces/TreeDepths.md +63 -0
  234. package/versioned_docs/version-v1.2/typedoc/core/modules.md +289 -0
  235. package/versioned_docs/version-v1.2/typedoc/crypto/.nojekyll +1 -0
  236. package/versioned_docs/version-v1.2/typedoc/crypto/classes/AccQueue.md +770 -0
  237. package/versioned_docs/version-v1.2/typedoc/crypto/classes/G1Point.md +115 -0
  238. package/versioned_docs/version-v1.2/typedoc/crypto/classes/G2Point.md +140 -0
  239. package/versioned_docs/version-v1.2/typedoc/crypto/classes/IncrementalQuinTree.md +470 -0
  240. package/versioned_docs/version-v1.2/typedoc/crypto/index.md +44 -0
  241. package/versioned_docs/version-v1.2/typedoc/crypto/interfaces/Keypair.md +33 -0
  242. package/versioned_docs/version-v1.2/typedoc/crypto/interfaces/PoseidonFuncs.md +115 -0
  243. package/versioned_docs/version-v1.2/typedoc/crypto/interfaces/Queue.md +33 -0
  244. package/versioned_docs/version-v1.2/typedoc/crypto/interfaces/Signature.md +37 -0
  245. package/versioned_docs/version-v1.2/typedoc/crypto/modules.md +913 -0
  246. package/versioned_docs/version-v1.2/typedoc/domainobjs/.nojekyll +1 -0
  247. package/versioned_docs/version-v1.2/typedoc/domainobjs/classes/Ballot.md +274 -0
  248. package/versioned_docs/version-v1.2/typedoc/domainobjs/classes/Keypair.md +181 -0
  249. package/versioned_docs/version-v1.2/typedoc/domainobjs/classes/Message.md +244 -0
  250. package/versioned_docs/version-v1.2/typedoc/domainobjs/classes/PCommand.md +409 -0
  251. package/versioned_docs/version-v1.2/typedoc/domainobjs/classes/PrivKey.md +206 -0
  252. package/versioned_docs/version-v1.2/typedoc/domainobjs/classes/PubKey.md +289 -0
  253. package/versioned_docs/version-v1.2/typedoc/domainobjs/classes/StateLeaf.md +340 -0
  254. package/versioned_docs/version-v1.2/typedoc/domainobjs/classes/TCommand.md +200 -0
  255. package/versioned_docs/version-v1.2/typedoc/domainobjs/classes/VerifyingKey.md +240 -0
  256. package/versioned_docs/version-v1.2/typedoc/domainobjs/index.md +81 -0
  257. package/versioned_docs/version-v1.2/typedoc/domainobjs/interfaces/ICommand.md +104 -0
  258. package/versioned_docs/version-v1.2/typedoc/domainobjs/interfaces/IG1ContractParams.md +31 -0
  259. package/versioned_docs/version-v1.2/typedoc/domainobjs/interfaces/IG2ContractParams.md +31 -0
  260. package/versioned_docs/version-v1.2/typedoc/domainobjs/interfaces/IJsonBallot.md +42 -0
  261. package/versioned_docs/version-v1.2/typedoc/domainobjs/interfaces/IJsonCommand.md +32 -0
  262. package/versioned_docs/version-v1.2/typedoc/domainobjs/interfaces/IJsonKeyPair.md +31 -0
  263. package/versioned_docs/version-v1.2/typedoc/domainobjs/interfaces/IJsonPCommand.md +111 -0
  264. package/versioned_docs/version-v1.2/typedoc/domainobjs/interfaces/IJsonStateLeaf.md +42 -0
  265. package/versioned_docs/version-v1.2/typedoc/domainobjs/interfaces/IJsonTCommand.md +67 -0
  266. package/versioned_docs/version-v1.2/typedoc/domainobjs/interfaces/IMessageContractParams.md +31 -0
  267. package/versioned_docs/version-v1.2/typedoc/domainobjs/interfaces/IStateLeaf.md +39 -0
  268. package/versioned_docs/version-v1.2/typedoc/domainobjs/interfaces/IStateLeafContractParams.md +42 -0
  269. package/versioned_docs/version-v1.2/typedoc/domainobjs/interfaces/IVkContractParams.md +64 -0
  270. package/versioned_docs/version-v1.2/typedoc/domainobjs/interfaces/IVkObjectParams.md +108 -0
  271. package/versioned_docs/version-v1.2/typedoc/domainobjs/interfaces/Proof.md +46 -0
  272. package/versioned_docs/version-v1.2/typedoc/domainobjs/interfaces/VoteOptionTreeLeaf.md +24 -0
  273. package/versioned_docs/version-v1.2/typedoc/domainobjs/modules.md +110 -0
  274. package/versioned_docs/version-v1.2/typedoc/index.md +4 -0
  275. package/versioned_docs/version-v1.2/versioning.md +94 -0
  276. package/versioned_docs/version-v1.2/workflow.md +142 -0
  277. package/versioned_docs/version-v2.x/case-studies.md +35 -0
  278. package/versioned_docs/version-v2.x/contributing/_category_.json +4 -0
  279. package/versioned_docs/version-v2.x/contributing/code-of-conduct.md +92 -0
  280. package/versioned_docs/version-v2.x/contributing/contributing.md +149 -0
  281. package/versioned_docs/version-v2.x/contributing/project-ideas.md +78 -0
  282. package/versioned_docs/version-v2.x/core-concepts/_category_.json +4 -0
  283. package/versioned_docs/version-v2.x/core-concepts/ballot.md +19 -0
  284. package/versioned_docs/version-v2.x/core-concepts/coordinator-processing.md +46 -0
  285. package/versioned_docs/version-v2.x/core-concepts/hashing-and-encryption.md +45 -0
  286. package/versioned_docs/version-v2.x/core-concepts/key-change.md +179 -0
  287. package/versioned_docs/version-v2.x/core-concepts/maci-keys.md +84 -0
  288. package/versioned_docs/version-v2.x/core-concepts/maci-messages.md +44 -0
  289. package/versioned_docs/version-v2.x/core-concepts/merkle-trees.md +23 -0
  290. package/versioned_docs/version-v2.x/core-concepts/poll-types.md +106 -0
  291. package/versioned_docs/version-v2.x/core-concepts/spec.md +883 -0
  292. package/versioned_docs/version-v2.x/core-concepts/state-leaf.md +42 -0
  293. package/versioned_docs/version-v2.x/core-concepts/workflow.md +142 -0
  294. package/versioned_docs/version-v2.x/getting-started.md +313 -0
  295. package/versioned_docs/version-v2.x/guides/_category_.json +4 -0
  296. package/versioned_docs/version-v2.x/guides/compile-circuits.md +163 -0
  297. package/versioned_docs/version-v2.x/guides/frontend.md +99 -0
  298. package/versioned_docs/version-v2.x/guides/integrating.md +73 -0
  299. package/versioned_docs/version-v2.x/guides/maciWrapper.md +173 -0
  300. package/versioned_docs/version-v2.x/guides/subgraph.md +79 -0
  301. package/versioned_docs/version-v2.x/guides/testing/_category_.json +4 -0
  302. package/versioned_docs/version-v2.x/guides/testing/testing-in-detail.md +203 -0
  303. package/versioned_docs/version-v2.x/guides/testing/testing.md +163 -0
  304. package/versioned_docs/version-v2.x/guides/troubleshooting.md +161 -0
  305. package/versioned_docs/version-v2.x/introduction.md +146 -0
  306. package/versioned_docs/version-v2.x/processes/_category_.json +4 -0
  307. package/versioned_docs/version-v2.x/processes/ci-pipeline.md +38 -0
  308. package/versioned_docs/version-v2.x/processes/versioning.md +94 -0
  309. package/versioned_docs/version-v2.x/resources.md +33 -0
  310. package/versioned_docs/version-v2.x/security/_category_.json +4 -0
  311. package/versioned_docs/version-v2.x/security/audit.md +167 -0
  312. package/versioned_docs/version-v2.x/security/trusted-setup.md +166 -0
  313. package/versioned_docs/version-v2.x/supported-networks/_category_.json +4 -0
  314. package/versioned_docs/version-v2.x/supported-networks/deployed-contracts.md +1108 -0
  315. package/versioned_docs/version-v2.x/supported-networks/supported-networks.md +47 -0
  316. package/versioned_docs/version-v2.x/technical-references/_category_.json +4 -0
  317. package/versioned_docs/version-v2.x/technical-references/smart-contracts/AccQueue.md +21 -0
  318. package/versioned_docs/version-v2.x/technical-references/smart-contracts/Gatekeepers.md +40 -0
  319. package/versioned_docs/version-v2.x/technical-references/smart-contracts/MACI.md +152 -0
  320. package/versioned_docs/version-v2.x/technical-references/smart-contracts/MessageProcessor.md +13 -0
  321. package/versioned_docs/version-v2.x/technical-references/smart-contracts/Params.md +32 -0
  322. package/versioned_docs/version-v2.x/technical-references/smart-contracts/Poll.md +104 -0
  323. package/versioned_docs/version-v2.x/technical-references/smart-contracts/PollFactory.md +43 -0
  324. package/versioned_docs/version-v2.x/technical-references/smart-contracts/Tally.md +45 -0
  325. package/versioned_docs/version-v2.x/technical-references/smart-contracts/VkRegistry.md +57 -0
  326. package/versioned_docs/version-v2.x/technical-references/smart-contracts/VoiceCreditProxy.md +18 -0
  327. package/versioned_docs/version-v2.x/technical-references/smart-contracts/_category_.json +8 -0
  328. package/versioned_docs/version-v2.x/technical-references/technical-references.md +47 -0
  329. package/versioned_docs/version-v2.x/technical-references/typescript-code/_category_.json +4 -0
  330. package/versioned_docs/version-v2.x/technical-references/typescript-code/cli.md +699 -0
  331. package/versioned_docs/version-v2.x/technical-references/zk-snark-circuits/_category_.json +4 -0
  332. package/versioned_docs/version-v2.x/technical-references/zk-snark-circuits/processMessages.md +107 -0
  333. package/versioned_docs/version-v2.x/technical-references/zk-snark-circuits/setup.md +101 -0
  334. package/versioned_docs/version-v2.x/technical-references/zk-snark-circuits/tallyVotes.md +79 -0
  335. package/versioned_docs/version-v2.x/technical-references/zk-snark-circuits/utilities.md +131 -0
  336. package/versioned_docs/version-v2.x/technical-references/zk-snark-circuits/zk-snark-circuits.md +37 -0
  337. package/versioned_docs/version-v2.x/use-cases/_category_.json +4 -0
  338. package/versioned_docs/version-v2.x/use-cases/governance.md +18 -0
  339. package/versioned_docs/version-v2.x/use-cases/polling.md +10 -0
  340. package/versioned_docs/version-v2.x/use-cases/public-goods.md +65 -0
  341. package/versioned_docs/version-v3.x/case-studies.md +35 -0
  342. package/versioned_docs/version-v3.x/contributing/_category_.json +4 -0
  343. package/versioned_docs/version-v3.x/contributing/code-of-conduct.md +92 -0
  344. package/versioned_docs/version-v3.x/contributing/contributing.md +149 -0
  345. package/versioned_docs/version-v3.x/contributing/project-ideas.md +78 -0
  346. package/versioned_docs/version-v3.x/core-concepts/_category_.json +4 -0
  347. package/versioned_docs/version-v3.x/core-concepts/ballot.md +19 -0
  348. package/versioned_docs/version-v3.x/core-concepts/coordinator-processing.md +46 -0
  349. package/versioned_docs/version-v3.x/core-concepts/hashing-and-encryption.md +45 -0
  350. package/versioned_docs/version-v3.x/core-concepts/key-change.md +179 -0
  351. package/versioned_docs/version-v3.x/core-concepts/maci-keys.md +84 -0
  352. package/versioned_docs/version-v3.x/core-concepts/maci-messages.md +44 -0
  353. package/versioned_docs/version-v3.x/core-concepts/merkle-trees.md +16 -0
  354. package/versioned_docs/version-v3.x/core-concepts/poll-types.md +58 -0
  355. package/versioned_docs/version-v3.x/core-concepts/polls.md +81 -0
  356. package/versioned_docs/version-v3.x/core-concepts/spec.md +883 -0
  357. package/versioned_docs/version-v3.x/core-concepts/state-leaf.md +42 -0
  358. package/versioned_docs/version-v3.x/core-concepts/workflow.md +143 -0
  359. package/versioned_docs/version-v3.x/guides/_category_.json +4 -0
  360. package/versioned_docs/version-v3.x/guides/compile-circuits.md +175 -0
  361. package/versioned_docs/version-v3.x/guides/integrating.md +137 -0
  362. package/versioned_docs/version-v3.x/guides/subgraph.md +79 -0
  363. package/versioned_docs/version-v3.x/guides/testing/_category_.json +4 -0
  364. package/versioned_docs/version-v3.x/guides/testing/testing-in-detail.md +191 -0
  365. package/versioned_docs/version-v3.x/guides/testing/testing-introduction.md +158 -0
  366. package/versioned_docs/version-v3.x/guides/troubleshooting.md +161 -0
  367. package/versioned_docs/version-v3.x/introduction.md +153 -0
  368. package/versioned_docs/version-v3.x/processes/_category_.json +4 -0
  369. package/versioned_docs/version-v3.x/processes/ci-pipeline.md +38 -0
  370. package/versioned_docs/version-v3.x/processes/versioning.md +94 -0
  371. package/versioned_docs/version-v3.x/quick-start.md +318 -0
  372. package/versioned_docs/version-v3.x/resources.md +33 -0
  373. package/versioned_docs/version-v3.x/security/_category_.json +4 -0
  374. package/versioned_docs/version-v3.x/security/audit.md +167 -0
  375. package/versioned_docs/version-v3.x/security/trusted-setup.md +172 -0
  376. package/versioned_docs/version-v3.x/supported-networks/_category_.json +4 -0
  377. package/versioned_docs/version-v3.x/supported-networks/deployed-contracts.md +112 -0
  378. package/versioned_docs/version-v3.x/supported-networks/supported-networks.md +53 -0
  379. package/versioned_docs/version-v3.x/technical-references/_category_.json +4 -0
  380. package/versioned_docs/version-v3.x/technical-references/smart-contracts/MACI.md +160 -0
  381. package/versioned_docs/version-v3.x/technical-references/smart-contracts/MessageProcessor.md +13 -0
  382. package/versioned_docs/version-v3.x/technical-references/smart-contracts/Params.md +33 -0
  383. package/versioned_docs/version-v3.x/technical-references/smart-contracts/Policies.md +39 -0
  384. package/versioned_docs/version-v3.x/technical-references/smart-contracts/Poll.md +170 -0
  385. package/versioned_docs/version-v3.x/technical-references/smart-contracts/PollFactory.md +33 -0
  386. package/versioned_docs/version-v3.x/technical-references/smart-contracts/Tally.md +43 -0
  387. package/versioned_docs/version-v3.x/technical-references/smart-contracts/VkRegistry.md +62 -0
  388. package/versioned_docs/version-v3.x/technical-references/smart-contracts/VoiceCreditProxy.md +18 -0
  389. package/versioned_docs/version-v3.x/technical-references/smart-contracts/_category_.json +8 -0
  390. package/versioned_docs/version-v3.x/technical-references/technical-references.md +48 -0
  391. package/versioned_docs/version-v3.x/technical-references/zk-snark-circuits/_category_.json +4 -0
  392. package/versioned_docs/version-v3.x/technical-references/zk-snark-circuits/joinPoll.md +53 -0
  393. package/versioned_docs/version-v3.x/technical-references/zk-snark-circuits/processMessages.md +106 -0
  394. package/versioned_docs/version-v3.x/technical-references/zk-snark-circuits/setup.md +96 -0
  395. package/versioned_docs/version-v3.x/technical-references/zk-snark-circuits/tallyVotes.md +79 -0
  396. package/versioned_docs/version-v3.x/technical-references/zk-snark-circuits/utilities.md +131 -0
  397. package/versioned_docs/version-v3.x/technical-references/zk-snark-circuits/zk-snark-circuits.md +42 -0
  398. package/versioned_docs/version-v3.x/use-cases/_category_.json +4 -0
  399. package/versioned_docs/version-v3.x/use-cases/governance.md +18 -0
  400. package/versioned_docs/version-v3.x/use-cases/polling.md +10 -0
  401. package/versioned_docs/version-v3.x/use-cases/public-goods.md +65 -0
  402. package/versioned_sidebars/version-v0.x-sidebars.json +8 -0
  403. package/versioned_sidebars/version-v1.2-sidebars.json +8 -0
  404. package/versioned_sidebars/version-v2.x-sidebars.json +8 -0
  405. package/versioned_sidebars/version-v3.x-sidebars.json +8 -0
  406. package/versions.json +1 -0
@@ -0,0 +1,42 @@
1
+ ---
2
+ title: StateLeaf
3
+ description: A short introduction of the main primitives used by MACI
4
+ sidebar_label: StateLeaf
5
+ sidebar_position: 6
6
+ ---
7
+
8
+ A state leaf represents a user's participation declared through an identity (their public key) and information relevant to their ability or right to cast votes in a poll (their voice credit balance and the block timestamp at which they signed up).
9
+
10
+ We define a state leaf $sl$ as the $poseidon_4$ hash of the following:
11
+
12
+ | Symbol | Name | Comments |
13
+ | ---------- | ------------------------- | ------------------------------------------- |
14
+ | $sl_{P_x}$ | Public key's x-coordinate | |
15
+ | $sl_{P_y}$ | Public key's y-coordinate | |
16
+ | $sl_{v}$ | Voice credit balance | |
17
+ | $sl_{t}$ | Block timestamp | In Unix time (seconds since Jan 1 1970 UTC) |
18
+
19
+ The hash $sl$ is computed as such:
20
+
21
+ $sl = poseidon_4([sl_{A_x}, sl_{A_y}, sl_{v}, sl_{t}])$
22
+
23
+ ## Blank state leaf
24
+
25
+ A blank state leaf $sl_B$ has the following value:
26
+
27
+ $6769006970205099520508948723718471724660867171122235270773600567925038008762$
28
+
29
+ This value is computed as such:
30
+
31
+ $A_{b_x} = 10457101036533406547632367118273992217979173478358440826365724437999023779287$
32
+ $A_{b_y} = 19824078218392094440610104313265183977899662750282163392862422243483260492317$
33
+ $sl_B = poseidon_4([A_{b0}, A_{b1}, 0, 0])$
34
+
35
+ The code to derive $A_{b_x}$ and $A_{b_y}$ is [here](https://github.com/iden3/circomlib/blob/d5ed1c3ce4ca137a6b3ca48bec4ac12c1b38957a/src/pedersen_printbases.js). The function call required is `pedersenHash.getBasePoint('blake', 0)`
36
+
37
+ 1. Hash the string `PedersenGenerator_00000000000000000000000000000000_00000000000000000000000000000000` with $blake_{256}$. In big-endian hexadecimal format, the hash should be `1b3ef77ef2cd620fd2358e69dd564f35556aad552fdd7f06b777bd3a1d697160`.
38
+ 2. Set the 255th bit to 0. The result should be `1b3ef77ef2cd620fd2358e69dd564f35556aad552fdd7f06b777bd3a1d697120`.
39
+ 3. Use the method to convert a buffer to a point on the BabyJub curve described in [2.3.2].
40
+ 4. Multiply the point by 8. The result is the point with x-value $A_{b_x}$ and y-value $A_{b_y}$
41
+
42
+ Given the [elliptic curve discrete logarithm problem](https://wstein.org/edu/2007/spring/ent/ent-html/node89.html), we assume that no one knows the private key $s \in {F}_p$ and by using the public key generation procedure in [1.4], we can derive $A_{b_x}$ and $A_{b_y}$. Furthermore, the string above (`PedersenGenerator...`) acts as a nothing-up-my-sleeve value.
@@ -0,0 +1,143 @@
1
+ ---
2
+ title: MACI Workflow
3
+ description: Overview of the MACI workflow
4
+ sidebar_label: Workflow
5
+ sidebar_position: 1
6
+ ---
7
+
8
+ <!-- TODO: create flowcharts, similar to Kyle's (but make light/dark mode compatible) -->
9
+
10
+ # MACI Workflow
11
+
12
+ This article covers the high-level MACI workflow, which borrows heavily from our [Technical Introduction to MACI](/blog/maci-1-0-technical-introduction#system-overview).
13
+
14
+ ## Roles
15
+
16
+ There are two key roles that participate in MACI:
17
+
18
+ 1. Users, who vote on polls
19
+ 2. A trusted coordinator, who configures and launches polls, tallies up votes, and publishes the final results
20
+
21
+ ### User (voter)
22
+
23
+ A "User" is any voter in a MACI poll.
24
+
25
+ In order to participate in a MACI poll, a user will perform at least 3 on-chain transactions (the first time they vote):
26
+
27
+ 1. Sign up with MACI
28
+ 2. Join a poll
29
+ 3. Vote on a poll
30
+
31
+ <!-- TODO: add flowchart that demonstrates this (but show happy path, not key switching) -->
32
+ <!-- https://miro.medium.com/v2/resize:fit:1400/format:webp/0*whHfC8-xxAwSyaaO -->
33
+
34
+ ### Coordinator
35
+
36
+ The "Coordinator" helps set up and execute MACI polls. They are responsible for deploying the MACI smart contracts, initiating polls, tallying the final results of a vote, and finalizing polls by publishing the final results on-chain.
37
+
38
+ :::info
39
+ Note: it's possible for the contract deployer and the coordinator to be two separate accounts/entities, but for simplicity we'll start by assuming these functions are the same role.
40
+ :::
41
+
42
+ Once a voting poll has completed (i.e. the voting deadline has elapsed), the coordinator has the sole ability to decrypt all user votes and tally up the total results. The coordinator then publishes commitments and proofs of these results on chain to finalize a poll. The coordinators must use zk-SNARKs proofs to guarantee that their final tally result is valid, and this is accomplished without releasing the vote of every individual.
43
+
44
+ <!-- In order to execute a MACI poll, a coordinator will perform at least 3 types of on-chain transactions:
45
+
46
+ 1. deploy contracts
47
+ 2. -->
48
+
49
+ #### Trust assumptions
50
+
51
+ We say the coordinator is a "trusted" coordinator, because there are areas where a corrupt (or inept) coordinator could disrupt the "happy path" of the MACI workflow.
52
+
53
+ For instance, a coordinator can:
54
+
55
+ - Decrypt votes (in order to publish them, or to bribe individual voters)
56
+ - Halt a round (by never tallying results or never submitting the final proofs)
57
+
58
+ A coordinator cannot:
59
+
60
+ - Publish incorrect results (either by censoring valid votes or creating fraudulent votes)
61
+ - Change the parameters of a poll (e.g. by extending its voting deadline once it's been deployed)
62
+
63
+ Therefore, even if a coordinator is corrupt, they are unable to change a user’s vote or add extra votes themselves. A corrupt coordinator can stop a vote by never publishing the results, but they can’t publish false results.
64
+
65
+ ## Contracts
66
+
67
+ To explain the MACI workflow, let's give a quick overview of the key smart contracts.
68
+
69
+ See our [smart contract docs](/docs/category/smart-contracts) or our [contract source code](https://github.com/privacy-scaling-explorations/maci/tree/dev/contracts/contracts) for a more in-depth explanation of all smart contracts.
70
+
71
+ ### MACI.sol
72
+
73
+ The MACI contract is responsible for registering user signups by recording the initial public key for each user (via the [`signUp` function](/docs/technical-references/smart-contracts/solidity-docs/MACI#signup-1)). To conduct a voting round, the coordinator can deploy a Poll via MACI (with the [`deployPoll` function](/docs/technical-references/smart-contracts/solidity-docs/MACI#deploypoll)).
74
+
75
+ ### Poll.sol
76
+
77
+ The Poll contract is where users submit their votes (via the [`publishMessage` function](/docs/technical-references/smart-contracts/solidity-docs/Poll#publishmessage)). One MACI contract can be used for multiple Poll contracts. In other words, a user that signed up to the MACI contract can vote on multiple issues, with each issue represented by a distinct Poll contract. Each Poll contract will have its own independent state.
78
+
79
+ ### MessageProcessor.sol and Tally.sol
80
+
81
+ The MessageProcessor and Tally contracts are used by the coordinator to process all user votes and to prove on-chain that they correctly tallied each vote.
82
+
83
+ ## Poll lifecycle
84
+
85
+ As described above, a core contract of MACI is a Poll. Coordinators can deploy polls and add vote options to polls, which users can then vote on. Although each instance of MACI can deploy multiple Polls, only one Poll can be active at a time.
86
+
87
+ In essence, each MACI Poll is a state machine which has 3 stages:
88
+
89
+ 1. Open
90
+ 2. Closed
91
+ 3. Finalized
92
+
93
+ ### 1) Open
94
+
95
+ When a Poll is deployed, its voting period starts immediately. As part of its deployment, the `duration` of the Poll is set, which determines how long the Poll is open for voting. A Poll is "open" until the duration of the Poll has elapsed.
96
+
97
+ During this stage, users can sign up and vote.
98
+
99
+ #### Sign up
100
+
101
+ Before a user can cast a vote, they must sign up by generating a MACI keypair and then sending the public key they wish to use to cast their vote to the MACI smart contract. This MACI public key (distinct from their Ethereum account public key) acts as their identity when voting. Users can vote from any Ethereum address, but their message must contain a signature from that MACI public key.
102
+
103
+ This registration process is necessary to fortify MACI against Sybil attacks. The particular criteria used to allow user signups is customizable, and can be configured using any [SignUpPolicy contract](https://github.com/privacy-scaling-explorations/excubiae/tree/main/packages/contracts/contracts/extensions). This contracts dictate the criteria a user must pass in order to participate in a poll. For example, a user might need to prove ownership of a certain NFT, or that they've received some attestation on EAS, or prove that they have passed some sort of proof-of-personhood verification. Note that MACI presumes an identity system where each legitimate member
104
+ controls a unique private key - MACI does not specifically solve for this, but allows for customization on how this is configured.
105
+
106
+ #### Vote
107
+
108
+ Once a user has signed up with MACI, they are eligible to vote on open polls.
109
+
110
+ To cast a vote, a user will bundle a few variables — including a public key, their vote option, their vote amount, and a few others — into what is called a "command". Then, the user signs the command with the private key they originally used to sign up. After that, the user encrypts the signature and command together so that it is now considered a "message". If the command is properly signed by the user’s MACI public key, then the message is considered valid will be counted in the final tally. Therefore, the MACI public key can be thought of as the user’s voting username, and the signature is the voting password. If they provide the correct signature, they can submit a vote.
111
+
112
+ Before sending their vote on-chain, users encrypt their vote using a shared key that only the user and coordinator can know. This key scheme is designed so that every individual user shares a distinct key with the coordinator. This prevents any bribers from simply reading the transaction data to see which option a user voted for. It also allows the coordinator to decrypt user votes (so that they can tally the results).
113
+
114
+ ### 2) Closed
115
+
116
+ A Poll is "closed", when the voting period ends. At this point, no users may submit any more votes. The Poll remains closed until the coordinator tallies the final results.
117
+
118
+ At this point, the coordinator must process all the messages, tally the results, and publish the proofs on-chain.
119
+
120
+ #### Process Messages
121
+
122
+ Once the voting period has completed for a specific poll, the coordinator will use the `MessageProcessor` contract to first prove that they have correctly decrypted each message and applied them to correctly create an updated state tree. This state tree keeps an account of all the valid votes that should be counted. So, when processing the messages, the coordinator will not keep messages that are later overridden by a newer message inside the state tree. For example, if a user votes for option A, but then later sends a new message to vote for option B, the coordinator will only count the vote for option B.
123
+
124
+ The coordinator must process messages in batches so that proving on chain does not exceed the data limit. The coordinator then creates a zk-SNARK proving their state tree correctly contains only the valid messages. Once the proof is ready, the coordinator calls [`MessageProcessor.processMessages()`](/docs/technical-references/smart-contracts/solidity-docs/MessageProcessor#processmessages), providing a hash of the state tree and the zk-SNARK proof as an input parameters.
125
+
126
+ The `MessageProcessor` contract will send the proof to a separate verifier contract. The verifier contract is specifically built to read MACI zk-SNARK proofs and tell if they are valid or not. So, if the verifier contract returns true, then everyone can see on-chain that the coordinator correctly processed that batch of messages. The coordinator repeats this process until all messages have been processed.
127
+
128
+ #### Tally Results
129
+
130
+ Finally, once all messages have been processed, the coordinator tallies the votes of the valid messages (off-chain). The coordinator creates a zk-SNARK proving that the valid messages in the state tree (proved in Process Messages step) contain votes that sum to the given tally result. Then, they call [`Tally.tallyVotes()`](/docs/technical-references/smart-contracts/solidity-docs/Tally#tallyvotes) with a hash of the correct tally results and the zk-SNARK proof. Similarly to the processMessages function, the `tallyVotes` function will send the proof to a verifier contract to ensure that it is valid.
131
+
132
+ <!-- "hash of the correct tally results" - so are the final results actually put on chain? or just a hash?? -->
133
+
134
+ The `tallyVotes` function is only successful if the verifier contract returns that the proof is valid. Therefore, once the `tallyVotes` function succeeds, users can trust that the coordinator has correctly tallied all of the valid votes. After this step, anyone can see the final tally results and the proof that these results are a correct result of the messages sent to the Poll contract. The users won’t be able to see how any individual voted, but will be able to trust that these votes were properly processed and counted.
135
+
136
+ <!-- "After this step, anyone can see the final tally results" - how if only hash of results are published? -->
137
+ <!-- https://miro.medium.com/v2/resize:fit:1400/format:webp/0*7Le2odbX7e2etpxR -->
138
+
139
+ ### 3) Finalized
140
+
141
+ A poll is "finalized" after the coordinator processes all the messages, tallies the results, and publishes the on-chain proofs.
142
+
143
+ At this point, the final results of a poll can be announced, and anyone can verify that the results have been processed and calculated correctly by the coordinator.
@@ -0,0 +1,4 @@
1
+ {
2
+ "label": "Guides",
3
+ "position": 4
4
+ }
@@ -0,0 +1,175 @@
1
+ ---
2
+ title: Compile Circuits
3
+ description: Compile new circuits
4
+ sidebar_label: Compile Circuits
5
+ sidebar_position: 4
6
+ ---
7
+
8
+ # Compile Circuits
9
+
10
+ :::note
11
+ This guide is only useful if you need an specific configurations for number of users, votes, etc. If you plant to use the new circuits in production, make sure they go through a trusted ceremony.
12
+ :::
13
+
14
+ ## Installation
15
+
16
+ ### Requirements
17
+
18
+ You need the following to generate new circuits:
19
+
20
+ - The [`rapidsnark`](https://github.com/iden3/rapidsnark) tool if running on an intel chip (this allows for faster proof generation vs snarkjs).
21
+
22
+ :::note
23
+ MACI works on Linux and MacOS. It has not been tested on Windows, however it should work on Windows Subsystem for Linux (WSL). Keep in mind that when using MACI e2e on a non intel chip, tests will run using snarkjs with WASM. This will result in slower proof generation.
24
+ :::
25
+
26
+ ### Install `rapidsnark` (if on an intel chip)
27
+
28
+ First, install dependencies:
29
+
30
+ ```bash
31
+ sudo apt-get install build-essential cmake libgmp-dev libsodium-dev nasm curl m4
32
+ ```
33
+
34
+ If you're running on **MacOS with an intel chip**, install dependencies by running the following command:
35
+
36
+ ```bash
37
+ brew install cmake gmp libsodium nasm
38
+ ```
39
+
40
+ Next, clone `rapidsnark` and build it:
41
+
42
+ ```bash
43
+ git clone https://github.com/iden3/rapidsnark.git && \
44
+ cd rapidsnark
45
+
46
+ pnpm install && \
47
+ git submodule init && \
48
+ git submodule update && \
49
+ ./build_gmp.sh host && \
50
+ mkdir build_prover && cd build_prover && \
51
+ cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../package && \
52
+ make -j4 && make install
53
+ ```
54
+
55
+ Note the location of the `rapidsnark` binary (e.g.
56
+ `/home/user/rapidsnark/build/prover`).
57
+
58
+ For more information, please check rapidsnark [github repo](https://github.com/iden3/rapidsnark)
59
+
60
+ ### Install circom v2:
61
+
62
+ https://docs.circom.io/
63
+
64
+ Note the location of the `circom` binary (e.g. `$HOME/.cargo/bin/circom`), as you will need it later.
65
+
66
+ #### On Intel chips (no ARM64)
67
+
68
+ Install dependencies:
69
+
70
+ ```bash
71
+ sudo apt-get install libgmp-dev nlohmann-json3-dev nasm g++
72
+ ```
73
+
74
+ :::info
75
+ Remember that if on a ARM64 chip, you will not be able to compile the c++ witness generator and thus use rapidsnark. Please follow instructions for WASM artifacts, in case you decide to recompile artifacts.
76
+ :::
77
+
78
+ ### Configure circomkit
79
+
80
+ Edit `circuits/circom/circuits` to include the circuits you would like to compile. This comes already configured with the two main coordinator circuits, in both qv and non qv variants, as well as the client side circuit. The parameters are designed to support testing use cases:
81
+
82
+ ```json
83
+ {
84
+ "PollJoining_10_test": {
85
+ "file": "./anon/poll",
86
+ "template": "PollJoining",
87
+ "params": [10],
88
+ "pubs": ["nullifier", "stateRoot", "pollPubKey", "pollId"]
89
+ },
90
+ "PollJoined_10_test": {
91
+ "file": "./anon/poll",
92
+ "template": "PollJoined",
93
+ "params": [10],
94
+ "pubs": ["stateRoot"]
95
+ },
96
+ "ProcessMessages_10-20-2_test": {
97
+ "file": "./core/qv/processMessages",
98
+ "template": "ProcessMessages",
99
+ "params": [10, 20, 2],
100
+ "pubs": [
101
+ "numSignUps",
102
+ "index",
103
+ "batchEndIndex",
104
+ "currentSbCommitment",
105
+ "newSbCommitment",
106
+ "outputBatchHash",
107
+ "actualStateTreeDepth",
108
+ "coordinatorPublicKeyHash",
109
+ "voteOptions"
110
+ ]
111
+ },
112
+ "ProcessMessagesNonQv_10-20-2_test": {
113
+ "file": "./core/non-qv/processMessages",
114
+ "template": "ProcessMessagesNonQv",
115
+ "params": [10, 20, 2],
116
+ "pubs": [
117
+ "numSignUps",
118
+ "index",
119
+ "batchEndIndex",
120
+ "currentSbCommitment",
121
+ "newSbCommitment",
122
+ "outputBatchHash",
123
+ "actualStateTreeDepth",
124
+ "coordinatorPublicKeyHash",
125
+ "voteOptions"
126
+ ]
127
+ },
128
+ "TallyVotes_10-1-2_test": {
129
+ "file": "./core/qv/tallyVotes",
130
+ "template": "TallyVotes",
131
+ "params": [10, 1, 2],
132
+ "pubs": ["index", "numSignUps", "sbCommitment", "currentTallyCommitment", "newTallyCommitment"]
133
+ },
134
+ "TallyVotesNonQv_10-1-2_test": {
135
+ "file": "./core/non-qv/tallyVotes",
136
+ "template": "TallyVotesNonQv",
137
+ "params": [10, 1, 2],
138
+ "pubs": ["index", "numSignUps", "sbCommitment", "currentTallyCommitment", "newTallyCommitment"]
139
+ }
140
+ }
141
+ ```
142
+
143
+ ### Generate `.zkey` files
144
+
145
+ If you wish to generate `.zkey` files from scratch, first navigate to `circuits/circom`
146
+ and edit `circuits.json`. Set the parameters you need.
147
+
148
+ Next, run the following to compile the circuits with parameters you specified:
149
+
150
+ **for the c++ witness generator**
151
+
152
+ ```bash
153
+ pnpm test:circuits-c -- --outPath ../cli/zkeys
154
+ ```
155
+
156
+ **for the wasm witness generator**
157
+
158
+ ```bash
159
+ pnpm build:circuits-wasm -- --outPath ../cli/zkeys
160
+ ```
161
+
162
+ Finally, generate the `.zkey` files. This may require a lot of memory and time.
163
+
164
+ ```bash
165
+ pnpm setup:zkeys -- --outPath ../cli/zkeys
166
+ ```
167
+
168
+ > If on a ARM64 chip, the above will work with the wasm witness only. The errors you will get for the c++ witness are:
169
+ >
170
+ > ```bash
171
+ > main.cpp:9:10: fatal error: 'nlohmann/json.hpp' file not found
172
+ > #include <nlohmann/json.hpp>
173
+ > ^~~~~~~~~~~~~~~~~~~
174
+ > 1 error generated.
175
+ > ```
@@ -0,0 +1,137 @@
1
+ ---
2
+ title: Integrating MACI
3
+ description: How to integrate MACI into your application
4
+ sidebar_label: Integrating
5
+ sidebar_position: 5
6
+ ---
7
+
8
+ MACI can be used in any protocol that requires collusion resistance, for instance it has been proven to be quite efficient when integrated in quadratic funding applications such as [clr.fund](https://github.com/clrfund/monorepo), [qfi](https://github.com/quadratic-gardens/qfi/tree/main), [MACI Platform](https://github.com/privacy-scaling-explorations/maci-platform), and the [Gitcoin Allo Stack](https://github.com/gitcoinco/MACI_QF).
9
+
10
+ Here we will be looking at how the smart contracts can be integrated.
11
+
12
+ ## MACI Contract
13
+
14
+ The MACI contract is the core of the protocol. Contracts can inherit from MACI and thus expose the `signUp` and `deployPoll` functions. As with standalone MACI, one would need to deploy a [sign up policy](/docs/technical-references/smart-contracts/Policies).
15
+
16
+ As an example, a [contract](https://github.com/ctrlc03/minimalQF/blob/main/contracts/MinimalQf.sol#L113) could inherit from MACI and allows sign up via a custom signup function.
17
+
18
+ ```javascript
19
+ /// @inheritdoc IMACI
20
+ function signUp(PubKey memory _pubKey, bytes memory _signUpPolicyData) public virtual {
21
+ // ensure we do not have more signups than what the circuits support
22
+ if (leanIMTData.size >= maxSignups) revert TooManySignups();
23
+
24
+ // ensure that the public key is on the baby jubjub curve
25
+ if (!CurveBabyJubJub.isOnCurve(_pubKey.x, _pubKey.y)) {
26
+ revert InvalidPubKey();
27
+ }
28
+
29
+ // Register the user via the sign-up policy. This function should
30
+ // throw if the user has already registered or if ineligible to do so.
31
+ signUpPolicy.enforce(msg.sender, _signUpPolicyData);
32
+
33
+ // Hash the public key and insert it into the tree.
34
+ uint256 pubKeyHash = hashLeftRight(_pubKey.x, _pubKey.y);
35
+ uint256 stateRoot = InternalLeanIMT._insert(leanIMTData, pubKeyHash);
36
+
37
+ // Store the current state tree root in the array
38
+ stateRootsOnSignUp.push(stateRoot);
39
+
40
+ emit SignUp(leanIMTData.size - 1, block.timestamp, _pubKey.x, _pubKey.y);
41
+ }
42
+ ```
43
+
44
+ ## InitialVoiceCreditProxy
45
+
46
+ If you'd like to extend the functionality of how votes are distributed among users, you need to extend [InitialVoiceCreditProxy](https://github.com/privacy-scaling-explorations/maci/blob/dev/contracts/contracts/initialVoiceCreditProxy/InitialVoiceCreditProxy.sol) contract. You can see our [basic example](https://github.com/privacy-scaling-explorations/maci/blob/dev/contracts/contracts/initialVoiceCreditProxy/ConstantInitialVoiceCreditProxy.sol) how it's implemented for constant distribution.
47
+
48
+ ```ts
49
+ contract ConstantInitialVoiceCreditProxy is InitialVoiceCreditProxy {
50
+ /// @notice the balance to be returned by getVoiceCredits
51
+ uint256 internal balance;
52
+
53
+ /// @notice creates a new ConstantInitialVoiceCreditProxy
54
+ /// @param _balance the balance to be returned by getVoiceCredits
55
+ constructor(uint256 _balance) payable {
56
+ balance = _balance;
57
+ }
58
+
59
+ /// @notice Returns the constant balance for any new MACI's voter
60
+ /// @return balance
61
+ function getVoiceCredits(address, bytes memory) public view override returns (uint256) {
62
+ return balance;
63
+ }
64
+ }
65
+ ```
66
+
67
+ ## Poll Contract
68
+
69
+ On the other hand, the Poll contract can be inherited to expand functionality such as publishing of messages/commands, or the logic that allows users to register for the poll (AKA poll joining).
70
+
71
+ ```javascript
72
+ function joinPoll(
73
+ uint256 _nullifier,
74
+ PubKey calldata _pubKey,
75
+ uint256 _stateRootIndex,
76
+ uint256[8] calldata _proof,
77
+ bytes memory _signUpPolicyData,
78
+ bytes memory _initialVoiceCreditProxyData
79
+ ) external virtual isWithinVotingDeadline {
80
+ // Whether the user has already joined
81
+ if (pollNullifiers[_nullifier]) {
82
+ revert UserAlreadyJoined();
83
+ }
84
+
85
+ // Set nullifier for user's private key
86
+ pollNullifiers[_nullifier] = true;
87
+
88
+ // Verify user's proof
89
+ if (!verifyJoiningPollProof(_nullifier, _stateRootIndex, _pubKey, _proof)) {
90
+ revert InvalidPollProof();
91
+ }
92
+
93
+ // Check if the user is eligible to join the poll
94
+ extContracts.policy.enforce(msg.sender, _signUpPolicyData);
95
+
96
+ // Get the user's voice credit balance.
97
+ uint256 voiceCreditBalance = extContracts.initialVoiceCreditProxy.getVoiceCredits(
98
+ msg.sender,
99
+ _initialVoiceCreditProxyData
100
+ );
101
+
102
+ // Store user in the pollStateTree
103
+ uint256 stateLeaf = hashStateLeaf(StateLeaf(_pubKey, voiceCreditBalance, block.timestamp));
104
+
105
+ uint256 stateRoot = InternalLazyIMT._insert(pollStateTree, stateLeaf);
106
+
107
+ // Store the current state tree root in the array
108
+ pollStateRootsOnJoin.push(stateRoot);
109
+
110
+ uint256 pollStateIndex = pollStateTree.numberOfLeaves - 1;
111
+ emit PollJoined(_pubKey.x, _pubKey.y, voiceCreditBalance, block.timestamp, _nullifier, pollStateIndex);
112
+ }
113
+ ```
114
+
115
+ ## Tally Contract
116
+
117
+ Given the verification functions being exposed by the Tally contract, quadratic funding protocols might require to extend the Tally contract to add distribution logic. Looking at this [example](https://github.com/ctrlc03/minimalQF/blob/main/contracts/MinimalQFTally.sol#L114) the `claimFunds` function is added to a contract inheriting from `Tally`, and uses functions such as `verifyPerVOSpentVoiceCredits` to distribute funds to projects part of a quadratic funding round.
118
+
119
+ ## SDK
120
+
121
+ Another important component of MACI is the [SDK](https://github.com/privacy-scaling-explorations/maci/tree/dev/packages/sdk). This is a TypeScript library that allows you to interact with MACI.
122
+
123
+ You can find the following subdirectories, where functions are organised as follows:
124
+
125
+ - `deploy` - For deployment related code
126
+ - `keys` - For utilities related to MACI keys
127
+ - `maci` - For functions that allow to interact with the MACI contract, such as user signup
128
+ - `poll` - For functions that allow to interact with the Poll contract, such as poll joining
129
+ - `proof` - For functions related to proof generation, and submission on chain
130
+ - `relayer` - For functions that allow to interact with the relayer service
131
+ - `tally` - For functions that allow to interact with the Tally contract
132
+ - `trees` - Utility functions to interact with MACI's merkle trees structures
133
+ - `user` - Function related to user activities such as sign up and poll joining
134
+ - `utils` - Various utility functions that are used across the SDK and more
135
+ - `vote` - Functions that allow to create MACI encrypted votes and submit them on chain
136
+
137
+ You should find all you need to integrate MACI into your application inside this package. If anything is missing, feel free to open an issue on our repo.
@@ -0,0 +1,79 @@
1
+ ---
2
+ title: Subgraph Deployment
3
+ description: How to deploy a MACI Subgraph
4
+ sidebar_label: Subgraph Deployment
5
+ sidebar_position: 1
6
+ ---
7
+
8
+ # Subgraph Deployment
9
+
10
+ In some instances like a frontend you might need to deploy a subgraph, in the MACI repository you can find the configuration to deploy a subgraph on The Graph Network or Alchemy Subgraphs.
11
+
12
+ :::important
13
+ While the free plan of The Graph and Alchemy can work well, it's recommended to use a paid plan for production.
14
+ :::
15
+
16
+ ## Configuration
17
+
18
+ Head to the subgraph folder in the app folder.
19
+
20
+ ```bash
21
+ cd apps/subgraph
22
+ ```
23
+
24
+ Edit the `network.json` file in the `config` folder. Adding the network it was deployed, the MACI contract and the block where it was deployed.
25
+
26
+ ```json
27
+ {
28
+ "network": "optimism-sepolia",
29
+ "maciContractAddress": "0xD18Ca45b6cC1f409380731C40551BD66932046c3",
30
+ "maciContractStartBlock": 11052407
31
+ }
32
+ ```
33
+
34
+ :::note
35
+ See the supported networks of The Graph **[here](https://thegraph.com/docs/en/developing/supported-networks/)**.
36
+ :::
37
+
38
+ Create a subgraph in [the graph studio](https://thegraph.com/studio/) and name it `maci-subgraph`.
39
+
40
+ ## The Graph Deployment
41
+
42
+ The first thing you need to do is to copy the `key` in subgraph studio dashboard and run the following command to authenticate:
43
+
44
+ ```bash
45
+ graph auth --studio {key}
46
+ ```
47
+
48
+ Then run the following commands to build and deploy the subgraph:
49
+
50
+ ```bash
51
+ pnpm run build && \
52
+ pnpm run deploy
53
+ ```
54
+
55
+ :::important
56
+ The `pnpm run deploy` command uses `maci-subgraph` as the subgraph name by default, but if you named your subgraph differently (e.g. maci-graph, my-graph, etc.), please change the command to `graph deploy --node https://api.studio.thegraph.com/deploy/ your_subgraph_name`
57
+ :::
58
+
59
+ ## Alchemy Deployment
60
+
61
+ Deploying to the Alchemy subgraph service requires some changes to the `subgraph.template.yaml` file located in the `templates` folder. You need to remove the following keys:
62
+
63
+ ```yaml
64
+ indexerHints:
65
+ prune: auto
66
+ ```
67
+
68
+ Now you can run the deploy command with some minor changes:
69
+
70
+ ```bash
71
+ graph deploy SUBGRAPH_NAME \
72
+ --version-label VERSION \
73
+ --node https://subgraphs.alchemy.com/api/subgraphs/deploy \
74
+ --deploy-key API_KEY
75
+ ```
76
+
77
+ :::note
78
+ In order to get a subgraph deploy key for alchemy, head to the subgraph dashboard section and select `add subgraph` and pick `Deploy a New Subgraph` here you will see the deploy key.
79
+ :::
@@ -0,0 +1,4 @@
1
+ {
2
+ "label": "Testing",
3
+ "position": 7
4
+ }