Registry / devops / maci-cli

maci-cli

JSON →
library2.5.0jsnpmunverified

Command-line interface for Minimal Anti-Collusion Infrastructure (MACI), version 2.5.0. MACI is a set of smart contracts and zero-knowledge proofs for on-chain voting that prevents bribery and coercion. This CLI provides tools for deploying, managing, and interacting with MACI instances. It captures commands for coordinator operations, user key generation, and contract deployment. Released under the MACI project, updated infrequently with new protocol iterations.

npm install maci-cli
INSTALL
IMPORT
SIG · MACI-CLI
M
maci-cli
devopsjavascriptv2.5.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
import maciCLI from 'maci-cli'
import { maciCLI } from 'maci-cli'
Default export provides the CLI entry point.
CLI
import { CLI } from 'maci-cli'
const CLI = require('maci-cli').CLI
Named export 'CLI' is available for programmatic use.
Subcommands
import { deployVkRegistry, setVerifyingKeys, signup, publish, tallyVotes, processMessages } from 'maci-cli'
import * as maciCLI from 'maci-cli'
Individual named exports for each subcommand; available since v2.5.0. Using wildcard import may clash with other MACI packages.
CLI
const { CLI } = require('maci-cli')
const maciCLI = require('maci-cli')
CommonJS require works with named exports. Default export not applicable for CJS.

Shows how to use key CLI functions programmatically: generate keys, signup user, publish vote, process messages, and tally votes.

import { signup, publish, processMessages, tallyVotes } from 'maci-cli'; import { PrivKey, PubKey, Keypair } from 'maci-domainobjs'; async function main() { const keypair = new Keypair(); const privKey = keypair.privKey.serialize(); const pubKey = keypair.pubKey.serialize(); await signup({ pubKey, privateKey: privKey }); const vote = { voteOptionIndex: 1, voteWeight: 9 }; await publish({ privateKey: privKey, vote, stateIndex: 1 }); await processMessages(); const result = await tallyVotes(); console.log('Tally result:', result); } main().catch(console.error);
maci --version
Debug
Known issues
breakingMACI v2.0 uses a new key format. Old keys must be regenerated.
fix
Generate new keys using Keypair.generate() from maci-domainobjs.
affects: >=2.0
breakingMACI v2.0 requires a fresh smart contract deployment. Not backward-compatible with v1.x.
fix
Deploy new contracts using CLI or hardhat tasks.
affects: >=2.0
deprecatedThe old `create` subcommand is deprecated; use `signup` instead.
fix
Replace `create` with `signup`.
affects: >=2.0
gotchaAll private keys must be serialized as hex strings. Raw Buffer objects are not accepted.
fix
Use privKey.serialize() to get a hex string.
affects: >=2.5.0
gotchaState leaf hashes differ between MACI v2.0 and v2.5.0. Tally results will fail if mismatched.
fix
Ensure your contract artifacts and CLI versions match exactly.
affects: >=2.5.0
Errors
Common errors & fixes
Error: Invalid private key
Passing a Buffer object instead of a hex string.
fix
Convert using `SerializedPrivateKey = privKey.serialize()`.
TypeError: Cannot read properties of undefined (reading 'serialize')
Attempting to serialize an already serialized key.
fix
Only call serialize() on Keypair objects, not on hex strings.
Error: Contract not deployed
Using CLI without deploying MACI contracts first.
fix
Run `maci deploy` or use hardhat tasks to deploy.
Error: voting period not started
Calling publish or tallyVotes outside the voting window.
fix
Check contract timestamps or wait until the voting period is active.
Error: invalid proof
Using zk-SNARK artifacts that do not match the deployed circuit.
fix
Ensure the circuit files (e.g., processMessages) are correctly generated and placed in the expected path.
Upgrade
Version history
2.5.0latest on npm
Audit
Dependencies
maci-corerequiredCore MACI types and interfaces
maci-domainobjsrequiredDomain object classes for MACI
maci-cryptorequiredCryptographic utilities (BabyJubJub, Poseidon)
Agent activity
5 hits · last 30 days
node
4
OpenAI (training)
1
Resources
maci-cli — npm install maci-cli · libregistry