Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Developing Blockchain Applications

115 views

Published on

Getting Started with Ethereum Development.
Slides from dev workshop at Blockchain Expo North America.

Published in: Technology
  • Be the first to comment

  • Be the first to like this

Developing Blockchain Applications

  1. 1. Developing Blockchain Applications November 28, 2018 getting started with ethereum
  2. 2. our goal today 1. Understand how Ethereum applications work 2. Understand the framework and how projects are structured 3. Write and deploy code
  3. 3. few questions before we start… • Have you transacted ETH? • Do you know what dapps are? • Have you used a dapp? • Have you written a smart contract or developed a dapp?
  4. 4. Part 1: Ethereum Architecture and how do Ethereum apps work?
  5. 5. Some Definitions… Ethereum Network Collection of nodes that transact Ether and store data Node Any computer running the Ethereum client Ethereum Client Piece of software that communicates with Ethereum Network
  6. 6. Client-Server Architecture
  7. 7. Tale of an ebay seller… • Can the seller take their ratings and feedback history and join another online marketplace? • Should they be able to? • What’s the incentive for ebay to make this possible? • An ebay seller with excellent ratings • ebay bans the seller for violation of their T&Cs • Let’s assume that the seller was not at fault but they were banned/suspended anyway
  8. 8. Centralized vs. Decentralized Apps Centralized (Client-Server) Decentralized (Dapps) Logic Cluster of servers contain the entire logic. All logic is contained in the contract. Once the contract is mined, all nodes have the exact same logic, saved on their copy of the blockchain. Data Integrity Maintained by strict set of rules enforced by the infrastructure, tools, and services. Taken care via redundancy of the nodes in the network.
  9. 9. Dapp Architecture
  10. 10. Dapp Architecture
  11. 11. Metamask Metamask is a Google Chrome extension that makes Chrome an Ethereum connected browser. https://metamask.io/
  12. 12. Getting Metamask • Go to https://metamask.io/ • Get Chrome Extension • Add to Chrome • Launch Metamask and follow the setup guide
  13. 13. Funding Metamask with Ether Click Buy
  14. 14. Funding Metamask with Ether
  15. 15. Donating back to Faucet
  16. 16. Mist Browser • https://github.com/eth ereum/mist/releases • Simply download and install the executable for your OS
  17. 17. Dapp Examples Ethlance Ethlance is a decentralized freelancer platform for the exchange of work for Ether, rather than traditional currencies. https://ethlance.com/
  18. 18. Dapp Examples Swarm City Swarm City is a decentralized P2P sharing economy. Some have called it Uber or Craigslist on the blockchain. It requires users to have a Swarm City Token in order to pay for transactions in the ecosystem. https://swarm.city/
  19. 19. Dapp Examples WeiFund WeiFund is a crouwdsourcing app on the Ethereum Ecosystem. http://weifund.io/
  20. 20. Dapp Architecture
  21. 21. Dapp System Architecture
  22. 22. IPFS
  23. 23. How is Ethereum different from Bitcoin blockchain? Bitcoin Ethereum Bitcoin uses a simple scripting system for transactions. Bitcoin script is simple, stack-based, and is intentionally not Turing-complete, with no loops. Ethereum platform is built with a Turing- complete language. Send bitcoin from Alice to Bob Send ether from Alice to Bob if… • Bob’s balance is less than 2 eth • Date > 2019/01/01
  24. 24. Ethereum Accounts • External • Contract
  25. 25. Part 2: Dev Setup Install the tools and understand the framework
  26. 26. Ecosystem, tools, terms, products… ETH Ethereum networks’ native crypto-currency EVM Ethereum Virtual Machine providing decentralized computation service Swarm Provides P2P file sharing and storage services Whisper Protocol used by nodes to communicate with each other Solidity, Serpent, LLL Smart contract programming languages eth, geth, pyethapp Main ethereum software written in C++, Go, Python respectively.
  27. 27. Serverless Stack Whisper Encrypted messaging protocol that allows nodes to send messages directly to each other in a secure way; hides sender and receiver identity from snoopers Swarm P2P file sharing, similar to BitTorrent, but rewarded with micropayments of ETH (Storage Layer) Ethereum Virtual Machine (EVM) Runs the contract logic
  28. 28. There are many different Ethereum Networks • One main Ethereum network – used for deployment of production applications • Test Networks – Ropsten, Rinkeby, Kovan • Private Network on your own computer • Create your own network and open it for others to use.
  29. 29. Test Networks Ropsten • Resembles the main network • Uses Proof of Work consensus algorithm • Supported by Geth and Parity • https://ropsten.etherscan.io/ Rinkeby • Uses Proof of Authority; you need to prove your existence (social media) to retrieve ethers • All ethers are already mined and only distributed on demand • Supported by Geth • https://rinkeby.etherscan.io/ Kovan • Uses Proof of Authority; requires Github account • Supported by Parity • https://kovan.etherscan.io/
  30. 30. Tools we need Node Packet Manager (npm) NPM is a package manager for Node.js packages and modules Ganache • Ethereum client for testing and development • Runs locally and simulates a full Ethereum client • Fast • Well supported ecosystem of tools Truffle • Dev environment, testing framework, and asset pipeline for Ethereum • Helps deploy contracts to the blockchain • Help connect front-end to your deployed contracts MetaMask • Ethereum light client • Allows you to interact with Dapps via Chrome
  31. 31. Development workflow 1. Download and start an ethereum node 2. Code and compile your smart contract 3. Deploy your compiled contract on the network using a framework like truffle 4. Call stuff in the contract using web3.js
  32. 32. NPM • Download and install Node https://nodejs.org/
  33. 33. Install Ganache • https://truffleframework.com/ganache
  34. 34. Launch Ganache
  35. 35. Install Truffle • https://truffleframework.com/truffle
  36. 36. Part 3: Code and Deploy Code your first smart contract and deploy it on blockchain
  37. 37. Setting up your project Ømkdir HelloEth Øcd HelloEth Øtruffle init
  38. 38. workflow truffle compile This command compiles the contracts in your contracts folder and will create artifacts (JSON files) that contain the bytecode that can be executed on the network. truffle migrate Deploy the contract on your test network. Migrations are scripts that follow a series of steps that are needed to deploy your contracts and setup the projects like you need them to setup. truffle console To inspect the contract
  39. 39. workflow truffle compile This command compliles the contracts in your contracts folder and will create artifacts (JSON files) that contain the bytecode that can be executed on the network. truffle migrate Deploy the contract on your test network. Migrations are scripts that follow a series of steps that are needed to deploy your contracts and setup the projects like you need them to setup. truffle console To inspect the contract
  40. 40. truffle migrate --reset
  41. 41. workflow truffle compile This command compliles the contracts in your contracts folder and will create artifacts (JSON files) that contain the bytecode that can be executed on the network. truffle migrate Deploy the contract on your test network. Migrations are scripts that follow a series of steps that are needed to deploy your contracts and setup the projects like you need them to setup. truffle console To inspect the contract
  42. 42. Truffle 3 Truffle 2
  43. 43. Now that we can call() our contract, let’s create a transaction that changes state.
  44. 44. Get a list of accounts
  45. 45. Get balance
  46. 46. Summary of what we did today 1. Understand how Ethereum applications work 2. Overview of the framework and a small sliver of tools in the ecosystem 3. Wrote and deployed a smart contract
  47. 47. Thank you

×