Skip to content


Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

Minimal Anti-Collusion Infrastructure

CI License Telegram

Please refer to the original post for a high-level view.

Documentation for developers and integrators can be found here:

We welcome contributions to this project. Please join our Telegram group to discuss.


Below you can find a list of the packages included in this repository.

package npm tests
maci-circuits NPM Package Actions Status
maci-cli NPM Package Actions Status
maci-common NPM Package Actions Status
maci-contracts NPM Package Actions Status
maci-core NPM Package Actions Status
maci-crypto NPM Package Actions Status
maci-domainobjs NPM Package Actions Status
maci-integrationTests NPM Package Actions Status
maci-server NPM Package Actions Status

Local Development and testing


You should have Node 16 (or 14) installed. Use nvm to install it and manage versions.

You also need a Ubuntu/Debian Linux machine on an Intel CPU.

Get started

Install dependencies: sudo apt-get install build-essential libgmp-dev libssl-dev libsodium-dev git nlohmann-json3-dev nasm g++ libgcc-s1

If you are missing the correct version of glibc see circuits/scripts/

Clone this repository, install NodeJS dependencies, and build the source code:

git clone
cd maci
npm install
npm run bootstrap
npm run build

For development purposes, you can generate the proving and verifying keys for the zk-SNARK circuits, along with their Solidity verifier contracts as such.

Navigate to the rapidsnark repo to install the necessary tooling.

Build the zk-SNARKs and generate their proving and verifying keys:

cd circuits
npm run build-test-circuits

This can take around 10 to 15 minutes, depending on the specs of your machine. Once ready, the following will appear on screen: Launched JSON-RPC server at port 9001

Note that if you change the circuits and recompile them, you should also update and recompile the verifier contracts in contracts/contracts with their new versions, or the tests will fail:

cd contracts
npm run compileSol

Avoid using npx hardhat compile and instead use the provided command as artifacts are copied into their relevant directories.

Local development

This repository is organised as Lerna submodules. Each submodule contains its own unit tests.

  • audit: Documentation surrounding the audit performed on v1
  • crypto: low-level cryptographic operations.
  • circuits: zk-SNARK circuits.
  • contracts: Solidity contracts and deployment code.
  • domainobjs: Classes which represent high-level domain objects particular to this project.
  • core: Business logic functions for message processing, vote tallying, and circuit input generation through MaciState, a state machine abstraction.
  • cli: A command-line interface with which one can deploy and interact with an instance of MACI.
  • integrationTests: Integration tests which use the command-line interface to perform end-to-end tests.

Compiling Circom

Prior to using the generated zkey files for corresponding circuits, it is now required to compile circom locally. To get started the follow the instructions here and be sure that the installation directory matches the value in the circom field inside circuits/circomHelperConfig.json.

For example:

    "circom": "../$RELATIVE_PATH_TO_CIRCOM"


Unit tests

The following submodules contain unit tests: core, crypto, circuits, contracts, and domainobjs.

Except for the contracts submodule, run unit tests as such (the following example is for crypto):

cd crypto
npm run test

For contracts and integrationTests, run the tests one by one. This prevents incorrect nonce errors.

First, start a Hardhat instance in a separate terminal:

cd contracts
npm run hardhat

In another terminal you can run:

cd contracts
npm run test

Or run tests individual as such:

cd contracts
npm run test-accQueue
npx jest AccQueue

Where both test commands run AccQueue.test.ts

Alternatively you can run all unit tests as follows, but you should stop your Hardhat instance first as this will start its own instance before running the tests:

cd contracts

Or run all integration tests (this also starts its own Hardhat instance):

cd integrationTests

You can ignore the Hardhat errors which this script emits as you should already have Hardhat running in a separate terminal. Otherwise, you will have to exit Ganache using the kill command.


Run docker build -t maci . to build all stages.

To run a specific build step docker build --target circuits -t maci . Note: a cached version of builder job must be on your system prior as it relies on existing artifacts

CI pipeline

CI pipeline ensures that we have automated tests that constantly validate. For more information about pipeline workflows, see