Skip to content

Instantly share code, notes, and snippets.

@DavidBurela
Created February 15, 2017 00:38
Show Gist options
  • Save DavidBurela/01cf3cc2b14bbf1aedf98ac2c7047690 to your computer and use it in GitHub Desktop.
Save DavidBurela/01cf3cc2b14bbf1aedf98ac2c7047690 to your computer and use it in GitHub Desktop.
truffle console demo
// get accounts
web3.eth.accounts
// get reference to deployed contract
var metaCoin;
MetaCoin.deployed().then(function(deployed) {metaCoin = deployed;});
// get balance of account 0
metaCoin.getBalance.call(web3.eth.accounts[0])
// send coins
var account0 = web3.eth.accounts[0];
var account1 = web3.eth.accounts[1];
metaCoin.sendCoin(account1, 1000, {from: account0});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment