A Zero-Knowledge implementation of the Semaphore protocol on Cardano, built with Aiken smart contracts.
This repository contains an Aiken-based implementation of the Semaphore protocol, originally developed for Ethereum by PSE.DEV. Semaphore is a Zero-Knowledge protocol that enables private group membership proofs and anonymous messaging.
- Anonymous Group Membership: Prove group participation without revealing identity
- Anonymous Signaling: Broadcast messages, votes, or preferences anonymously
- Double-Signaling Prevention: Cryptographic protection against duplicate messages
This implementation serves as a foundational protocol for privacy-oriented applications on Cardano.
To understand the protocol we have to take in account three important concepts.
A user can represent themselves by creating an identity. This identity contains unique secret values that are generated locally by the user. These values allow them to prove ownership of the identity and to construct proofs and messages tied to this identity. These secret values are important because they prevent impersonating the user by appending unrelated corrupt messages or proofs.
A group is a set of members, where each member has their identity. A group in Semaphore is represented by a Merkle tree that stores the public identity commitment of each member (the leaves). Later a user can construct a proof showing that their identity is part of the group but without specifying who. Currently these groups are managed by administrators but in the future we'll allow users to join and leave groups independently.
The signal is a message that contains an arbitrary string representing a preference, vote, or opinion. This message includes proofs that demonstrate the user is a valid member of the group and that the information sent (message and proofs) was created by an identity.
Considering the above the protocol has cryptographic mechanisms that allows to anonymously check:
-
Proof of ownership: Verify that the proofs and messages are being created by the owner of an identity.
-
Proof of membership: Verify that the proof and messages are being created by a valid member of the group.
-
Double signaling: Detect wether a message has been sent previously by an user, this is important since avoids to broadcast a signal twice in a way that can be malicious to the Dapp.
aiken build
To run all tests, simply do:
aiken check
To run only tests matching the string foo
, do:
aiken check -m foo
[x] Alpha version release version
[x] Group reusability.
[] Token based group managing.
[] Relayer claiming mechanisms
[] 1 token 1 vote feature.
Todo
Todo