Skip to content

A demo voting application using Ethereum smart contract logic

Notifications You must be signed in to change notification settings

jclemans/voting_dapp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

A Demo Voting App Built Using Ethereum Smart Contract

Dependencies

Steps to Run

Install dependencies Run testrpc:

node_modules/ethereumjs-testrpc/build/cli.node.js

Go into a node terminal prompt:

vote_dapp (master ✔) ᐅ node

Set up and deploy a contract:

> Web3 = require('web3')
> web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545"));
> code = fs.readFileSync('Vote.sol').toString()
> solc = require('solc')
> compiledCode = solc.compile(code)
> abiDefinition = JSON.parse(compiledCode.contracts[':Vote'].interface)
> VotingContract = web3.eth.contract(abiDefinition)
> byteCode = compiledCode.contracts[':Vote'].bytecode
> deployedContract = VotingContract.new(['Raccon','Cat','Chocolate Race Horse'],{data: byteCode, from: web3.eth.accounts[0], gas: 4700000})
> deployedContract.address
> contractInstance = VotingContract.at(deployedContract.address)

Credits

Demo inspired by "A Guide to Building Your First Decentralized Application" by Siraj Raval, which was inspired by maheshmurthy

About

A demo voting application using Ethereum smart contract logic

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published