A minimal anonymous voting engine for communities, using credential filtering, random elector selection, and verifiable encrypted voting.
This example implements a simple one-item bulletin board. It allows users to post a single message at a time, and only the user who posted the message can take it down and make the board vacant again.
The full description of the bulletin board scenario, as well as a detailed discussion of the code, can be found in part 3 of the Midnight developer tutorial.
The api directory contains different methods, classes and types required to run the voting CLI and the voting UI.
The contract directory contains the Compact contract and its utilities.
The voting-cli directory contains the code required to run the voting dapp as a CLI app.
The voting-ui directory contains the code needed to build the interface and interact with it in the browser.
The interface allows the user to deploy a new voting contract, post a new message and take it down.
Note: if installing via npm, you need to pass --legacy-peer-deps because of the more modern use of vite.
- Install the node modules in the root
- Install the node modules in
api - Install the node modules in
contract, compile the contract withnpm run compact, and then the typescript withnpm run build - Install the node modules in
voting-cli, build it and runnpm run testnet-remoteto launch the app
- Install the node modules in the root
- Install the node modules in
api - Install the node modules in
contractand compile it - Install the node modules in
voting-ui - Run
npm run build:startto build the project and run a local server