Ursa is a decentralised application (dapp) built on the Ethereum platform which allows a user to create elections by entering a election name, expiration time, candidates and a whitelist of voter addresses. Whitelisted users can then vote once on a candidate in the election, which will end when the expiration time is reached. It provides a basic visual representation of votes cast in the UI in the form of a pie chart once votes are received.
Ganache if you intend to only use the project locally for testing.
Clone the the repo into your CLI and run
npm install
at root level to install all back end dependencies. Perform this again within the client folder to install all front end dependencies.
You will need to create a new file at root level of the project called
mnemonic.js
This file should contain the following code:
module.exports = 'SEED WORDS HERE';
replacing 'SEED WORDS HERE' with the seed phrase from your MetaMask account.
DO NOT SHARE THESE KEY WORDS IF YOU DO NOT WANT SOMEONE ELSE GETTING ACCESS TO YOUR ACCOUNT.
Make sure Ganache is running and the port in Ganache matches that in both MetaMask and the truffle-config.js file at root level of the project.
Run
truffle compile
truffle migrate --reset
which will compile the contract and migrate it to your local Ganache blockchain.
Enter your client folder and run
npm start
to run the locally hosted React server which will serve up your project.
Once you have installed MetaMask and created a new account, change your network to the Ropsten test network and visit the Ropsten Ether Faucet to get some test ether. It may take a minute or two, but you should see some ether in your metamask wallet which will allow you to deploy and use the contract on Ropsten.
Make an account on Infura, which will act as an API host for your project. Make a new project and copy the Project ID from its settings, making sure to replace the API key in truffle-config.js with your own.
Run
truffle compile
truffle deploy --network ropsten
which will migrate the contract to the Ropsten network.
Enter your client folder and run
npm start
to run the locally hosted React server which will serve up your project.
While the front end of the app is untested, developing the smart contract in solidity required extensive testing of functions using Truffle's native testing suite, which is built on Mocha and Chai.
To access and perform these tests run
truffle test
from the CLI.
Deployment of the app requires that the contract is deployed to a live network such as the test networks Ropsten, Kovan or Rinkeby or the main ethereum network. Please follow the section of the Readme to ensure the contract is hosted on a live network before proceeding.
The app can be deployed easily using Netlify.
To deploy to your own netlify account, log in or create an account before following the next steps.
First, run the command
npm run build
in your CLI to make a production version of the app for deployment.
To install netlify commands globally on your system, enter
npm install netlify-cli -g
on your CLI, followed by
netlify deploy
which will log you into your netlify account through your browser. Choose to create & configure a new site, select which account you would like to deploy the app to and the site will be created as a draft for you to check over before finally committing it.
You should set your deploy folder as
./build
and the site should deploy for you to use.
There is a currently deployed version of this site available to use here
Back End
Front End
Andy Gray of Blockrocket who we're all eternally grateful to for providing his time and expertise while we made this project.
Everyone at Northcoders, without whom we wouldn't be here making this project. Thanks for giving us the tools we need to be coders.