- Near Private Voting
- The given proposal will consist of 3 parts:
- Secret network contract (secret storing)
- Registration contract
- Voting contract
- Relayer
- User flow:
- Register as a voter or candidate in the registration contract.
- Create a new private key.
- Create a new shared secret using the public key of SecretNetwork.
- Create vote. (see vote format in voting contract section)
- Encrypt this data with a signature using a shared secret.
- Create a voting package. (See the voting package format in the voting contract section.) Using your main account, create the signature of the voting package to pass relayer input validation.
- Send this data to the relayer, who will batch it at some point.
- Secret contract.
- Stores the secret and reveals it after some time.
- Provides a public key for encryption at all times.
- Registration contract:
- Stores accounts that are participating in the voting with the information of the voting power from the snapshot.
- The enlisted user should accept the Terms and Conditions and verify their intentions to participate in the voting. (Slash for not voting after verification?)
- Retrieves user vote power on cross-contract calls.
- Register candidates.
- Voting contract:
- Stores encrypted votes and decrypts them after the secret phrase is revealed.
- Voting package data format:
- Encrypted vote
- A public account that is used to create a shared secret
- Signature of the data using that public key.
- Process the encrypted votes. The encrypted vote should contain the following data:
- Vote data format
- user name
- vote for candidate X
- signature of the provided data using registered account to prevent double vote and get the vote power.
- Incorrect votes are ignored.
- Decodes the information and fetches the voting power of the user from the registered contract.
- Displays the results after secret reveal
- Relayer
- Receives encrypted vote data from the registered account. The account should provide a signature to prove owning of the verified account.
- Relays the message to hide the fact that the user voted.
- Maintains the state not to allow double votes.
- Privacy:
- In the worst-case scenario, the only possible leak is who voted information.