This dApp demonstrates confidentiality using a voting smart contract that keeps each user's vote private and hides vote tallies until voting has ended. It serves as an example app for our Web3(c) library.
To interact with this dApp locally follow the steps below.
Run npm install
To modify the contract, run npm install -g truffle-oasis
To build a new ballot, run:
truffle compile
You can deploy the contract with truffle. to do so:
Edit truffle.js
to add the mnemonic for your private key. This will be the address that deploys the smart contract;
you must control this address if you want to end voting from the dApp!
truffle migrate --reset --network oasis
Note the address of the deployed contract in the output
...
Saving artifacts...
Running migration: 2_deploy_contracts.js
Replacing SecretBallot...
... 0x473e196528a48d27d5488dddf9bb8a351caa6bfe41a44b8e9fca0c935142db90
SecretBallot: 0x1dd2838d8290dd83d5d060d1b3d2cc1eae0ac5f7
In this example the ballot was deployed to address 0x1dd2838d8290dd83d5d060d1b3d2cc1eae0ac5f7
Launch the local web server: npm run dev
In your browser visit localhost:8080?ballot=<contract address>
contracts/SecretBallot.sol
migrations/2_deploy_contracts.js
then re-deploy using the instructions above