Etherium-Voting-Dapp
所属分类:Web3.0
开发工具:JavaScript
文件大小:22KB
下载次数:0
上传日期:2018-02-11 09:33:22
上 传 者:
sh-1993
说明: 使用Etherium和Web3.0构建去中心化应用程序(Dapp)
(Building a decentralized application (Dapp) using Etherium and Web3.0)
文件列表:
Voting.sol (1608, 2018-02-11)
index.html (1216, 2018-02-11)
index.js (2229, 2018-02-11)
package-lock.json (78964, 2018-02-11)
package.json (345, 2018-02-11)
# Etherium Voting Dapp
A Decentralized Voting Application made using etherium and web 3.0
## Getting Started
Clone the repo and run the following on terminal.
```
> cd Etherium-Voting-Dapp
> npm install
> node_modules/ethereumjs-testrpc/build/cli.node.js
```
```
> node
> Web3 = require('web3')
> web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545"));
> 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(['Rama','Nick','Jose'],{data: byteCode, from: web3.eth.accounts[0], gas: 4700000})
> deployedContract.address
> contractInstance = VotingContract.at(deployedContract.address)
```
Copy the contract address and assign the value to contractAddress variable in index.js
```
> deployedContract.address
```
## Running
Run index.html on a browser and enter a name and vote.
## Credits
Based on the work by [maheshmurthy](https://gist.github.com/maheshmurthy)
近期下载者:
相关文件:
收藏者: