This example showcases the basic principles of a Ðapp build in Meteor:
- Separate the ethereum logic from you dapp
- Receive Logs from contracts
- Call contract funcitons
Start a geth node on a testnet:
$ geth --rpccorsdomain "*" --rpc --networkid 8545 --minerthreads "1" --datadir <somePath>/testChain --mine
Add --unlock <your account>
if you want to use your account to setNumbers in the contract.
To start this on your own you need to deploy the contract code from inside client/lib/contract.js
first and replace the address in line 4 (GuessNumberInstance = GuessNumber.at(...)
).
var contractInstance = GuessNumber.new({from: web3.eth.accounts[0], gas: 200000, data: contractCode});
contractInstance.address;
GuessNumberInstance.setNumber(10, {from: <your account>, gas: 50000})
web3.eth.sendTransaction({from: web3.eth.accounts[0], to: <contract address> , value: 123000000000})