This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity ^0.4.17; | |
contract Voting { | |
// 1. Initialize a few candidates | |
// 2. Vote for a candidate | |
// 3. Lookup vote count for each candidate | |
bytes32[] public candidateNames; | |
mapping (bytes32 => uint8) public votesReceived; | |
address public owner; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mkdir voting_dapp | |
cd voting_dapp | |
truffle unbox webpack | |
npm install | |
rm contracts/MetaCoin.sol | |
rm contracts/ConvertLib.sol | |
create contracts/Voting.sol and copy your contract code |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
In truffle console: | |
# To list all the available accounts | |
web3.eth.accounts | |
# To check the balance of account (in Wei) | |
web3.eth.getBalance('<account address>') | |
# To get balance in Ether | |
web3.fromWei(web3.eth.getBalance('<account address>'), 'ether') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Import the page's CSS. Webpack will know what to do with it. | |
import "../stylesheets/app.css"; | |
// Import libraries we need. | |
import { default as Web3} from 'web3'; | |
import { default as contract } from 'truffle-contract' | |
import voting_artifacts from '../../build/contracts/Voting.json' | |
var Voting = contract(voting_artifacts); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Project Phases | |
Phase 1 | |
Implement the ERC20 smart contract in Remix browser IDE https://remix.ethereum.org | |
Test the contract functions | |
Phase 2 | |
- Clone the starter project | |
git clone https://github.com/zastrin/boston_token | |
npm install |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity ^0.4.24; | |
contract ERC20Token { | |
uint public supply = 1000000; | |
uint public price = 0.001 ether; | |
string public name = "Hackathon Token"; | |
string public symbol = "HKT"; | |
uint public decimals = 18; | |