Successfully reported this slideshow.
Your SlideShare is downloading. ×

HKOS 2018

Ad
Ad
Ad
Ad
Ad
Ad
Ad
Ad
Ad
Ad
Ad

Check these out next

1 of 9 Ad

More Related Content

Similar to HKOS 2018 (20)

Recently uploaded (20)

Advertisement

HKOS 2018

  1. 1. Let’s write a DApp Chung Wu LikeCoin Foundation HKOSCon 2018
  2. 2. What is DApp ServerBrowser Browser Blockchain
  3. 3. DApp example: class voting system - Teacher is the host and can create new proposals with some description - Students are participants, the list is pre-defined, and can vote for ‘agree’ or ‘disagree’ for each proposal - Each of the participants can vote for each proposal only once
  4. 4. Traditional approach - Server defines API for creating, querying and voting proposals - Hardcoded teacher account to verify for creating proposals - Hardcoded student accounts to verify for voting proposals - Server ensures that no one can vote the same proposal twice - A web frontend
  5. 5. Traditional approach - Server defines API for creating, querying and voting proposals - Hardcoded teacher account to verify for creating proposals - Hardcoded student accounts to verify for voting proposals - Server ensures that no one can vote the same proposal twice - A web frontend Smart contract Smart contract address address DApp Still need this
  6. 6. Some concepts - Private Key: a secret stored by the user for signing transactions and proving user’s identity - Ethereum Address: user’s identifier derived from private key - Smart Contract: code that executes on blockchain, plus storage Or in other words: - Private Key: password for blockchain - Ethereum Address: username for blockchain - Smart Contract: program for blockchain
  7. 7. How does an Ethereum DApp work Browser Your app’s execution environment Your code MetaMask extension Private Key(s) ① ② ③ ④ smart contract Ethereum Blockchain
  8. 8. Demo
  9. 9. Code & References Demo code repo: https://github.com/likecoin/hkos2018-dapp-web Web3 doc: https://web3js.readthedocs.io/en/1.0/index.html Solidity language doc: https://solidity.readthedocs.io/

×