Skip to content

gasperpre/veripoll

 
 

Repository files navigation

Go to MACI repo

AnonVote

AnonVote employs a quadratic and collusion-resistant voting mechanism on Ethereum called Minimal Anti-Collusion Infrastructure (MACI) to prevent bribery and scale images quadratically. Additionally, it uses World ID to ensure sybil resistance.

How to run AnonVote locally

Clone this repo. Install dependencies by running yarn or npm install:

yarn  # or `npm install`

Copy .env.sample and name it .env.

In .env set values for all the missing variables, such as MONGO_URL, AZURE_STORAGE_ACCOUNT_NAME, AZURE_CONTAINER_NAME, AZURE_KEY, AZURE_CONNECTION_STRING. You can find detailed guides on setting up MongoDB and Azure Storage towards the end of this doc.

cp .env.sample .env
vim .env  # set `MONGO_URL, AZURE_STORAGE_ACCOUNT_NAME, etc...`

Your .env file should looks something like this:

NEXT_PUBLIC_MACI_ADDRESS=0x0eBD0f5C0F0131418ab6e49De1a40c3a86722b4f

NEXT_PUBLIC_STRAPI_URL=https://strapi-admin.quadratic.page

MONGO_URL=mongodb+srv://user:[email protected]/database...

AZURE_STORAGE_ACCOUNT_NAME=qdh
AZURE_CONTAINER_NAME=qdh-user-images
AZURE_KEY=24f234f234f+24f243f+24f243f/24f234f234f2f24f==...
AZURE_CONNECTION_STRING=DefaultEndpointsProtocol=https...

Now run yarn dev (or npm run dev)

Frontend is now accessible on http://localhost:3000

Now let's set up and deploy MACI on a local testnet.

Setting up MACI

In a separate terminal, clone MACI: https://github.com/appliedzkp/maci

Carefully follow the steps in "Local development and testing": bootstrap MACI repo, install Rust, build zk-SNARKs, compile contracts, deploy them and deploy a poll.

Once you've deployed MACI and created a poll, add your MACI contract address to .env.

Setting up Azure Storage

  1. Create a Storage account. Give it a name. For example qdh
  2. Go to Storage account > Overview
  3. Click on Containers. Create a new storage container. Let's name it qdh-user-images. Make sure that the "Public access level" is set to Blob (anonymous access for blobs only)
  4. Click on Settings > Access keys. Copy paste Account Name, Key and Connection String from there.
  5. Tada! You now have AZURE_STORAGE_ACCOUNT_NAME, AZURE_CONTAINER_NAME, AZURE_KEY, AZURE_CONNECTION_STRING:
AZURE_STORAGE_ACCOUNT_NAME='qdh'
AZURE_CONTAINER_NAME='qdh-user-images'
AZURE_KEY='24f234f234f+24f243f+24f243f/24f234f234f2f24f==...'
AZURE_CONNECTION_STRING='DefaultEndpointsProtocol=https...'

Screenshot 2021-02-03 at 3 21 41 PM

p.s. We'll eventually try to make this project cloud agnostic. Feel free to contribute!

Setting up MongoDB

  • If you are are looking for a free & easy MongoDB hosting, try Mongo Atlas
  • If you've used Dokku before, you can deploy mongo instance on it using dokku-mongo plugin.
  • You can also deploy MongoDB on your IaaS or PaaS of choice.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 71.9%
  • TypeScript 25.6%
  • CSS 2.5%