Git Product home page Git Product logo

secret-ballot's Introduction

Secret Ballot dApp

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.

Initial Setup

  • Run npm install

  • To modify the contract, run npm install -g truffle-oasis

Building & Deploying the Smart Contract

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

Interacting with the dApp

  • Launch the local web server: npm run dev

  • In your browser visit localhost:8080?ballot=<contract address>

Notes and Troubleshooting

  • The smart contract code is available at contracts/SecretBallot.sol
  • If you don't see anything in the web browser, ensure your Metamask is unlocked and configured for the Oasis testnet
  • Due to rate limiting the web UI doesn't always display complete information. If the page doesn't fully populate you may need to wait a few seconds and refresh the page
  • To change the ballot options, edit migrations/2_deploy_contracts.js then re-deploy using the instructions above

secret-ballot's People

Contributors

armaniferrante avatar clementfung avatar kostko avatar noahj avatar peterjgilbert avatar pro-wh avatar ptrus avatar ryscheng avatar ryscheng-mobile avatar willscott avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.