Skip to content

Instantly share code, notes, and snippets.

@zastrin
Last active March 10, 2018 03:43
Show Gist options
  • Save zastrin/90c1434c07afd9c56c5426b0e20267fb to your computer and use it in GitHub Desktop.
Save zastrin/90c1434c07afd9c56c5426b0e20267fb to your computer and use it in GitHub Desktop.
March 9th - Notes
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')
# To vote from a specific account
Voting.deployed().then(function(f) {f.voteForCandidate('Trishul', {from: '0xfdcb425e3cd114f801e0114aace8666be5b1242e'}).then(function(f) {console.log(f)})})
# The contract with example owner logic is here: https://gist.github.com/zastrin/cae97522c2f00e7ee2babb40b6c8f6f6
# Everytime you make changes to your code and to test, you have to do:
truffle migrate --reset <- You can run this from within truffle console itself
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment