Ethereum meetup presentation 01.04.2017

44 %
56 %
Information about Ethereum meetup presentation 01.04.2017

Published on January 5, 2017

Author: intrins1k


1. Ethereum Developers Community Smart Contract Tutorial Arnold Pham Cofounder of Lunyr Unless otherwise stated, these slides are licensed under the Creative Commons Attribution-NonCommercial 3.0 License (

2. High level view of web app client server architecture

3. High level view of Ethereum Dapp Architecture

4. Yikes! Downloading the whole blockchain?

5. EVM - Database and Code

6. Built in financial system

7. Solidity

8. Useful Tools - Opportunities for contribution ethereumjs-testrpc • Node.js based Ethereum client for testing and development • Simulates full client behavior • dapple • developer multitool for managing the growing complexity of interconnected smart contract systems • truffle • A development environment, testing framework and asset pipeline for Ethereum

9. Browser-Solidity

10. Shows errors

11. Creating Contracts

12. What is the ABI? Application Binary Interface

13. Deploying a Contract with Web3

14. 1. Write your contract

15. 2. Make sure you have the Solidity compiler No Solidity compiler? Proceed to next step Download

16. 3. Compile your contract with web3.eth.compile.solidity(source) to get an object with the contract and compiler info

17. You need the abiDefinition

18. Create a contract object which can be used to instantiate contracts on an address

19. Deploy the Contract var contractInstance =[contructorParam1] [, contructorParam2], {data: '0x12345...', from: myAccount, gas: 1000000}); Make sure to unlock the account first with personal.unlockAccount(eth.accounts[0])

20. Contract mined!

21. Check transactionHash

22. transactionHash: 0x87e42f5a325e13736342ce0d8e505e332b3ee20a5aa0c6f1080c0d5df8a0f1ab

23. You can also check that the contract was deployed at the address with: eth.getCode(simplestorage.address) Contract Address: "0xeb2186b9f667796497f0fc3c824d0bb57a548c25"

24. 1. Write your contract

25. Retrieving Data from the simplestorage Contract instance > simplestorage.get ()

26. Method calls with sendTransaction contractInstance.method.sendTransaction([parameter], { from: eth.accounts[0])

27. Change storedData to 20. simplestorage.get() to view change > simplestorage.set.sendTransaction(20, {from: eth.accounts[0]})

28. Getting other people to interact with your code Requires the ABI Then they can instantiate a Javascript object which can be used to call the contract from any node on the network var newInstance = eth.contract(ABI).at(Address);

29. Deploying a Contract with Browser-Solidity

30. Write the contract in Browser-Solidity

31. Uses Metamask. Spend Ether to deploy it

32. Now on blockchain

33. Etherscan Block Explorer shows the contract

34. ERC20 Specification Token Methods: totalSupply balanceOf transfer transferFrom approve allowance

35. Creating a simple token contract (Warning: Very simplified Example)

36. The Token Contract

37. Steps to deploy the contract > var tokenSource = 'contract Token{address public owner;mapping(address=>uint)balances;function Token(){owner=msg.sender;balances[owner]=100;}function transfer(address _to,uint _value)returns(bool success){if(balances[msg.sender]<_value){return false;}balances[msg.sender]-=_value;balances[_to]+=_value;return true;}function getBalance(address _user)constant returns(uint _balance){return balances[_user];}}'

38. > var tokenCompiled = web3.eth.compile.solidity(tokenSource)

39. > var tokenContract = web3.eth.contract(

40. Create new instance

41. Check the owner

42. GetBalance

43. Transfer tokens to another address

44. Thank you for watching! Stay tuned for more!

Add a comment