Command-line interface
MACI provides a command-line interface that allows for effective deployment and testing. Applications that build on top of MACI, such as clr.fund, implement their own web UIs.
Note that all the example commands default to a local Ethereum testnet at
http://localhost:8545
, and use the Ethereum private key
0xc87509a1c067bbde78beb793e6fa76530b6382a4c0241e5e4a9ec0a0f44dc0d3
. Do not
send any real funds to the address generated by this key.
For testing purposes, you can run:
# in maci/contracts
pnpm run hardhat
Note that you will need a hardhat.config file in your current directory to be able to run the cli.
Subcommands
Command | Description | Options |
---|---|---|
create | Deploy the contracts | -i, --initialVoiceCredits <initialVoiceCredits> : The initial voice credits -p, --initialVoiceCreditsProxyAddress <initialVoiceCreditsProxyAddress> : The initial voice credits proxy contract address -g, --signupGatekeeperAddress <signupGatekeeperAddress> : The signup gatekeeper contract address -ph3, --poseidonT3Address <poseidonT3Address> : The PoseidonT3 contract address -ph4, --poseidonT4Address <poseidonT4Address> : The PoseidonT4 contract address -ph5, --poseidonT5Address <poseidonT5Address> : The PoseidonT5 contract address -ph6, --poseidonT6Address <poseidonT6Address> : The PoseidonT6 contract address -g, --signupGatekeeperAddress <signupGatekeeperAddress> : The signup gatekeeper contract address -q, --quiet : Whether to print values to the console -r, --rpc-provider <provider> : The rpc provider URL -s, --stateTreeDepth <stateTreeDepth> : The state tree depth -uq, --use-quadratic-voting : Whether to use quadratic voting |
checkVerifyingKeys | Check that the verifying keys in the contract match the local ones | -uq, --use-quadratic-voting" : Whether to use quadratic voting -q, --quiet : Whether to print values to the console -r, --rpc-provider <provider> : The rpc provider URL -vk, --vk-contract <vkContract> : The VkRegistry contract address -s, --state-tree-depth <stateTreeDepth> : The state tree depth -i, --int-state-tree-depth <intStateTreeDepth> : The intermediate state tree depth -m, --msg-tree-depth <messageTreeDepth> : The message tree depth -v, --vote-option-tree-depth <voteOptionTreeDepth> : The vote option tree depth -b, --msg-batch-depth <messageBatchDepth> : The message batch depth -p, --process-messages-zkey <processMessagesZkeyPath> : The process messages zkey path (see different options to use specific circuits Trusted setup or Testing) -t, --tally-votes-zkey <tallyVotesZkeyPath> : The tally votes zkey path (see different options to use specific circuits Trusted setup or Testing) |
genMaciPubKey | Generate a new MACI public key | -sk, --privkey <privkey> : The private key -q, --quiet : Whether to print values to the console -r, --rpc-provider <provider> : The rpc provider URL |
genMaciKeyPair | Generate a new MACI key pair | -sp, --seed <seed> : seed value for keypair -q, --quiet : Whether to print values to the console -r, --rpc-provider <provider> : The rpc provider URL |
airdrop | Airdrop topup credits to the coordinator | -a, --amount <amount> : The amount of topup -x, --maci-address <maciAddress> : The MACI contract address -o, --poll-id <pollId> : Poll id -t, --token-address <tokenAddress> : The token address -q, --quiet : Whether to print values to the console -r, --rpc-provider <provider> : The rpc provider URL |
deployVkRegistry | Deploy a new verification key registry contract | -q, --quiet : Whether to print values to the console -r, --rpc-provider <provider> : The rpc provider URL |
show | Show the deployed contract addresses | -q, --quiet : Whether to print values to the console -r, --rpc-provider <provider> : The rpc provider URL |
deployPoll | Deploy a new poll | -vk, --vkRegistryAddress <vkRegistryAddress> : The vk registry contract address -t, --duration <pollDuration> : The poll duration in seconds -i, --int-state-tree-depth <intStateTreeDepth> : The int state tree depth -b, --msg-batch-depth <messageTreeSubDepth> : The message tree sub depth -m, --msg-tree-depth <messageTreeDepth> : The message tree depth -v, --vote-option-tree-depth <voteOptionTreeDepth> : The vote option tree depth -pk, --pubkey <coordinatorPubkey> : The coordinator public key -uq, --use-quadratic-voting" : Whether to use quadratic voting -x, --maci-address <maciAddress> : The MACI contract address -q, --quiet : Whether to print values to the console -r, --rpc-provider <provider> : The rpc provider URL |
setVerifyingKeys | Set the verifying keys | -s, --state-tree-depth <stateTreeDepth> : The state tree depth -i, --int-state-tree-depth <intStateTreeDepth> : The intermediate state tree depth -m, --msg-tree-depth <messageTreeDepth> : The message tree depth -v, --vote-option-tree-depth <voteOptionTreeDepth> : The vote option tree depth -b, --msg-batch-depth <messageBatchDepth> : The message batch depth -pqv, --process-messages-zkey-qv <processMessagesZkeyPathQv> : The process messages qv zkey path (see different options to use specific circuits Trusted setup or Testing) -tqv, --tally-votes-zkey-qv <tallyVotesZkeyPathQv> : The tally votes qv zkey path (see different options to use specific circuits Trusted setup or Testing) -pnqv, --process-messages-zkey-non-qv <processMessagesZkeyPathNonQv> : The process messages non-qv zkey path (see different options to use specific circuits Trusted setup or Testing) -tnqv, --tally-votes-zkey-non-qv <tallyVotesZkeyPathNonQv> : The tally votes qv zkey path (see different options to use specific circuits Trusted setup or Testing) -uq, --use-quadratic-voting" : Whether to use quadratic voting -k, --vk-registry <vkRegistry> : The vk registry contract address -q, --quiet : Whether to print values to the console -r, --rpc-provider <provider> : The rpc provider URL |
publish | Publish a new message to a MACI Poll contract | -p, --pubkey <pubkey> : The MACI public key which should replace the user's public key in the state tree -x, --maci-address <maciAddress> : The MACI contract address -sk, --privkey <privkey> : Your serialized MACI private key -i, --state-index <stateIndex> : The user's state index -v, --vote-option-index <voteOptionIndex> : The vote option index -n, --nonce <nonce> : The message nonce -s, --salt <salt> : The message salt -o, --poll-id <pollId> : The poll id -w, --new-vote-weight <newVoteWeight> : The new vote weight -q, --quiet : Whether to print values to the console -r, --rpc-provider <provider> : The rpc provider URL |
mergeMessages | Merge the message accumulator queue | -q, --quiet : Whether to print values to the console -r, --rpc-provider <provider> : The rpc provider URL -x, --maci-address <maciAddress> : The MACI contract address -o, --poll-id <pollId> : The poll id -n, --num-queue-ops <numQueueOps> : The number of queue operations |
mergeSignups | Merge the signups accumulator queue | -q, --quiet : Whether to print values to the console -r, --rpc-provider <provider> : The rpc provider URL -x, --maci-address <maciAddress> : The MACI contract address -o, --poll-id <pollId> : The poll id -n, --num-queue-ops <numQueueOps> : The number of queue operations |
timeTravel | Fast-forward the time (only works for local hardhat testing) | -s, --seconds <seconds> : The number of seconds to fast-forward -q, --quiet : Whether to print values to the console -r, --rpc-provider <provider> : The rpc provider URL |
extractVkToFile | Extract verification keys (vKey) from zKey files | -pqv, --process-messages-zkey-qv <processMessagesZkeyPathQv> : The path of processMessagesQv zkey files -tqv, --tally-votes-zkey-qv <tallyVotesZkeyPathQv> : The path of tallyVotesQv zkey files -pnqv, --process-messages-zkey-non-qv <processMessagesZkeyPathNonQv> : The path of processMessagesNonQv zkey files -tnqv, --tally-votes-zkey-non-qv <tallyVotesZkeyPathNonQv> : The path of tallyVotesNonQv zkey files |
signup | Sign up to a MACI contract | -p, --pubkey <maciPubKey> : The MACI public key -x, --maci-address <maciAddress> : The MACI contract address -s, --sg-data <sgData> : The signup gateway data -i, --ivcp-data <ivcpData> : The initial voice credit proxy data -q, --quiet : Whether to print values to the console -r, --rpc-provider <provider> : The rpc provider URL |
isRegisteredUser | Checks if user is registered with public key | -p, --pubkey <maciPubKey> : The MACI public key -x, --maci-address <maciAddress> : The MACI contract address -q, --quiet : Whether to print values to the console |
topup | Top up an account with voice credits | -a, --amount <amount> : The amount of topup -x, --maci-address <maciAddress> : The MACI contract address -i, --state-index <stateIndex> : State leaf index -o, --poll-id <pollId> : Poll id -q, --quiet : Whether to print values to the console -r, --rpc-provider <provider> : The rpc provider URL |
fundWallet | Fund a wallet with Ether | -a, --amount <amount> : The amount of Ether -w, --address <address> : The address to fund -q, --quiet : Whether to print values to the console -r, --rpc-provider <provider> : The rpc provider URL |
verify | Verify the results of a poll on-chain | -o, --poll-id <pollId> : The poll id -t, --tally-file <tallyFile> : The tally file with results, per vote option spent credits, spent voice credits total -x, --maci-address <maciAddress> : The MACI contract address -tc, --tally-contract <tallyContract> : The tally contract address -q, --quiet : Whether to print values to the console -r, --rpc-provider <provider> : The rpc provider URL |
genProofs | Generate the proofs for a poll | -sk, --privkey <privkey> : Your serialized MACI private key -x, --maci-address <maciAddress> : The MACI contract address -o, --poll-id <pollId> : The poll id -t, --tally-file <tallyFile> : The tally file -r, --rapidsnark <rapidsnark> : The path to the rapidsnark binary -wp, --process-witnessgen <processWitnessgen> : The path to the process witness generation binary -pd, --process-witnessdat <processWitnessdat> : The path to the process witness dat file -wt, --tally-witnessgen <tallyWitnessgen> : The path to the tally witness generation binary -td, --tally-witnessdat <tallyWitnessdat> : The path to the tally witness dat file -zp, --process-zkey <processZkey : The path to the process zkey -zt, --tally-zkey <tallyZkey> : The path to the tally zkey -q, --quiet : Whether to print values to the console -p, --rpc-provider <provider> : The rpc provider URL -f, --output <outputDir> : The output directory for proofs -tx, --transaction-hash <transactionHash>: Transaction hash of MACI contract creation -w, --wasm : Whether to use the wasm binaries -pw, --process-wasm <processWasm> : The path to the process witness generation wasm binary -tw, --tally-wasm <tallyWasm> : The path to the tally witness generation wasm binary -st, --state-file <stateFile> : The path to the state file containing the serialized maci state -sb, --start-block <startBlock> : The block number to start looking for events from -eb, --end-block <endBlock> : The block number to end looking for events from -bb, --blocks-per-batch <blockPerBatch> : The number of blocks to process per batch -uq, --use-quadratic-voting : Whether to process messages and tally votes using quadratic voting or not |
proveOnChain | Prove the results of a poll on chain | -o, --poll-id <pollId> : The poll id -q, --quiet : Whether to print values to the console -r, --rpc-provider <provider> : The rpc provider URL -x, --maci-address <maciAddress> : The MACI contract address -p, --message-processor-address <messageProcessorAddress> : The message processor contract address -t, --tally-contract <tallyContract> : The tally contract address -f, --proof-dir <proofDir> : The proof output directory from the genProofs subcommand |