Creates a new instance of the Group. Optionally, a list of identity commitments can
be passed as a parameter. Adding members in chunks is more efficient than adding
them one by one with the addMember
function.
A list of identity commitments.
Returns the depth of the tree.
The tree depth as a number.
Returns the members (i.e. identity commitments) of the group.
The list of members of the group.
Returns the root hash of the tree.
The root hash as a string.
Returns the size of the tree (i.e. number of leaves).
The tree size as a number.
Creates a proof of membership for a member of the group.
The index of the member.
The MerkleProof object.
Static
import
The Semaphore group is a LeanIMT (Lean Incremental Merkle Tree), i.e. an optimized version of the incremental binary Merkle tree used by Semaphore V3. The new tree does not use zero hashes, and its depth is dynamic. The members of a Semaphore group, or the leaves of a tree, are the identity commitments. Thanks to the properties of Merkle trees, it can be efficiently demonstrated that a group member belongs to the group. This class supports operations such as member addition, update, removal and Merkle proof generation and verification. Groups can also be exported or imported.