Coder Social home page Coder Social logo

gofornaman / hackathon-decentralizedvotingmachine Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 8.23 MB

This is a submission for the Daksh’18 Hackathon to Guvi by Team Blitzkreig

License: MIT License

Python 1.37% HTML 95.11% JavaScript 0.80% Jupyter Notebook 2.72%

hackathon-decentralizedvotingmachine's Introduction

This is a submission for the Daksh’18 Hackathon by Guvi.
This project is an amalgamation of two very different modules.
One of the module uses Python exclusively with Flask-API and the other is an ethereum smart contract that runs on Node.js and Soilidity Please follow these steps religiously

Step 1 - Git clone this rep
Step 2 - Open Command prompt/ Terminal and type in this
pip install -r requirements.txt
Step 3 - python app.py
Step 4 - Open a new terminal, type in node then npm install ethereumjs-testrpc web3
Step 5 - npm install solc
Step 6 - Go to node_modules/.bin/testrpc and run testrpc
Step 7 - Open a new terminal (again..) and give these commands from node terminal
node

Web3 = require('web3')
web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545"));
web3.eth.accounts
code = fs.readFileSync('Voting.sol').toString()
solc = require('solc')
compiledCode = solc.compile(code)
abiDefinition = JSON.parse(compiledCode.contracts[':Voting'].interface)
VotingContract = web3.eth.contract(abiDefinition)
byteCode = compiledCode.contracts[':Voting'].bytecode
deployedContract=VotingContract.new(['Rahul Gandhi','Narendra Modi','Nitish Kumar'],{data:byteCode,from:web3.eth.accounts[0], gas: 4700000})
deployedContract.address
contractInstance = VotingContract.at(deployedContract.address)
Step 8 - That’s it!
You can now open the “main.html” file in chrome
It seems like a lot of work, but worth it ;)

alt text

hackathon-decentralizedvotingmachine's People

Contributors

gofornaman avatar

Watchers

 avatar  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.