• Stars
    star
    512
  • Rank 86,323 (Top 2 %)
  • Language
    TypeScript
  • License
    Other
  • Created over 5 years ago
  • Updated about 2 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Minimal Anti-Collusion Infrastructure (MACI)

Minimal Anti-Collusion Infrastructure

CI License Telegram

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

Documentation for developers and integrators can be found here: https://privacy-scaling-explorations.github.io/maci/

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

Packages

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

Requirements

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/installGlibc.sh

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

git clone [email protected]:privacy-scaling-explorations/maci.git
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"
}

Testing

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
./scripts/runTestsInCi.sh

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

cd integrationTests
./scripts/runTestsInCi.sh

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.

Docker

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 https://github.com/privacy-scaling-explorations/maci/wiki/MACI-CI-pipeline.

More Repositories

1

zkevm-circuits

Rust
819
star
2

zkevm-specs

Python
332
star
3

zk-kit

A monorepo of reusable libraries for zero-knowledge technologies.
TypeScript
290
star
4

zkp-app-boilerplate

Build your zkp app with typescript, hardhat, circom, and snarkjs!
TypeScript
221
star
5

chiquito

DSL for Halo2 circuits
Rust
186
star
6

sonobe

Experimental folding schemes library
Rust
185
star
7

mpz

Multi-party computation libraries written in Rust πŸ¦€
Rust
182
star
8

halo2curves

Rust
170
star
9

snark-verifier

Rust
143
star
10

core-program

141
star
11

halo2wrong

Rust
116
star
12

zk-eigentrust

EigenTrust - A distributed reputation system
Rust
109
star
13

p0tion

The MPC suite of tools for conducting zkSNARK Phase 2 Trusted Setup ceremonies
TypeScript
88
star
14

zkevm-chain

zkevm-chain: Deprecated
Rust
87
star
15

multifolding-poc

A PoC repo for a HyperNova impl
Rust
83
star
16

acceleration-program

Accelerate Early Stage Programmable Cryptography Talents
64
star
17

halo2-solidity-verifier

A set of tooling related to halo2 circuits verification inside Solidity contracts
Rust
62
star
18

maze

Multi proof Aggregation for Zk SNARK on Ethereum
Rust
61
star
19

anon-aadhaar

Anon Aadhaar is a zero-knowledge protocol that allows Aadhaar ID owners to prove their identity in a privacy preserving way.
JavaScript
61
star
20

bandada

A system for managing privacy-preserving groups.
TypeScript
51
star
21

incrementalquintree

An incremental Merkle tree written in Typescript and circom
TypeScript
43
star
22

nova-bench

A collection of comparison-benchmarks for Nova & related Proving systems
Rust
42
star
23

greco

Rust
42
star
24

poseidon

Rust
38
star
25

zkvm-ideas

A collection of the Vietnam Spring ZK Residency effort of the ZKWasm team
37
star
26

multisetups

A simple, IPFS-based multi-party trusted setup utility for snarkjs
TypeScript
27
star
27

e2e-zk-ecdsa

End to End ZK ECDSA
TypeScript
25
star
28

nova-ml

Jupyter Notebook
23
star
29

zkevm-docs

AppliedZKP's zkEVM Documentation
Shell
23
star
30

DefinitelySetup

The repository for high quality Trusted setups for groth16 based SNARKS
TypeScript
21
star
31

nova-by-hand

A collection of the Notes on the Nova folding scheme explained from scratch
21
star
32

zkey-manager

TypeScript
18
star
33

rln

Shell
18
star
34

pse.dev

PSE website v2 with more user research and new branding!
TypeScript
17
star
35

UniRep

A private and non-repudiable reputation system
TypeScript
16
star
36

semaphore-phase2-setup

Phase 2 of a multi-party trusted setup ceremony for the Semaphore zk-SNARK circuit
Python
16
star
37

taz-apps

Simple DApp to allow Devcon attendees to review events anonymously.
JavaScript
13
star
38

zk-kit.circom

A monorepo of reusable Circom circuits.
Circom
13
star
39

circom-ecdsa-p256

Big integer arithmetic // secp256k1 & additional P256 ECC operations in circom
Circom
12
star
40

PSE-Lectures-Notes

A collection of the Notes by Matan from each of the PSE Lectures sessions that have happened so far.
12
star
41

pairing

Rust
11
star
42

website

Privacy and Scaling Explorations
TypeScript
11
star
43

researches

10
star
44

webauth-circom

Circom
10
star
45

security

A collection of resources relevant to the PSE Security Team.
10
star
46

qdh

The Quadratic Dollar Homepage is a spin on the Million Dollar Homepage. While it also features a space for images on a webpage, it allows users to vote on how much space each image takes up. Moreover, it employs a quadratic and collusion-resistant voting mechanism on Ethereum called Minimal Anti-Collusion Infrastructure (MACI) to prevent bribery and scale images quadratically.
JavaScript
10
star
47

maci-platform

MACI Platform - Voting and Funding using MACI
TypeScript
10
star
48

zk-kit.solidity

A monorepo of reusable contracts for zero-knowledge technologies.
Solidity
10
star
49

crypt-keeper-extension

Crypt-Keeper Extension, zero knowledge identity management and proof generation tool.
TypeScript
7
star
50

zk-kit.rust

A monorepo of reusable crates for zero-knowledge technologies.
Rust
6
star
51

zk-keeper

ZK Keeper
TypeScript
6
star
52

hacking-pse

PSE Hackathon
TypeScript
5
star
53

poseidon_in_circomlib_check

5
star
54

zkevm-testing-vectors

Go
5
star
55

sonobe-docs

Docs for https://github.com/privacy-scaling-explorations/sonobe
5
star
56

ideas

4
star
57

keccak_circuit

Rust
4
star
58

snark-artifacts

A streamlined mechanism for distributing SNARK artifacts.
TypeScript
4
star
59

mixer

TypeScript
4
star
60

zk-kit.noir

A monorepo of reusable Noir circuits.
Roff
4
star
61

sugesto

Sugesto is an internal application to allow PSE members to send anonymous feedback on team events and activities.
TypeScript
3
star
62

perpetualpowersoftau

Standard ML
3
star
63

github-ops

Shell
2
star
64

poseidon-gadget

Poseidon gadget for Halo2, previously at halo2_gadgets.
Rust
2
star
65

technical-reports

PSE Technical Reports
TeX
2
star
66

maci-coordinator

πŸ— coordinator = tallier + prover
Go
2
star
67

mpt-witness-generator

Go
2
star
68

zuzalu-feedback

An app to allow Zuzalu attendees to send anonymous feedback.
TypeScript
1
star
69

zkevm-chain-testing

Python
1
star
70

MACI-v2

MACI + Nova + ElGamal PoC
1
star
71

vFSM

An opinionated framework aimed at facilitating the zero knowledge verification of state transitions in Mealy machines with encrypted inputs.
1
star
72

maci-phase2-setup

TypeScript
1
star
73

qdh-admin

Admin panel for QDH. Based on Strapi
JavaScript
1
star
74

pse-gfis

A simple app to view good first issues from a set of repos/orgs
TypeScript
1
star
75

zkevm-params

Shell
1
star