Skip to main content
Version: v3.x

MACI Utility Circuits

Process Messages Input Hasher​

A utility circuit used by the main MessageProcessor 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. messageRoot
  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 VoteTally circuit to verify that the results commitment is correct.

ResultsCommitmentVerifier

QuinaryCheckRoot​

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.

QuinaryCheckRoot

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

QuinarySelector​

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

QuinarySelector

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

QuinaryGeneratePathIndices​

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

QuinaryGeneratePathIndices

ProcessOne​

Utility circuit used to process one message.

ProcessOne