@maci-protocol/website 0.0.0-ci.185b643
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/.eslintrc.js +157 -0
- package/CHANGELOG.md +566 -0
- package/LICENSE +22 -0
- package/README.md +58 -0
- package/babel.config.js +3 -0
- package/blog/2021-10-12-maci-v1.md +100 -0
- package/blog/2022-09-22-maci-v1-technical-introduction.md +180 -0
- package/blog/2023-01-18-maci-v1.1.1.md +121 -0
- package/blog/2024-01-18-roadmap.md +106 -0
- package/blog/2024-02-28-maci-v1.2.0.md +121 -0
- package/blog/2024-04-10-roadmap-q2.md +96 -0
- package/blog/2024-05-08-ethdam.md +169 -0
- package/blog/2024-05-22-the-origins-of-maci.md +38 -0
- package/blog/2024-05-28-upcoming-grants.md +85 -0
- package/blog/2024-06-17-understanding-maci.md +63 -0
- package/blog/2024-06-21-deciphering-maci.md +48 -0
- package/blog/2024-06-28-revolusioning-public-goods-funding.md +32 -0
- package/blog/2024-07-23-q2-review.md +72 -0
- package/blog/2024-07-30-roadmap-q3.md +61 -0
- package/blog/2024-08-10-maci-v2.md +102 -0
- package/blog/2024-08-29-anonymous-poll-joining.md +47 -0
- package/blog/2024-10-29-q3-review.md +63 -0
- package/blog/2024-11-20-maci-platform.md +93 -0
- package/blog/2024-12-01-maci-getting-started.md +294 -0
- package/blog/2025-03-21-roadmap-2025.md +112 -0
- package/blog/assets/MACI_Bob_SignUp_1.png +0 -0
- package/blog/assets/MACI_Bob_SignUp_2.png +0 -0
- package/blog/assets/MACI_Complex_Message.png +0 -0
- package/blog/assets/MACI_Contracts.png +0 -0
- package/blog/assets/MACI_Sign_Up.png +0 -0
- package/blog/assets/MACI_Simple_Message.png +0 -0
- package/blog/assets/MACI_Verifier_1.png +0 -0
- package/blog/authors.yml +5 -0
- package/docusaurus.config.ts +213 -0
- package/package.json +65 -0
- package/src/components/ActionCard/index.tsx +30 -0
- package/src/components/ActionCard/styles.module.css +96 -0
- package/src/components/HomepageFeatures/index.tsx +91 -0
- package/src/components/HomepageFeatures/styles.module.css +17 -0
- package/src/components/ProjectCard/index.tsx +74 -0
- package/src/components/ProjectCard/styles.module.css +77 -0
- package/src/components/ProjectList/index.tsx +218 -0
- package/src/components/ProjectList/styles.module.css +180 -0
- package/src/content/projects.json +294 -0
- package/src/css/card.module.css +130 -0
- package/src/css/custom.css +91 -0
- package/src/icons/IconDiscord.tsx +16 -0
- package/src/icons/IconGithub.tsx +16 -0
- package/src/icons/IconWebsite.tsx +16 -0
- package/src/pages/blogs.tsx +58 -0
- package/src/pages/index.module.css +152 -0
- package/src/pages/index.tsx +66 -0
- package/src/pages/projects.tsx +44 -0
- package/src/pages/roadmap.md +150 -0
- package/src/pages/typedoc.tsx +11 -0
- package/src/plugins/blog-plugin/index.ts +86 -0
- package/src/react-app-env.d.ts +1 -0
- package/src/scripts/setupSolidityDocs.ts +67 -0
- package/src/scripts/setupTypedoc.ts +112 -0
- package/src/scripts/utils.ts +115 -0
- package/src/utils/getProjectsByFilter.ts +40 -0
- package/static/.nojekyll +0 -0
- package/static/audit_reports/20210922_Hashcloak_audit_report.pdf +0 -0
- package/static/audit_reports/202220930_Hashcloak_audit_report.pdf +0 -0
- package/static/audit_reports/20240223_PSE_Audit_audit_report.pdf +0 -0
- package/static/audit_reports/20240731_PSE_Audit_audit_report.pdf +0 -0
- package/static/fonts/DM_Sans.woff2 +0 -0
- package/static/fonts/Share_Tech_Mono.woff2 +0 -0
- package/static/img/box.png +0 -0
- package/static/img/box_dark.png +0 -0
- package/static/img/chain.png +0 -0
- package/static/img/chain_dark.png +0 -0
- package/static/img/chart.png +0 -0
- package/static/img/chart_dark.png +0 -0
- package/static/img/circuits/MACI-Circuits.excalidraw +39652 -0
- package/static/img/circuits/calculateTotal.svg +21 -0
- package/static/img/circuits/ecdh.svg +21 -0
- package/static/img/circuits/messageToCommand.svg +21 -0
- package/static/img/circuits/messageValidator.svg +21 -0
- package/static/img/circuits/poseidonHasher13.svg +21 -0
- package/static/img/circuits/privToPubkey.svg +21 -0
- package/static/img/circuits/processMessages.svg +21 -0
- package/static/img/circuits/processMessagesInputHasher.svg +21 -0
- package/static/img/circuits/processMessages_2_0.svg +21 -0
- package/static/img/circuits/processOne.svg +21 -0
- package/static/img/circuits/processTopup.svg +21 -0
- package/static/img/circuits/processingAfterPollEnds.svg +21 -0
- package/static/img/circuits/quinBatchLeavesExists.svg +21 -0
- package/static/img/circuits/quinCheckRoot.svg +21 -0
- package/static/img/circuits/quinGeneratePathIndices.svg +21 -0
- package/static/img/circuits/quinSelector.svg +21 -0
- package/static/img/circuits/resultsCommitmentVerifier.svg +21 -0
- package/static/img/circuits/splicer.svg +21 -0
- package/static/img/circuits/tallyInputHasher.svg +21 -0
- package/static/img/circuits/tallyVotes.svg +21 -0
- package/static/img/circuits/unpackElement.svg +21 -0
- package/static/img/circuits/verifySignature.svg +21 -0
- package/static/img/completingAPoll.svg +4 -0
- package/static/img/contracts.svg +16 -0
- package/static/img/coordinatorComponents.svg +21 -0
- package/static/img/favicon.ico +0 -0
- package/static/img/generateProofs.svg +4 -0
- package/static/img/hero.svg +9 -0
- package/static/img/maci-card.png +0 -0
- package/static/img/maci-rpgf-design.jpg +0 -0
- package/static/img/messageProcessingLocal.svg +21 -0
- package/static/img/offlineProcessing.svg +21 -0
- package/static/img/pse-logo-round.png +0 -0
- package/static/img/relayer-diagram.png +0 -0
- package/static/img/tallyCommitments.svg +4 -0
- package/static/img/voteTallyingLocal.svg +21 -0
- package/tsconfig.json +34 -0
- package/versioned_docs/version-v0.x/circuits.md +22 -0
- package/versioned_docs/version-v0.x/contract.md +186 -0
- package/versioned_docs/version-v0.x/faq.md +67 -0
- package/versioned_docs/version-v0.x/introduction.md +119 -0
- package/versioned_docs/version-v0.x/quadratic-vote-tallying-circuit.md +138 -0
- package/versioned_docs/version-v0.x/state-root-transition-circuit.md +230 -0
- package/versioned_docs/version-v1.2/audit.md +160 -0
- package/versioned_docs/version-v1.2/ci-pipeline.md +38 -0
- package/versioned_docs/version-v1.2/circuits.md +508 -0
- package/versioned_docs/version-v1.2/cli.md +689 -0
- package/versioned_docs/version-v1.2/contracts.md +445 -0
- package/versioned_docs/version-v1.2/contributing/code-of-conduct.md +91 -0
- package/versioned_docs/version-v1.2/contributing/contributing.md +129 -0
- package/versioned_docs/version-v1.2/coordinator-processing.md +46 -0
- package/versioned_docs/version-v1.2/deployment.md +122 -0
- package/versioned_docs/version-v1.2/installation.md +175 -0
- package/versioned_docs/version-v1.2/integrating.md +200 -0
- package/versioned_docs/version-v1.2/introduction.md +94 -0
- package/versioned_docs/version-v1.2/key-change.md +182 -0
- package/versioned_docs/version-v1.2/overview.md +47 -0
- package/versioned_docs/version-v1.2/poll-types.md +68 -0
- package/versioned_docs/version-v1.2/primitives.md +216 -0
- package/versioned_docs/version-v1.2/project-ideas.md +14 -0
- package/versioned_docs/version-v1.2/purpose.md +62 -0
- package/versioned_docs/version-v1.2/solidity-docs/MACI.md +345 -0
- package/versioned_docs/version-v1.2/solidity-docs/MessageProcessor.md +266 -0
- package/versioned_docs/version-v1.2/solidity-docs/MessageProcessorFactory.md +26 -0
- package/versioned_docs/version-v1.2/solidity-docs/Poll.md +381 -0
- package/versioned_docs/version-v1.2/solidity-docs/PollFactory.md +50 -0
- package/versioned_docs/version-v1.2/solidity-docs/SignUpToken.md +27 -0
- package/versioned_docs/version-v1.2/solidity-docs/Subsidy.md +218 -0
- package/versioned_docs/version-v1.2/solidity-docs/SubsidyFactory.md +27 -0
- package/versioned_docs/version-v1.2/solidity-docs/Tally.md +311 -0
- package/versioned_docs/version-v1.2/solidity-docs/TallyFactory.md +27 -0
- package/versioned_docs/version-v1.2/solidity-docs/TallyNonQv.md +296 -0
- package/versioned_docs/version-v1.2/solidity-docs/TallyNonQvFactory.md +27 -0
- package/versioned_docs/version-v1.2/solidity-docs/TopupCredit.md +61 -0
- package/versioned_docs/version-v1.2/solidity-docs/VkRegistry.md +457 -0
- package/versioned_docs/version-v1.2/solidity-docs/benchmarks/HasherBenchmarks.md +44 -0
- package/versioned_docs/version-v1.2/solidity-docs/crypto/Hasher.md +125 -0
- package/versioned_docs/version-v1.2/solidity-docs/crypto/IVerifier.md +11 -0
- package/versioned_docs/version-v1.2/solidity-docs/crypto/MockVerifier.md +17 -0
- package/versioned_docs/version-v1.2/solidity-docs/crypto/Pairing.md +85 -0
- package/versioned_docs/version-v1.2/solidity-docs/crypto/PoseidonT3.md +9 -0
- package/versioned_docs/version-v1.2/solidity-docs/crypto/PoseidonT4.md +9 -0
- package/versioned_docs/version-v1.2/solidity-docs/crypto/PoseidonT5.md +9 -0
- package/versioned_docs/version-v1.2/solidity-docs/crypto/PoseidonT6.md +9 -0
- package/versioned_docs/version-v1.2/solidity-docs/crypto/SnarkCommon.md +16 -0
- package/versioned_docs/version-v1.2/solidity-docs/crypto/SnarkConstants.md +40 -0
- package/versioned_docs/version-v1.2/solidity-docs/crypto/Verifier.md +61 -0
- package/versioned_docs/version-v1.2/solidity-docs/gatekeepers/EASGatekeeper.md +121 -0
- package/versioned_docs/version-v1.2/solidity-docs/gatekeepers/FreeForAllSignUpGatekeeper.md +40 -0
- package/versioned_docs/version-v1.2/solidity-docs/gatekeepers/SignUpGatekeeper.md +26 -0
- package/versioned_docs/version-v1.2/solidity-docs/gatekeepers/SignUpTokenGatekeeper.md +93 -0
- package/versioned_docs/version-v1.2/solidity-docs/gatekeepers/hatsGatekeepers/HatsGatekeeperBase.md +79 -0
- package/versioned_docs/version-v1.2/solidity-docs/gatekeepers/hatsGatekeepers/HatsGatekeeperMultiple.md +48 -0
- package/versioned_docs/version-v1.2/solidity-docs/gatekeepers/hatsGatekeepers/HatsGatekeeperSingle.md +42 -0
- package/versioned_docs/version-v1.2/solidity-docs/index.md +4 -0
- package/versioned_docs/version-v1.2/solidity-docs/initialVoiceCreditProxy/ConstantInitialVoiceCreditProxy.md +40 -0
- package/versioned_docs/version-v1.2/solidity-docs/initialVoiceCreditProxy/InitialVoiceCreditProxy.md +26 -0
- package/versioned_docs/version-v1.2/solidity-docs/interfaces/IEAS.md +40 -0
- package/versioned_docs/version-v1.2/solidity-docs/interfaces/IHats.md +103 -0
- package/versioned_docs/version-v1.2/solidity-docs/interfaces/IMPFactory.md +26 -0
- package/versioned_docs/version-v1.2/solidity-docs/interfaces/IMessageProcessor.md +31 -0
- package/versioned_docs/version-v1.2/solidity-docs/interfaces/IPoll.md +217 -0
- package/versioned_docs/version-v1.2/solidity-docs/interfaces/IPollFactory.md +29 -0
- package/versioned_docs/version-v1.2/solidity-docs/interfaces/ITallyFactory.md +28 -0
- package/versioned_docs/version-v1.2/solidity-docs/interfaces/ITallySubsidyFactory.md +27 -0
- package/versioned_docs/version-v1.2/solidity-docs/interfaces/IVerifier.md +25 -0
- package/versioned_docs/version-v1.2/solidity-docs/interfaces/IVkRegistry.md +70 -0
- package/versioned_docs/version-v1.2/solidity-docs/mocks/MockHatsProtocol.md +133 -0
- package/versioned_docs/version-v1.2/solidity-docs/trees/AccQueue.md +464 -0
- package/versioned_docs/version-v1.2/solidity-docs/trees/AccQueueBinary.md +60 -0
- package/versioned_docs/version-v1.2/solidity-docs/trees/AccQueueBinary0.md +40 -0
- package/versioned_docs/version-v1.2/solidity-docs/trees/AccQueueBinaryMaci.md +34 -0
- package/versioned_docs/version-v1.2/solidity-docs/trees/AccQueueQuinary.md +75 -0
- package/versioned_docs/version-v1.2/solidity-docs/trees/AccQueueQuinary0.md +40 -0
- package/versioned_docs/version-v1.2/solidity-docs/trees/AccQueueQuinaryBlankSl.md +40 -0
- package/versioned_docs/version-v1.2/solidity-docs/trees/AccQueueQuinaryMaci.md +40 -0
- package/versioned_docs/version-v1.2/solidity-docs/trees/EmptyBallotRoots.md +13 -0
- package/versioned_docs/version-v1.2/solidity-docs/utilities/CommonUtilities.md +25 -0
- package/versioned_docs/version-v1.2/solidity-docs/utilities/DomainObjs.md +40 -0
- package/versioned_docs/version-v1.2/solidity-docs/utilities/Params.md +36 -0
- package/versioned_docs/version-v1.2/solidity-docs/utilities/Utilities.md +79 -0
- package/versioned_docs/version-v1.2/spec.md +944 -0
- package/versioned_docs/version-v1.2/testing-in-detail.md +209 -0
- package/versioned_docs/version-v1.2/testing.md +472 -0
- package/versioned_docs/version-v1.2/topup.md +43 -0
- package/versioned_docs/version-v1.2/troubleshooting.md +51 -0
- package/versioned_docs/version-v1.2/trusted-setup.md +76 -0
- package/versioned_docs/version-v1.2/typedoc/cli/.nojekyll +1 -0
- package/versioned_docs/version-v1.2/typedoc/cli/index.md +15 -0
- package/versioned_docs/version-v1.2/typedoc/cli/interfaces/AirdropArgs.md +89 -0
- package/versioned_docs/version-v1.2/typedoc/cli/interfaces/DeployArgs.md +154 -0
- package/versioned_docs/version-v1.2/typedoc/cli/interfaces/DeployPollArgs.md +154 -0
- package/versioned_docs/version-v1.2/typedoc/cli/interfaces/DeployedContracts.md +130 -0
- package/versioned_docs/version-v1.2/typedoc/cli/interfaces/GenLocalStateArgs.md +168 -0
- package/versioned_docs/version-v1.2/typedoc/cli/interfaces/GenProofsArgs.md +388 -0
- package/versioned_docs/version-v1.2/typedoc/cli/interfaces/IGenKeypairArgs.md +37 -0
- package/versioned_docs/version-v1.2/typedoc/cli/interfaces/IRegisteredUserArgs.md +63 -0
- package/versioned_docs/version-v1.2/typedoc/cli/interfaces/MergeMessagesArgs.md +76 -0
- package/versioned_docs/version-v1.2/typedoc/cli/interfaces/MergeSignupsArgs.md +76 -0
- package/versioned_docs/version-v1.2/typedoc/cli/interfaces/PollContracts.md +53 -0
- package/versioned_docs/version-v1.2/typedoc/cli/interfaces/ProveOnChainArgs.md +128 -0
- package/versioned_docs/version-v1.2/typedoc/cli/interfaces/PublishArgs.md +154 -0
- package/versioned_docs/version-v1.2/typedoc/cli/interfaces/SignupArgs.md +89 -0
- package/versioned_docs/version-v1.2/typedoc/cli/interfaces/SubsidyData.md +73 -0
- package/versioned_docs/version-v1.2/typedoc/cli/interfaces/TallyData.md +166 -0
- package/versioned_docs/version-v1.2/typedoc/cli/interfaces/TopupArgs.md +89 -0
- package/versioned_docs/version-v1.2/typedoc/cli/interfaces/VerifyArgs.md +128 -0
- package/versioned_docs/version-v1.2/typedoc/cli/modules.md +556 -0
- package/versioned_docs/version-v1.2/typedoc/core/.nojekyll +1 -0
- package/versioned_docs/version-v1.2/typedoc/core/classes/MaciState.md +295 -0
- package/versioned_docs/version-v1.2/typedoc/core/classes/Poll.md +1098 -0
- package/versioned_docs/version-v1.2/typedoc/core/index.md +110 -0
- package/versioned_docs/version-v1.2/typedoc/core/interfaces/BatchSizes.md +50 -0
- package/versioned_docs/version-v1.2/typedoc/core/interfaces/IJsonMaciState.md +77 -0
- package/versioned_docs/version-v1.2/typedoc/core/interfaces/IProcessMessagesCircuitInputs.md +242 -0
- package/versioned_docs/version-v1.2/typedoc/core/interfaces/ISubsidyCircuitInputs.md +198 -0
- package/versioned_docs/version-v1.2/typedoc/core/interfaces/ITallyCircuitInputs.md +231 -0
- package/versioned_docs/version-v1.2/typedoc/core/interfaces/MaxValues.md +37 -0
- package/versioned_docs/version-v1.2/typedoc/core/interfaces/TreeDepths.md +63 -0
- package/versioned_docs/version-v1.2/typedoc/core/modules.md +289 -0
- package/versioned_docs/version-v1.2/typedoc/crypto/.nojekyll +1 -0
- package/versioned_docs/version-v1.2/typedoc/crypto/classes/AccQueue.md +770 -0
- package/versioned_docs/version-v1.2/typedoc/crypto/classes/G1Point.md +115 -0
- package/versioned_docs/version-v1.2/typedoc/crypto/classes/G2Point.md +140 -0
- package/versioned_docs/version-v1.2/typedoc/crypto/classes/IncrementalQuinTree.md +470 -0
- package/versioned_docs/version-v1.2/typedoc/crypto/index.md +44 -0
- package/versioned_docs/version-v1.2/typedoc/crypto/interfaces/Keypair.md +33 -0
- package/versioned_docs/version-v1.2/typedoc/crypto/interfaces/PoseidonFuncs.md +115 -0
- package/versioned_docs/version-v1.2/typedoc/crypto/interfaces/Queue.md +33 -0
- package/versioned_docs/version-v1.2/typedoc/crypto/interfaces/Signature.md +37 -0
- package/versioned_docs/version-v1.2/typedoc/crypto/modules.md +913 -0
- package/versioned_docs/version-v1.2/typedoc/domainobjs/.nojekyll +1 -0
- package/versioned_docs/version-v1.2/typedoc/domainobjs/classes/Ballot.md +274 -0
- package/versioned_docs/version-v1.2/typedoc/domainobjs/classes/Keypair.md +181 -0
- package/versioned_docs/version-v1.2/typedoc/domainobjs/classes/Message.md +244 -0
- package/versioned_docs/version-v1.2/typedoc/domainobjs/classes/PCommand.md +409 -0
- package/versioned_docs/version-v1.2/typedoc/domainobjs/classes/PrivKey.md +206 -0
- package/versioned_docs/version-v1.2/typedoc/domainobjs/classes/PubKey.md +289 -0
- package/versioned_docs/version-v1.2/typedoc/domainobjs/classes/StateLeaf.md +340 -0
- package/versioned_docs/version-v1.2/typedoc/domainobjs/classes/TCommand.md +200 -0
- package/versioned_docs/version-v1.2/typedoc/domainobjs/classes/VerifyingKey.md +240 -0
- package/versioned_docs/version-v1.2/typedoc/domainobjs/index.md +81 -0
- package/versioned_docs/version-v1.2/typedoc/domainobjs/interfaces/ICommand.md +104 -0
- package/versioned_docs/version-v1.2/typedoc/domainobjs/interfaces/IG1ContractParams.md +31 -0
- package/versioned_docs/version-v1.2/typedoc/domainobjs/interfaces/IG2ContractParams.md +31 -0
- package/versioned_docs/version-v1.2/typedoc/domainobjs/interfaces/IJsonBallot.md +42 -0
- package/versioned_docs/version-v1.2/typedoc/domainobjs/interfaces/IJsonCommand.md +32 -0
- package/versioned_docs/version-v1.2/typedoc/domainobjs/interfaces/IJsonKeyPair.md +31 -0
- package/versioned_docs/version-v1.2/typedoc/domainobjs/interfaces/IJsonPCommand.md +111 -0
- package/versioned_docs/version-v1.2/typedoc/domainobjs/interfaces/IJsonStateLeaf.md +42 -0
- package/versioned_docs/version-v1.2/typedoc/domainobjs/interfaces/IJsonTCommand.md +67 -0
- package/versioned_docs/version-v1.2/typedoc/domainobjs/interfaces/IMessageContractParams.md +31 -0
- package/versioned_docs/version-v1.2/typedoc/domainobjs/interfaces/IStateLeaf.md +39 -0
- package/versioned_docs/version-v1.2/typedoc/domainobjs/interfaces/IStateLeafContractParams.md +42 -0
- package/versioned_docs/version-v1.2/typedoc/domainobjs/interfaces/IVkContractParams.md +64 -0
- package/versioned_docs/version-v1.2/typedoc/domainobjs/interfaces/IVkObjectParams.md +108 -0
- package/versioned_docs/version-v1.2/typedoc/domainobjs/interfaces/Proof.md +46 -0
- package/versioned_docs/version-v1.2/typedoc/domainobjs/interfaces/VoteOptionTreeLeaf.md +24 -0
- package/versioned_docs/version-v1.2/typedoc/domainobjs/modules.md +110 -0
- package/versioned_docs/version-v1.2/typedoc/index.md +4 -0
- package/versioned_docs/version-v1.2/versioning.md +94 -0
- package/versioned_docs/version-v1.2/workflow.md +142 -0
- package/versioned_docs/version-v2.x/case-studies.md +35 -0
- package/versioned_docs/version-v2.x/contributing/_category_.json +4 -0
- package/versioned_docs/version-v2.x/contributing/code-of-conduct.md +92 -0
- package/versioned_docs/version-v2.x/contributing/contributing.md +149 -0
- package/versioned_docs/version-v2.x/contributing/project-ideas.md +78 -0
- package/versioned_docs/version-v2.x/core-concepts/_category_.json +4 -0
- package/versioned_docs/version-v2.x/core-concepts/ballot.md +19 -0
- package/versioned_docs/version-v2.x/core-concepts/coordinator-processing.md +46 -0
- package/versioned_docs/version-v2.x/core-concepts/hashing-and-encryption.md +45 -0
- package/versioned_docs/version-v2.x/core-concepts/key-change.md +179 -0
- package/versioned_docs/version-v2.x/core-concepts/maci-keys.md +84 -0
- package/versioned_docs/version-v2.x/core-concepts/maci-messages.md +44 -0
- package/versioned_docs/version-v2.x/core-concepts/merkle-trees.md +23 -0
- package/versioned_docs/version-v2.x/core-concepts/poll-types.md +106 -0
- package/versioned_docs/version-v2.x/core-concepts/spec.md +883 -0
- package/versioned_docs/version-v2.x/core-concepts/state-leaf.md +42 -0
- package/versioned_docs/version-v2.x/core-concepts/workflow.md +142 -0
- package/versioned_docs/version-v2.x/getting-started.md +313 -0
- package/versioned_docs/version-v2.x/guides/_category_.json +4 -0
- package/versioned_docs/version-v2.x/guides/compile-circuits.md +163 -0
- package/versioned_docs/version-v2.x/guides/frontend.md +99 -0
- package/versioned_docs/version-v2.x/guides/integrating.md +73 -0
- package/versioned_docs/version-v2.x/guides/maciWrapper.md +173 -0
- package/versioned_docs/version-v2.x/guides/subgraph.md +79 -0
- package/versioned_docs/version-v2.x/guides/testing/_category_.json +4 -0
- package/versioned_docs/version-v2.x/guides/testing/testing-in-detail.md +203 -0
- package/versioned_docs/version-v2.x/guides/testing/testing.md +163 -0
- package/versioned_docs/version-v2.x/guides/troubleshooting.md +161 -0
- package/versioned_docs/version-v2.x/introduction.md +146 -0
- package/versioned_docs/version-v2.x/processes/_category_.json +4 -0
- package/versioned_docs/version-v2.x/processes/ci-pipeline.md +38 -0
- package/versioned_docs/version-v2.x/processes/versioning.md +94 -0
- package/versioned_docs/version-v2.x/resources.md +33 -0
- package/versioned_docs/version-v2.x/security/_category_.json +4 -0
- package/versioned_docs/version-v2.x/security/audit.md +167 -0
- package/versioned_docs/version-v2.x/security/trusted-setup.md +166 -0
- package/versioned_docs/version-v2.x/supported-networks/_category_.json +4 -0
- package/versioned_docs/version-v2.x/supported-networks/deployed-contracts.md +1108 -0
- package/versioned_docs/version-v2.x/supported-networks/supported-networks.md +47 -0
- package/versioned_docs/version-v2.x/technical-references/_category_.json +4 -0
- package/versioned_docs/version-v2.x/technical-references/smart-contracts/AccQueue.md +21 -0
- package/versioned_docs/version-v2.x/technical-references/smart-contracts/Gatekeepers.md +40 -0
- package/versioned_docs/version-v2.x/technical-references/smart-contracts/MACI.md +152 -0
- package/versioned_docs/version-v2.x/technical-references/smart-contracts/MessageProcessor.md +13 -0
- package/versioned_docs/version-v2.x/technical-references/smart-contracts/Params.md +32 -0
- package/versioned_docs/version-v2.x/technical-references/smart-contracts/Poll.md +104 -0
- package/versioned_docs/version-v2.x/technical-references/smart-contracts/PollFactory.md +43 -0
- package/versioned_docs/version-v2.x/technical-references/smart-contracts/Tally.md +45 -0
- package/versioned_docs/version-v2.x/technical-references/smart-contracts/VkRegistry.md +57 -0
- package/versioned_docs/version-v2.x/technical-references/smart-contracts/VoiceCreditProxy.md +18 -0
- package/versioned_docs/version-v2.x/technical-references/smart-contracts/_category_.json +8 -0
- package/versioned_docs/version-v2.x/technical-references/technical-references.md +47 -0
- package/versioned_docs/version-v2.x/technical-references/typescript-code/_category_.json +4 -0
- package/versioned_docs/version-v2.x/technical-references/typescript-code/cli.md +699 -0
- package/versioned_docs/version-v2.x/technical-references/zk-snark-circuits/_category_.json +4 -0
- package/versioned_docs/version-v2.x/technical-references/zk-snark-circuits/processMessages.md +107 -0
- package/versioned_docs/version-v2.x/technical-references/zk-snark-circuits/setup.md +101 -0
- package/versioned_docs/version-v2.x/technical-references/zk-snark-circuits/tallyVotes.md +79 -0
- package/versioned_docs/version-v2.x/technical-references/zk-snark-circuits/utilities.md +131 -0
- package/versioned_docs/version-v2.x/technical-references/zk-snark-circuits/zk-snark-circuits.md +37 -0
- package/versioned_docs/version-v2.x/use-cases/_category_.json +4 -0
- package/versioned_docs/version-v2.x/use-cases/governance.md +18 -0
- package/versioned_docs/version-v2.x/use-cases/polling.md +10 -0
- package/versioned_docs/version-v2.x/use-cases/public-goods.md +65 -0
- package/versioned_docs/version-v3.x/case-studies.md +35 -0
- package/versioned_docs/version-v3.x/contributing/_category_.json +4 -0
- package/versioned_docs/version-v3.x/contributing/code-of-conduct.md +92 -0
- package/versioned_docs/version-v3.x/contributing/contributing.md +149 -0
- package/versioned_docs/version-v3.x/contributing/project-ideas.md +78 -0
- package/versioned_docs/version-v3.x/core-concepts/_category_.json +4 -0
- package/versioned_docs/version-v3.x/core-concepts/ballot.md +19 -0
- package/versioned_docs/version-v3.x/core-concepts/coordinator-processing.md +46 -0
- package/versioned_docs/version-v3.x/core-concepts/coordinator-service.md +16 -0
- package/versioned_docs/version-v3.x/core-concepts/hashing-and-encryption.md +45 -0
- package/versioned_docs/version-v3.x/core-concepts/key-change.md +179 -0
- package/versioned_docs/version-v3.x/core-concepts/maci-keys.md +84 -0
- package/versioned_docs/version-v3.x/core-concepts/maci-messages.md +44 -0
- package/versioned_docs/version-v3.x/core-concepts/merkle-trees.md +16 -0
- package/versioned_docs/version-v3.x/core-concepts/offchain-voting.md +14 -0
- package/versioned_docs/version-v3.x/core-concepts/poll-types.md +58 -0
- package/versioned_docs/version-v3.x/core-concepts/polls.md +81 -0
- package/versioned_docs/version-v3.x/core-concepts/spec.md +883 -0
- package/versioned_docs/version-v3.x/core-concepts/state-leaf.md +42 -0
- package/versioned_docs/version-v3.x/core-concepts/workflow.md +149 -0
- package/versioned_docs/version-v3.x/guides/_category_.json +4 -0
- package/versioned_docs/version-v3.x/guides/compile-circuits.md +175 -0
- package/versioned_docs/version-v3.x/guides/integrating.md +137 -0
- package/versioned_docs/version-v3.x/guides/subgraph.md +79 -0
- package/versioned_docs/version-v3.x/guides/testing/_category_.json +4 -0
- package/versioned_docs/version-v3.x/guides/testing/testing-in-detail.md +191 -0
- package/versioned_docs/version-v3.x/guides/testing/testing-introduction.md +158 -0
- package/versioned_docs/version-v3.x/guides/troubleshooting.md +161 -0
- package/versioned_docs/version-v3.x/introduction.md +153 -0
- package/versioned_docs/version-v3.x/processes/_category_.json +4 -0
- package/versioned_docs/version-v3.x/processes/ci-pipeline.md +38 -0
- package/versioned_docs/version-v3.x/processes/versioning.md +94 -0
- package/versioned_docs/version-v3.x/quick-start.md +318 -0
- package/versioned_docs/version-v3.x/resources.md +33 -0
- package/versioned_docs/version-v3.x/security/_category_.json +4 -0
- package/versioned_docs/version-v3.x/security/audit.md +167 -0
- package/versioned_docs/version-v3.x/security/trusted-setup.md +172 -0
- package/versioned_docs/version-v3.x/supported-networks/_category_.json +4 -0
- package/versioned_docs/version-v3.x/supported-networks/deployed-contracts.md +112 -0
- package/versioned_docs/version-v3.x/supported-networks/supported-networks.md +53 -0
- package/versioned_docs/version-v3.x/technical-references/_category_.json +4 -0
- package/versioned_docs/version-v3.x/technical-references/coordinator-service/_category_.json +8 -0
- package/versioned_docs/version-v3.x/technical-references/coordinator-service/index.md +10 -0
- package/versioned_docs/version-v3.x/technical-references/coordinator-service/installation.md +43 -0
- package/versioned_docs/version-v3.x/technical-references/offchain-relayer/_category_.json +8 -0
- package/versioned_docs/version-v3.x/technical-references/offchain-relayer/index.md +51 -0
- package/versioned_docs/version-v3.x/technical-references/offchain-relayer/installation.md +109 -0
- package/versioned_docs/version-v3.x/technical-references/smart-contracts/MACI.md +160 -0
- package/versioned_docs/version-v3.x/technical-references/smart-contracts/MessageProcessor.md +13 -0
- package/versioned_docs/version-v3.x/technical-references/smart-contracts/Params.md +33 -0
- package/versioned_docs/version-v3.x/technical-references/smart-contracts/Policies.md +39 -0
- package/versioned_docs/version-v3.x/technical-references/smart-contracts/Poll.md +170 -0
- package/versioned_docs/version-v3.x/technical-references/smart-contracts/PollFactory.md +33 -0
- package/versioned_docs/version-v3.x/technical-references/smart-contracts/Tally.md +43 -0
- package/versioned_docs/version-v3.x/technical-references/smart-contracts/VkRegistry.md +62 -0
- package/versioned_docs/version-v3.x/technical-references/smart-contracts/VoiceCreditProxy.md +18 -0
- package/versioned_docs/version-v3.x/technical-references/smart-contracts/_category_.json +8 -0
- package/versioned_docs/version-v3.x/technical-references/technical-references.md +48 -0
- package/versioned_docs/version-v3.x/technical-references/zk-snark-circuits/_category_.json +4 -0
- package/versioned_docs/version-v3.x/technical-references/zk-snark-circuits/joinPoll.md +52 -0
- package/versioned_docs/version-v3.x/technical-references/zk-snark-circuits/processMessages.md +106 -0
- package/versioned_docs/version-v3.x/technical-references/zk-snark-circuits/setup.md +96 -0
- package/versioned_docs/version-v3.x/technical-references/zk-snark-circuits/tallyVotes.md +79 -0
- package/versioned_docs/version-v3.x/technical-references/zk-snark-circuits/utilities.md +131 -0
- package/versioned_docs/version-v3.x/technical-references/zk-snark-circuits/zk-snark-circuits.md +42 -0
- package/versioned_docs/version-v3.x/use-cases/_category_.json +4 -0
- package/versioned_docs/version-v3.x/use-cases/governance.md +18 -0
- package/versioned_docs/version-v3.x/use-cases/polling.md +10 -0
- package/versioned_docs/version-v3.x/use-cases/public-goods.md +65 -0
- package/versioned_sidebars/version-v0.x-sidebars.json +8 -0
- package/versioned_sidebars/version-v1.2-sidebars.json +8 -0
- package/versioned_sidebars/version-v2.x-sidebars.json +8 -0
- package/versioned_sidebars/version-v3.x-sidebars.json +8 -0
- package/versions.json +1 -0
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Supported Networks
|
|
3
|
+
description: Supported Networks
|
|
4
|
+
sidebar_label: Supported Networks
|
|
5
|
+
sidebar_position: 1
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
MACI has been tested on the following EVM networks:
|
|
9
|
+
|
|
10
|
+
- Optimism
|
|
11
|
+
- Optimism Sepolia
|
|
12
|
+
- Arbitrum
|
|
13
|
+
- Arbitrum Sepolia
|
|
14
|
+
- Base
|
|
15
|
+
- Base Sepolia
|
|
16
|
+
- Gnosis
|
|
17
|
+
- Gnosis Chiado
|
|
18
|
+
- Polygon
|
|
19
|
+
- Polygon Amoy
|
|
20
|
+
|
|
21
|
+
We recommend using either Optimism, Arbitrum or Base. Please open an issue/PR if you intend to use other EVM networks and would like to contribute to this record of deployed and verified contracts as well as benchmarks, that would be greatly appreciated.
|
|
22
|
+
|
|
23
|
+
## Limitations
|
|
24
|
+
|
|
25
|
+
For better UX, MACI clients should be sending votes (messages) in batches. Depending on the number of vote options available, larger batch might be sent. Below you can find the largest batch you can send for each network and how much gas it consumes:
|
|
26
|
+
|
|
27
|
+
| Network | Max Batch Size | Gas used | Price (based on Ether price at the time ~$2595) |
|
|
28
|
+
| ---------------- | -------------- | -------- | ----------------------------------------------- |
|
|
29
|
+
| Optimism | 89 | 28167603 | 0.000036061732019822 ETH ($0.09) |
|
|
30
|
+
| Optimism Sepolia | 89 | 28163331 | 0.005651520470449442 ETH ($10.46) |
|
|
31
|
+
| Arbitrum | 98 | 31017545 | 0.00031017545 ETH ($0.80) |
|
|
32
|
+
| Arbitrum Sepolia | 98 | 31115404 | 0.0031115404 ETH ($8.06) |
|
|
33
|
+
| Base | 89 | 28165467 | 0.000591851649982612 ETH ($1.54) |
|
|
34
|
+
| Base Sepolia | 89 | 28190232 | 0.002072926785842714 ETH ($5.18) |
|
|
35
|
+
| Gnosis | 50 | 15921153 | 0.0000124615 ETH ($0.03) |
|
|
36
|
+
| Gnosis Chiado | 50 | 15921753 | 0.0000188313 ETH ($0.05) |
|
|
37
|
+
| Polygon | 85 | 26915773 | 0.0002193417259598 ETH ($0.54) |
|
|
38
|
+
| Polygon Amoy | 89 | 28192368 | 0.00017069180975304 ETH ($0.43) |
|
|
39
|
+
|
|
40
|
+
## Test yourself
|
|
41
|
+
|
|
42
|
+
To test MACI on a network, whether it's one of the ones listed above, or a new one, you can use the `benchmark` hardhat task:
|
|
43
|
+
|
|
44
|
+
1. Ensure you have copied `.env.example` to `.env` and set the correct values for the network you want to test on.
|
|
45
|
+
2. Configure your `deploy-config.json` - ensure `messageTreeDepth` is set to at least 3 (supporting 5 \*\* 3 votes)
|
|
46
|
+
3. Ensure you have copied the `default-deployed-contracts.json` to `deployed-contracts.json` to avoid deploying unnecessary contracts again.
|
|
47
|
+
4. Run the `benchmark` task: `pnpm benchmark:$NETWORK`
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: AccQueue Smart Contract
|
|
3
|
+
description: AccQueue smart contract
|
|
4
|
+
sidebar_label: AccQueue
|
|
5
|
+
sidebar_position: 1
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
:::info
|
|
9
|
+
Code location: [AccQueue.sol](https://github.com/privacy-scaling-explorations/maci/blob/dev/contracts/contracts/trees/AccQueue.sol)
|
|
10
|
+
:::
|
|
11
|
+
|
|
12
|
+
The AccQueue contract represents a Merkle Tree where each leaf insertion only updates a subtree. To obtain the main tree root, the subtrees must be merged together by the contract owner. This requires at least two operations, a `mergeSubRoots` and a `merge`.
|
|
13
|
+
|
|
14
|
+
The contract can be initialized to work as a traditional Merkle Tree (2 leaves per node) or a Quinary Tree (5 leaves per node). This can be achieved by passing either two or five as parameter to the constructor (`_hashLength`). Any other values should not be accepted.
|
|
15
|
+
|
|
16
|
+
Below are presented the most important functions of the smart contract:
|
|
17
|
+
|
|
18
|
+
- `enqueue` - Allows to add a leaf to the queue for the current subtree. Only one parameter is accepted and that is the leaf to insert.
|
|
19
|
+
- `insertSubTree` - Admin only function which allows to insert a full subtree (batch enqueue)
|
|
20
|
+
- `mergeSubRoots` - Allows the contract owner to merge all of the subtrees to form the shortest possible tree. The argument `_numSrQueueOps` can be used to perform the operation in multiple transactions (as this might trigger the block gas limit).
|
|
21
|
+
- `merge` - Allows the contract admin to form a main tree with the desired depth. The depth must fit all of the leaves.
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Gatekeepers Smart Contract
|
|
3
|
+
description: Gatekeepers smart contract
|
|
4
|
+
sidebar_label: Gatekeepers
|
|
5
|
+
sidebar_position: 6
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
:::info
|
|
9
|
+
Code location: [Gatekeepers](https://github.com/privacy-scaling-explorations/maci/blob/v2.5.0/packages/contracts/contracts/gatekeepers)
|
|
10
|
+
:::
|
|
11
|
+
|
|
12
|
+
MACI is composed of multiple smart contracts, which together with the zk-SNARK circuits, can be used to carry out on-chain voting. Start with an [overview of our smart contracts here](/docs/technical-references/smart-contracts/MACI).
|
|
13
|
+
|
|
14
|
+
MACI uses a "gatekeeper" contract, which is used to configure and enforce the eligibility criteria of voters who can participate in MACI polls. In other words, it is a way to whitelist signups to the system. Operators of MACI can use the gatekeeper contract to configure signup eligibility and to protect against sybil attacks in their polls.
|
|
15
|
+
|
|
16
|
+
The MACI repository comes with several out-of-the-box options:
|
|
17
|
+
|
|
18
|
+
- `FreeForAllGatekeeper` - This allows anyone to signup on MACI.
|
|
19
|
+
- `SignUpTokenGatekeeper` - This restricts signups only to holders of a specific ERC721 token.
|
|
20
|
+
- `EASGatekeeper` - This restricts signups only to users who have received an attestation of a specific schema from a trusted attester.
|
|
21
|
+
- `HatsGatekeeper` - This allows gatekeeping signups to only users who have a specific [Hat](https://www.hatsprotocol.xyz/).
|
|
22
|
+
- `GitcoinPassportGatekeeper` - This allows gatekeeping signups to only users who have a specific [Gitcoin Passport](https://passport.gitcoin.co/) score.
|
|
23
|
+
- `ZupassGatekeeper` - This allows gatekeeping signups only to users who have a valid [Zupass PCD ticket](https://github.com/proofcarryingdata/zupass).
|
|
24
|
+
- `SemaphoreGatekeeper` - This allows gatekeeping signups only to users who can prove they are part of a [Semaphore](https://semaphore.pse.dev/) group.
|
|
25
|
+
|
|
26
|
+
You can find all of our latest gatekeeper contracts here:
|
|
27
|
+
https://github.com/privacy-scaling-explorations/maci/blob/v2.5.0/packages/contracts/contracts/gatekeepers
|
|
28
|
+
|
|
29
|
+
Developers are also welcome to implement a custom gatekeeper contract as long as it conforms to the `SignUpGatekeeper` - an abstract contract to inherit from with two function signatures:
|
|
30
|
+
|
|
31
|
+
```ts
|
|
32
|
+
abstract contract SignUpGatekeeper {
|
|
33
|
+
function setMaciInstance(MACI _maci) public virtual {}
|
|
34
|
+
function register(address _user, bytes memory _data) public virtual {}
|
|
35
|
+
}
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Whenever a user signs up (via the `MACI.signUp` function), this triggers the MACI contract to call the `SignUpGatekeeper.register` function. Please note that this function should throw if the user is not eligible to sign up, rather than returning true or false.
|
|
39
|
+
|
|
40
|
+
If you'd like to create a gatekeeper contract for your project, or if there's specific gatekeeper functionality you'd like to see MACI support, we'd be happy to help! Please [create a GitHub issue](https://github.com/privacy-scaling-explorations/maci/issues/new/choose).
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: MACI Smart Contract
|
|
3
|
+
description: MACI main smart contract
|
|
4
|
+
sidebar_label: MACI
|
|
5
|
+
sidebar_position: 1
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
:::info
|
|
9
|
+
Code location: [MACI.sol](https://github.com/privacy-scaling-explorations/maci/blob/dev/contracts/contracts/MACI.sol)
|
|
10
|
+
:::
|
|
11
|
+
|
|
12
|
+
`MACI.sol` is the core contract of the project, as it provides the base layer for user signups and Polls to be created.
|
|
13
|
+
|
|
14
|
+
The constructor shown below accepts several arguments:
|
|
15
|
+
|
|
16
|
+
- `PollFactory` address
|
|
17
|
+
- `MessageProcessorFactory` address
|
|
18
|
+
- `TallyFactory` address
|
|
19
|
+
- `SignUpGatekeeper` address
|
|
20
|
+
- `InitialVoiceCreditProxy` address
|
|
21
|
+
- The depth of the state tree
|
|
22
|
+
|
|
23
|
+
```javascript
|
|
24
|
+
constructor(
|
|
25
|
+
IPollFactory _pollFactory,
|
|
26
|
+
IMessageProcessorFactory _messageProcessorFactory,
|
|
27
|
+
ITallyFactory _tallyFactory,
|
|
28
|
+
SignUpGatekeeper _signUpGatekeeper,
|
|
29
|
+
InitialVoiceCreditProxy _initialVoiceCreditProxy,
|
|
30
|
+
uint8 _stateTreeDepth
|
|
31
|
+
) payable {
|
|
32
|
+
// initialize and insert the blank leaf
|
|
33
|
+
InternalLazyIMT._init(lazyIMTData, _stateTreeDepth);
|
|
34
|
+
InternalLazyIMT._insert(lazyIMTData, BLANK_STATE_LEAF_HASH);
|
|
35
|
+
|
|
36
|
+
pollFactory = _pollFactory;
|
|
37
|
+
messageProcessorFactory = _messageProcessorFactory;
|
|
38
|
+
tallyFactory = _tallyFactory;
|
|
39
|
+
signUpGatekeeper = _signUpGatekeeper;
|
|
40
|
+
initialVoiceCreditProxy = _initialVoiceCreditProxy;
|
|
41
|
+
stateTreeDepth = _stateTreeDepth;
|
|
42
|
+
|
|
43
|
+
// Verify linked poseidon libraries
|
|
44
|
+
if (hash2([uint256(1), uint256(1)]) == 0) revert PoseidonHashLibrariesNotLinked();
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Upon deployment, the contract will initialize the state tree, and insert the blank leaf hash.
|
|
50
|
+
|
|
51
|
+
After this, all of the parameters will be stored to state, and then the contract will perform a simple sanity check to ensure that the Poseidon hash libraries were linked successfully.
|
|
52
|
+
|
|
53
|
+
## SignUp
|
|
54
|
+
|
|
55
|
+
Next, we have the `signUp` function, which allows users to `signUp`, as long as they pass the conditions set in the `SignUpGatekeeper` contract. This contract can use any mean necessary to gatekeep access to MACI's polls. For instance, only wallets with a specific ERC721 token can be allowed to sign up.
|
|
56
|
+
|
|
57
|
+
This function does the following:
|
|
58
|
+
|
|
59
|
+
- checks that the maximum number of signups has not been reached. Given a tree depth of 10, this will be $2 ** 10 - 1$.
|
|
60
|
+
- checks that the provided public key is a valid baby-jubjub point
|
|
61
|
+
- registers the user using the sign up gatekeeper contract. It is important that whichever gatekeeper is used, this reverts if a user tries to sign up twice or the conditions are not met (i.e returning false is not enough)
|
|
62
|
+
- calls the voice credit proxy to retrieve the number of allocated voice credits allocated to this voter
|
|
63
|
+
- hashes the voice credits alongside the user's MACI public key and the current time
|
|
64
|
+
- insert this hashed data into the state tree.
|
|
65
|
+
|
|
66
|
+
```javascript
|
|
67
|
+
function signUp(
|
|
68
|
+
PubKey memory _pubKey,
|
|
69
|
+
bytes memory _signUpGatekeeperData,
|
|
70
|
+
bytes memory _initialVoiceCreditProxyData
|
|
71
|
+
) public virtual {
|
|
72
|
+
// ensure we do not have more signups than what the circuits support
|
|
73
|
+
if (lazyIMTData.numberOfLeaves >= maxSignups) revert TooManySignups();
|
|
74
|
+
|
|
75
|
+
// ensure that the public key is on the baby jubjub curve
|
|
76
|
+
if (!CurveBabyJubJub.isOnCurve(_pubKey.x, _pubKey.y)) {
|
|
77
|
+
revert InvalidPubKey();
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// Register the user via the sign-up gatekeeper. This function should
|
|
81
|
+
// throw if the user has already registered or if ineligible to do so.
|
|
82
|
+
signUpGatekeeper.register(msg.sender, _signUpGatekeeperData);
|
|
83
|
+
|
|
84
|
+
// Get the user's voice credit balance.
|
|
85
|
+
uint256 voiceCreditBalance = initialVoiceCreditProxy.getVoiceCredits(msg.sender, _initialVoiceCreditProxyData);
|
|
86
|
+
|
|
87
|
+
uint256 timestamp = block.timestamp;
|
|
88
|
+
|
|
89
|
+
// Create a state leaf and insert it into the tree.
|
|
90
|
+
uint256 stateLeaf = hashStateLeaf(StateLeaf(_pubKey, voiceCreditBalance, timestamp));
|
|
91
|
+
InternalLazyIMT._insert(lazyIMTData, stateLeaf);
|
|
92
|
+
|
|
93
|
+
emit SignUp(lazyIMTData.numberOfLeaves - 1, _pubKey.x, _pubKey.y, voiceCreditBalance, timestamp);
|
|
94
|
+
}
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## DeployPoll
|
|
98
|
+
|
|
99
|
+
Once everything has been setup, polls can be deployed using the `deployPoll` function. Polls can be deployed concurrently, as each deployment has its own separate set of contracts and state.
|
|
100
|
+
|
|
101
|
+
```javascript
|
|
102
|
+
function deployPoll(
|
|
103
|
+
uint256 _duration,
|
|
104
|
+
TreeDepths memory _treeDepths,
|
|
105
|
+
PubKey memory _coordinatorPubKey,
|
|
106
|
+
address _verifier,
|
|
107
|
+
address _vkRegistry,
|
|
108
|
+
Mode _mode
|
|
109
|
+
) public virtual returns (PollContracts memory pollAddr) {
|
|
110
|
+
// cache the poll to a local variable so we can increment it
|
|
111
|
+
uint256 pollId = nextPollId;
|
|
112
|
+
|
|
113
|
+
// Increment the poll ID for the next poll
|
|
114
|
+
// 2 ** 256 polls available
|
|
115
|
+
unchecked {
|
|
116
|
+
nextPollId++;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
// check coordinator key is a valid point on the curve
|
|
120
|
+
if (!CurveBabyJubJub.isOnCurve(_coordinatorPubKey.x, _coordinatorPubKey.y)) {
|
|
121
|
+
revert InvalidPubKey();
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
// the owner of the message processor and tally contract will be the msg.sender
|
|
125
|
+
address _msgSender = msg.sender;
|
|
126
|
+
|
|
127
|
+
address p = pollFactory.deploy(_duration, _treeDepths, _coordinatorPubKey, address(this));
|
|
128
|
+
|
|
129
|
+
address mp = messageProcessorFactory.deploy(_verifier, _vkRegistry, p, _msgSender, _mode);
|
|
130
|
+
address tally = tallyFactory.deploy(_verifier, _vkRegistry, p, mp, _msgSender, _mode);
|
|
131
|
+
|
|
132
|
+
polls[pollId] = p;
|
|
133
|
+
|
|
134
|
+
// store the addresses in a struct so they can be returned
|
|
135
|
+
pollAddr = PollContracts({ poll: p, messageProcessor: mp, tally: tally });
|
|
136
|
+
|
|
137
|
+
emit DeployPoll(pollId, _coordinatorPubKey.x, _coordinatorPubKey.y, pollAddr);
|
|
138
|
+
}
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
Polls require the following information:
|
|
142
|
+
|
|
143
|
+
- `duration`: the duration of the poll
|
|
144
|
+
- `treeDepths`: the depth of the state tree, message tree, and vote option tree
|
|
145
|
+
- `coordinatorPubKey`: the public key of the poll's coordinator
|
|
146
|
+
- `verifier`: the address of the zk-SNARK verifier contract
|
|
147
|
+
- `vkRegistry`: the address of the vk registry contract
|
|
148
|
+
- `mode`: the mode of the poll, to set whether it supports quadratic voting or non quadratic voting
|
|
149
|
+
|
|
150
|
+
:::info
|
|
151
|
+
Please be advised that the number of signups in the MACI contract (number of leaves in the merkle tree holding MACI's state) considers the initial zero leaf as one signup. For this reason, when accounting for the real users signed up to MACI, you should subtract one from the value returned from the `numSignUps` function.
|
|
152
|
+
:::
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: MessageProcessor Smart Contract
|
|
3
|
+
description: MessageProcessor smart contract
|
|
4
|
+
sidebar_label: MessageProcessor
|
|
5
|
+
sidebar_position: 4
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
:::info
|
|
9
|
+
Code location: [MessageProcessor.sol](https://github.com/privacy-scaling-explorations/maci/blob/dev/contracts/contracts/MessageProcessor.sol)
|
|
10
|
+
:::
|
|
11
|
+
|
|
12
|
+
This contract is used to prepare parameters for the zk-SNARK circuits as well as for verifying proofs. It should be deployed alongside a `Poll` and ownership assigned to the coordinator.
|
|
13
|
+
It will process messages in batches, and after all batches have been processed, the `sbCommitment` can then be used for the `Tally` contract verification steps.
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Params Smart Contract
|
|
3
|
+
description: Params smart contract
|
|
4
|
+
sidebar_label: Params
|
|
5
|
+
sidebar_position: 9
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
:::info
|
|
9
|
+
Code location: [Params.sol](https://github.com/privacy-scaling-explorations/maci/blob/dev/contracts/contracts/utils/Params.sol)
|
|
10
|
+
:::
|
|
11
|
+
|
|
12
|
+
A contract holding three structs:
|
|
13
|
+
|
|
14
|
+
```c
|
|
15
|
+
/// @notice A struct holding the depths of the merkle trees
|
|
16
|
+
struct TreeDepths {
|
|
17
|
+
uint8 intStateTreeDepth;
|
|
18
|
+
uint8 messageTreeSubDepth;
|
|
19
|
+
uint8 messageTreeDepth;
|
|
20
|
+
uint8 voteOptionTreeDepth;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/// @notice A struct holding the external contracts
|
|
24
|
+
/// that are to be passed to a Poll contract on
|
|
25
|
+
/// deployment
|
|
26
|
+
struct ExtContracts {
|
|
27
|
+
IMACI maci;
|
|
28
|
+
AccQueue messageAq;
|
|
29
|
+
}
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Struct parameters are used to avoid stack too deep errors in the other contracts.
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Poll Smart Contract
|
|
3
|
+
description: MACI Poll Contract
|
|
4
|
+
sidebar_label: Poll
|
|
5
|
+
sidebar_position: 2
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
:::info
|
|
9
|
+
Code location: [Poll.sol](https://github.com/privacy-scaling-explorations/maci/blob/dev/contracts/contracts/Poll.sol)
|
|
10
|
+
:::
|
|
11
|
+
|
|
12
|
+
This contract allows users to submit their votes.
|
|
13
|
+
|
|
14
|
+
The main functions of the contract are as follows:
|
|
15
|
+
|
|
16
|
+
- `publishMessage` - This function allows anyone to publish a message, and it accepts the message object as well as an ephemeral public key. This key together with the coordinator public key will be used to generate a shared ECDH key that will encrypt the message.
|
|
17
|
+
Before saving the message, the function will check that the voting deadline has not passed, as well as the max number of messages was not reached.
|
|
18
|
+
- `publisMessageBatch` - This function allows to submit a batch of messages, and it accepts an array of messages with their corresponding public keys used in the encryption step. It will call the `publishMessage` function for each message in the array.
|
|
19
|
+
|
|
20
|
+
## PublishMessage
|
|
21
|
+
|
|
22
|
+
The `publishMessage` function looks as follows:
|
|
23
|
+
|
|
24
|
+
```js
|
|
25
|
+
function publishMessage(Message memory _message, PubKey calldata _encPubKey) public virtual isWithinVotingDeadline {
|
|
26
|
+
// we check that we do not exceed the max number of messages
|
|
27
|
+
if (numMessages >= maxMessages) revert TooManyMessages();
|
|
28
|
+
|
|
29
|
+
// check if the public key is on the curve
|
|
30
|
+
if (!CurveBabyJubJub.isOnCurve(_encPubKey.x, _encPubKey.y)) {
|
|
31
|
+
revert InvalidPubKey();
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// cannot realistically overflow
|
|
35
|
+
unchecked {
|
|
36
|
+
numMessages++;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
uint256 messageLeaf = hashMessageAndEncPubKey(_message, _encPubKey);
|
|
40
|
+
extContracts.messageAq.enqueue(messageLeaf);
|
|
41
|
+
|
|
42
|
+
emit PublishMessage(_message, _encPubKey);
|
|
43
|
+
}
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## MergeMaciState
|
|
47
|
+
|
|
48
|
+
After a Poll's voting period ends, the coordinator's job is to store the main state root, as well as some more information on the Poll contract using `mergeMaciState`:
|
|
49
|
+
|
|
50
|
+
```js
|
|
51
|
+
function mergeMaciState() public isAfterVotingDeadline {
|
|
52
|
+
// This function can only be called once per Poll after the voting
|
|
53
|
+
// deadline
|
|
54
|
+
if (stateMerged) revert StateAlreadyMerged();
|
|
55
|
+
|
|
56
|
+
// set merged to true so it cannot be called again
|
|
57
|
+
stateMerged = true;
|
|
58
|
+
|
|
59
|
+
mergedStateRoot = extContracts.maci.getStateTreeRoot();
|
|
60
|
+
|
|
61
|
+
// Set currentSbCommitment
|
|
62
|
+
uint256[3] memory sb;
|
|
63
|
+
sb[0] = mergedStateRoot;
|
|
64
|
+
sb[1] = emptyBallotRoots[treeDepths.voteOptionTreeDepth - 1];
|
|
65
|
+
sb[2] = uint256(0);
|
|
66
|
+
|
|
67
|
+
currentSbCommitment = hash3(sb);
|
|
68
|
+
|
|
69
|
+
// get number of signups and cache in a var for later use
|
|
70
|
+
uint256 _numSignups = extContracts.maci.numSignUps();
|
|
71
|
+
numSignups = _numSignups;
|
|
72
|
+
|
|
73
|
+
// dynamically determine the actual depth of the state tree
|
|
74
|
+
uint8 depth = 1;
|
|
75
|
+
while (uint40(1 << depth) < numberOfLeaves) {
|
|
76
|
+
depth++;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
actualStateTreeDepth = depth;
|
|
80
|
+
|
|
81
|
+
emit MergeMaciState(mergedStateRoot, numSignups);
|
|
82
|
+
}
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
The function will store the state root from the MACI contract, create a commitment by hashing this merkle root, an empty ballot root stored in the `emptyBallotRoots` mapping, and a zero as salt. The commitment will be stored in the `currentSbCommitment` variable. Finally, it will store the total number of signups, and calculate the actual depth of the state tree. This information will be used when processing messages and tally to ensure proof validity.
|
|
86
|
+
|
|
87
|
+
The `emptyBallotRoots` mapping is used to store the empty ballot roots for each vote option tree depth. For instance, if the vote option tree depth is 5, a build script will generate the following values (this assumes that the state tree depth is 10):
|
|
88
|
+
|
|
89
|
+
```javascript
|
|
90
|
+
emptyBallotRoots[0] = uint256(16015576667038038422103932363190100635991292382181099511410843174865570503661);
|
|
91
|
+
emptyBallotRoots[1] = uint256(166510078825589460025300915201657086611944528317298994959376081297530246971);
|
|
92
|
+
emptyBallotRoots[2] = uint256(10057734083972610459557695472359628128485394923403014377687504571662791937025);
|
|
93
|
+
emptyBallotRoots[3] = uint256(4904828619307091008204672239231377290495002626534171783829482835985709082773);
|
|
94
|
+
emptyBallotRoots[4] = uint256(18694062287284245784028624966421731916526814537891066525886866373016385890569);
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
At the same time, the coordinator can merge the message accumulator queue and generate its merkle root. This is achieved by calling the following functions:
|
|
98
|
+
|
|
99
|
+
- `mergeMessageAqSubRoots` - merges the Poll's messages tree subroot
|
|
100
|
+
- `mergeMessageAq` - merges the Poll's messages tree
|
|
101
|
+
|
|
102
|
+
:::info
|
|
103
|
+
Please be advised that the number of signups in this case includes the zero leaf. For this reason, when accounting for the real users signed up to the Poll, you should subtract one from the value stored in the Poll contract.
|
|
104
|
+
:::
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Poll Factory Smart Contract
|
|
3
|
+
description: Poll Factory smart contract
|
|
4
|
+
sidebar_label: PollFactory
|
|
5
|
+
sidebar_position: 3
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
:::info
|
|
9
|
+
Code location: [PollFactory.sol](https://github.com/privacy-scaling-explorations/maci/blob/dev/contracts/contracts/PollFactory.sol)
|
|
10
|
+
:::
|
|
11
|
+
|
|
12
|
+
`PollFactory` is a smart contract that is used to deploy new Polls. This is used by MACI inside the `deployPoll` function.
|
|
13
|
+
|
|
14
|
+
```ts
|
|
15
|
+
function deploy(
|
|
16
|
+
_duration,
|
|
17
|
+
TreeDepths calldata _treeDepths,
|
|
18
|
+
PubKey calldata _coordinatorPubKey,
|
|
19
|
+
address _maci
|
|
20
|
+
) public virtual returns (address pollAddr) {
|
|
21
|
+
/// @notice deploy a new AccQueue contract to store messages
|
|
22
|
+
AccQueue messageAq = new AccQueueQuinaryMaci(_treeDepths.messageTreeSubDepth);
|
|
23
|
+
|
|
24
|
+
/// @notice the smart contracts that a Poll would interact with
|
|
25
|
+
ExtContracts memory extContracts = ExtContracts({ maci: IMACI(_maci), messageAq: messageAq });
|
|
26
|
+
|
|
27
|
+
// deploy the poll
|
|
28
|
+
Poll poll = new Poll(_duration, _treeDepths, _coordinatorPubKey, extContracts);
|
|
29
|
+
|
|
30
|
+
// Make the Poll contract own the messageAq contract, so only it can
|
|
31
|
+
// run enqueue/merge
|
|
32
|
+
messageAq.transferOwnership(address(poll));
|
|
33
|
+
|
|
34
|
+
// init Poll
|
|
35
|
+
poll.init();
|
|
36
|
+
|
|
37
|
+
pollAddr = address(poll);
|
|
38
|
+
}
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Upon deployment, the following will happen:
|
|
42
|
+
|
|
43
|
+
- ownership of the `messageAq` contract is transferred to the deployed poll contract
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Tally Smart Contract
|
|
3
|
+
description: Tally smart contract
|
|
4
|
+
sidebar_label: Tally
|
|
5
|
+
sidebar_position: 5
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
:::info
|
|
9
|
+
Code location: [Tally.sol](https://github.com/privacy-scaling-explorations/maci/blob/dev/contracts/contracts/Tally.sol)
|
|
10
|
+
:::
|
|
11
|
+
|
|
12
|
+
The `Tally` contract is used by the coordinator to submit commitments to the tally results via the `tallyVotes` function. This is done in batches and the final commitment can be used by the users to verify the validity of the results.
|
|
13
|
+
|
|
14
|
+
This contract should be deployed alongside a `Poll` and ownership assigned to the coordinator.
|
|
15
|
+
|
|
16
|
+
The constructor accepts the following parameters:
|
|
17
|
+
|
|
18
|
+
```ts
|
|
19
|
+
constructor(
|
|
20
|
+
address _verifier,
|
|
21
|
+
address _vkRegistry,
|
|
22
|
+
address _poll,
|
|
23
|
+
address _mp,
|
|
24
|
+
address _tallyOwner,
|
|
25
|
+
Mode _mode
|
|
26
|
+
) payable Ownable(_tallyOwner) {
|
|
27
|
+
verifier = IVerifier(_verifier);
|
|
28
|
+
vkRegistry = IVkRegistry(_vkRegistry);
|
|
29
|
+
poll = IPoll(_poll);
|
|
30
|
+
messageProcessor = IMessageProcessor(_mp);
|
|
31
|
+
mode = _mode;
|
|
32
|
+
}
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
- `verifier` - The address of the verifier contract
|
|
36
|
+
- `vkRegistry` - The address of the vkRegistry contract
|
|
37
|
+
- `poll` - The address of the poll contract
|
|
38
|
+
- `messageProcessor` - The address of the messageProcessor contract
|
|
39
|
+
- `mode` - The mode of the tally contract - depending on this, the commitments will be processed differently, and it must equal the Poll mode (quadratic vs non quadratic voting)
|
|
40
|
+
|
|
41
|
+
Users can use the verification functions to verify the Tally results. These are as follows:
|
|
42
|
+
|
|
43
|
+
- `verifySpentVoiceCredits` - Verifies the spent voice credits
|
|
44
|
+
- `verifyPerVOSpentVoiceCredits` - Verifies the spent voice credits per vote option
|
|
45
|
+
- `verifyTallyResult` - Verifies the tally result
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: VkRegistry Smart Contract
|
|
3
|
+
description: VkRegistry smart contract
|
|
4
|
+
sidebar_label: VkRegistry
|
|
5
|
+
sidebar_position: 8
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
:::info
|
|
9
|
+
Code location: [VkRegistry.sol](https://github.com/privacy-scaling-explorations/maci/blob/dev/contracts/contracts/VkRegistry.sol)
|
|
10
|
+
:::
|
|
11
|
+
|
|
12
|
+
The VkRegistry is a contract that holds the verifying keys for the zk-SNARK circuits. It holds two different sets of keys:
|
|
13
|
+
|
|
14
|
+
- `processVks` - The keys for the processMessages circuit
|
|
15
|
+
- `tallyVks` - The keys for the tallyVotes circuit
|
|
16
|
+
|
|
17
|
+
Each circuit will have a signature which is its compile-time constants represented as a uint256.
|
|
18
|
+
|
|
19
|
+
Please note that each Verifying Key should be set with the corresponding mode. Available modes are quadratic voting and non quadratic voting.
|
|
20
|
+
|
|
21
|
+
The contract owner can set them using the `setVerifyingKeysBatch` function:
|
|
22
|
+
|
|
23
|
+
```ts
|
|
24
|
+
function setVerifyingKeysBatch(
|
|
25
|
+
uint256 _stateTreeDepth,
|
|
26
|
+
uint256 _intStateTreeDepth,
|
|
27
|
+
uint256 _messageTreeDepth,
|
|
28
|
+
uint256 _voteOptionTreeDepth,
|
|
29
|
+
uint256 _messageBatchSize,
|
|
30
|
+
Mode[] calldata _modes,
|
|
31
|
+
VerifyingKey[] calldata _processVks,
|
|
32
|
+
VerifyingKey[] calldata _tallyVks
|
|
33
|
+
) public onlyOwner {
|
|
34
|
+
if (_modes.length != _processVks.length || _modes.length != _tallyVks.length) {
|
|
35
|
+
revert InvalidKeysParams();
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
uint256 length = _modes.length;
|
|
39
|
+
|
|
40
|
+
for (uint256 index = 0; index < length; ) {
|
|
41
|
+
setVerifyingKeys(
|
|
42
|
+
_stateTreeDepth,
|
|
43
|
+
_intStateTreeDepth,
|
|
44
|
+
_messageTreeDepth,
|
|
45
|
+
_voteOptionTreeDepth,
|
|
46
|
+
_messageBatchSize,
|
|
47
|
+
_modes[index],
|
|
48
|
+
_processVks[index],
|
|
49
|
+
_tallyVks[index]
|
|
50
|
+
);
|
|
51
|
+
|
|
52
|
+
unchecked {
|
|
53
|
+
index++;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
```
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Voice Credits Proxy Smart Contract
|
|
3
|
+
description: Voice Credits Proxy smart contract
|
|
4
|
+
sidebar_label: VoiceCreditsProxy
|
|
5
|
+
sidebar_position: 7
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
:::info
|
|
9
|
+
Code location: [InitialVoiceCreditProxy](https://github.com/privacy-scaling-explorations/maci/tree/dev/contracts/contracts/initialVoiceCreditProxy)
|
|
10
|
+
:::
|
|
11
|
+
|
|
12
|
+
The VoiceCreditProxy contract is used to assign voice credits to users. Whichever implementation should the MACI deployers use, this must implement a view function that returns the balance for a user, such as the one below:
|
|
13
|
+
|
|
14
|
+
```javascript
|
|
15
|
+
function getVoiceCredits(address _user, bytes memory _data) public virtual view returns (uint256) {}
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
The repository comes with a simple implementation called `ConstantInitialVoiceCreditProxy` which assigns a fixed amount of voice credits to each user.
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
{
|
|
2
|
+
"label": "Smart Contracts",
|
|
3
|
+
"position": 1,
|
|
4
|
+
"link": {
|
|
5
|
+
"type": "generated-index",
|
|
6
|
+
"description": "MACI is composed of multiple smart contracts, which together with the zk-SNARK circuits, can be used to carry out on-chain voting. The main contracts are presented and explained below. Please also find autogenerated solidity documentation with solidity-docs."
|
|
7
|
+
}
|
|
8
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: MACI Codebase
|
|
3
|
+
description: High-level overview of the MACI codebase
|
|
4
|
+
sidebar_label: Technical References
|
|
5
|
+
sidebar_position: 1
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# MACI Overview
|
|
9
|
+
|
|
10
|
+
The MACI codebase consists of three subsystems in different programming languages:
|
|
11
|
+
|
|
12
|
+
1. Solidity smart contracts
|
|
13
|
+
2. TypeScript libraries
|
|
14
|
+
3. Circom circuits
|
|
15
|
+
|
|
16
|
+
## Smart contracts
|
|
17
|
+
|
|
18
|
+
The MACI smart contracts handle the on-chain aspects - both the functionality and the storage - of the voting system. They provide the functionality to deploy polls, register voters, and accept votes. They also store and manage the on-chain data from transactions, such as the encrypted votes of a poll. Finally, they verify proofs of the zk-SNARK circuits, so that everyone can validate the voting results.
|
|
19
|
+
|
|
20
|
+
The MACI smart contracts are written in [Solidity](https://soliditylang.org/).
|
|
21
|
+
|
|
22
|
+
Contracts are released through the [`@maci-contracts`](https://www.npmjs.com/package/maci-contracts) NPM package.
|
|
23
|
+
|
|
24
|
+
[Learn more about MACI contracts](/docs/category/smart-contracts)
|
|
25
|
+
|
|
26
|
+
## TypeScript libraries
|
|
27
|
+
|
|
28
|
+
The TypeScript libraries manage the business logic between the smart contracts and the circuit code. They provide a variety of functionality, such as encryption tools, utilities, and a CLI for interacting with MACI (for actions like signing up, voting, tallying votes & generating proofs).
|
|
29
|
+
|
|
30
|
+
The MACI [TypeScript](https://www.typescriptlang.org/) libraries are released through the following NPM packages:
|
|
31
|
+
|
|
32
|
+
- [`@maci-cli`](https://www.npmjs.com/package/maci-cli)
|
|
33
|
+
- [`@maci-core`](https://www.npmjs.com/package/maci-core)
|
|
34
|
+
- [`@maci-crypto`](https://www.npmjs.com/package/maci-crypto)
|
|
35
|
+
- [`@maci-domainobjs`](https://www.npmjs.com/package/maci-domainobjs)
|
|
36
|
+
- [`@maci-integrationtests`](https://www.npmjs.com/package/maci-integrationtests)
|
|
37
|
+
|
|
38
|
+
## Circuits
|
|
39
|
+
|
|
40
|
+
MACI has multiple circuits that ensure all off-chain computation is completed correctly. The circuits are used to generate zero-knowledge proofs (zk-SNARKs) that the votes were counted correctly. Specifically, they enforce that message processing and vote tallying were correctly executed by the coordinator. The proofs can then be verified through a verifier smart contract on-chain.
|
|
41
|
+
|
|
42
|
+
The circuits for these zero-knowledge proofs are written
|
|
43
|
+
in [Circom](https://iden3.io/circom).
|
|
44
|
+
|
|
45
|
+
The MACI circuits are released through the [`@maci-circuits`](https://www.npmjs.com/package/maci-circuits) NPM package.
|
|
46
|
+
|
|
47
|
+
[Learn more about MACI circuits](/docs/technical-references/zk-snark-circuits/introduction)
|