Skip to main content
Version: v2.x

MACI Utility Circuits

Process Messages Input Hasher

A utility circuit used by the main processMessages circuit to hash its inputs.

ProcessMessagesInputHasher

It outputs one field element, which is the SHA256 hash of the following inputs:

  1. packedVals
  2. pollEndTimestamp
  3. msgRoot
  4. coordinatorPubKeyHash
  5. newSbCommitment
  6. currentSbCommitment

Tally Votes Input Hasher

A utility template that generates a sha256 hash of the provided tally inputs.

TallyVotesInputHasher

It outputs one field element, which is the SHA256 hash of the following inputs:

  1. packedVals
  2. sbCommitment
  3. currentTallyCommitment
  4. newTallyCommitment

ResultsCommitmentVerifier

A utility circuit used by the main tallyVotes circuit to verify that the results commitment is correct.

ResultsCommitmentVerifier

QuinCheckRoot

Utility circuit that given a quin Merkle root and a list of leaves, check if the root is the correct result of inserting all the leaves into the tree in the given order.

QuinCheckRoot

CalculateTotal

Utility circuit used to calculate the sum of an array of elements.

CalculateTotal

ECDH

Utility circuit used to generate a shared key from a private key and a public key.

ECDH

Poseidon

Utility circuit used to generate a Poseidon hash. In this case, it supports up to 13 inputs.

Poseidon13

MessageToCommand

Utility circuit used to convert a message into a command, this involves decrypting the message.

MessageToCommand

MessageValidator

Utility circuit used to validate a message. This performs several checks:

  • stateTreeIndex is valid
  • voteOptionIndex is valid
  • nonce is valid
  • the signature is valid
  • the user signed up before poll end timestamp
  • the user had enough voice credits

MessageValidator

PrivToPubKey

Utility circuit used to generate a public key from a private key.

PrivToPubKey

VerifySignature

Utility circuit used to verify a EdDSA signature

VerifySignature

UnpackElement

Utility circuit used to unpack an input element.

UnpackElement

QuinSelector

Utility circuit used to select one element from an array of n elements at a given index.

QuinSelector

Splicer

Utility circuit used to insert one element in an array at position index.

Splicer

QuinBatchLeavesExists

Utility circuit used to check if a batch of leaves exists in a quinary tree.

QuinBatchLeavesExists

QuinGeneratePathIndices

Utility circuit used to generate the indices needed to traverse the tree until we find the leaf we are looking for.

QuinGeneratePathIndices

ProcessOne

Utility circuit used to process one message.

ProcessOne