Inspiration

The complete transparency and distributed nature of the blockchain makes it hard to operate in a private manner. Transactions between wallets, smart contract calls and their results are considered public data and are readily available to anyone. Where some use cases substantially benefit from the transparency of the blockchain, there are a wide range of applications where privatization is instrumental for their progress.

One such application is voting. With blockchain igniting the paradigm shift to user ownership and control, many aspects of applications, organizations and the protocols themselves rely on voting for an endless variety of aspects. From voting on protocol changes, community votes on roadmap changes, to DAO voting on investment decisions, trust-less voting mechanisms have been prime use cases for the blockchain.

However, voting is an application that suffers from over transparency. Knowing that your vote is public information may potentially impact what you vote for, furthermore, whether you voted or not may also impact your standings within a community or organization; this can be especially imagined within a small DAO setting. What is needed is a solution which provides trust-less voting for any purpose while retaining the privacy of the voters.

What is VoAn

VoAn is platform that enables anonymous voting on NEAR. It currently supports a maximum of 8 participants per proposal vote.

  • Allows for the creation of new votes with specified parameters (proposal, deadlines, threshold, whitelist/jury)
  • Allows for trust-less voting and complete voter privacy

How it works

The main components of VoAn are:

  1. zkSNARK circuits (Groth16)
  2. Smart-contract
  3. Relayer

Even though the app can run without Web-ui - it plays a very important role and does all the work using SnarkJS behind the scenes.

  1. We built zkSNARK circuits with the Circom DSL. The main thing they contain is a Merkle Tree (with MiMCSponge hash function) implementation (or constraints); it allows us to prove that we are part of a set without revealing what part we are.

  2. We built the smart-contract with the Rust programming language. It contains:

    • Merkle tree implementation
    • zkSNARK/Groth16 Verification (with arkworks + electron-labs/electron-rs crate)
    • Logic for voting platform

    The contract was deployed to v1.voan.testnet

  3. We built the relayer with the NodeJS. It allows for participants remain anonymous when executing a vote by paying for users' transactions. Snark Circuit was designed so that the correctness of the proof depends on the vote value - so the relayer cannot frontrun and manipulate results. The relayer also checks transactions for correctness to protect against spam. It runs using relayer.voan.testnet

  4. We built Web-UI with JavaScript/React. It allows you to conveniently interact with the smart-contract and the relayer. Also it contains all necessary logic for zk-proof generation (as well as secret parameters within a registration).

Challenges we ran into

There were many challenges that we ran into, but one of the most serious is that it was not possible to execute the SNARK-friendly hash function (MiMCSponge) on-chain, due to exceeding the GAS limit. But our team re-implemented the MiMCSponge hash-function, so that it's compatible with Circom and Circomlibjs and now can perform and can be executed more than 25 times in one transaction (before, existing implementations did not allow for it to even be used once). This is a very useful thing for the NEAR Protocol, since almost all zk schemes contain the use of SNARK-friendly hash functions.

Perhaps in the future, our implementation can be included in NearCore as a precompile.

What's next for VOAN

  1. Reimplement Merkle Tree (make it sparse/optimal) and refactor smart-contract
  2. Reimplement Groth16 on-chain verification with NEAR Core's bn254 precompiles or use Plonk instead
  3. Recompile circuits (add support for bigger Merkle trees)
  4. Partnership with AstroDAO or building our own platform with tokenomics & rewards for relayers
  5. Web-site design & refactoring
  6. Beta version launch
  7. Multiple relayers network launch
  8. Smart-contract audit & circuits audit
  9. Mainnet launch
  10. Incentive mechanism for relayers

Further reading

You can find more information on the details of the project in this web-site.

Built With

Share this project:

Updates