@socialcap/protocol
v0.1.4
Published
As a base for anonymity we implemented an [o1js](https://docs.minaprotocol.com/zkapps/o1js) a version of the [Semaphore protocol](./docs/semaphore.md). It includes the following components:
Downloads
9
Readme
Socialcap Anonymous Voting
As a base for anonymity we implemented an o1js a version of the Semaphore protocol. It includes the following components:
Semaphore:
These are the base components of the protocol, implemented using o1js
for proofs and crypto primitives (hashing, encryption, private and public key generation, merkles).
In src/semaphore
folder:
- identity : create and register identities
- groups: register in groups
- prover: create ZK proofs as required by the protocol
- requests: send requests to the relayer or services.
- signals: prepare signals for broadcasting
Relayer:
Its role to is preserve the anonymity of the user broadcasting a message with Semaphore.
We implement this using NATS.io messaging.
The NATS server (which can be easily decentralized) acts as a simple relayer, transforming a call to any NATS server to a published message (from an unknown origin) that can be resolved by any service suscribed to that message.
Services
As we have no decentralized server contracts in MINA Protocol we emulate them with a centralized service, running in Socialcap hosts.
This service has three roles:
Provide services related to the Semaphore protocol itself, for example: add an Identity to a Group or provide a Witness of a given key when needing to create a proof.
Relay signals to applications built over the Semaphore protocol. These applications will process the signal by doing specific tasks such as assign random electors or count votes.
Provide services to these applications, such as providing a Witness or accessing a shared object needed by the application.
In src/services
folder:
- listeners: listen to subscribed messages
- identities: manages the identity register
- groups: manages the groups register
- merkles: create and operate on IndexedMerkleMaps
- kvs: manage the LMDB key-value store
- signals: validates received signals when appropiate
- dispatcher: dispatchs tasks to application handlers
- verifiers: verifies received proofs
- logger: log to file (pino logger)
- utils: general utilities
Application (Voting)
Implements the full voting process.
In src/voting
folder
- selection: selects the electors who will participate in voting for each claim
- assignments: assigns the voting tasks to each elector
- reception: receives batch of vote from electors
- aggregation: aggregates the votes per claim to produce results
- issuer: issues credentials based on results
- settlement: settles results on MINA voting accounts
It will settle results for each claim using the corresponding MINA VotingAccountContract linked to that claim.