Mastering Ethereum

Book description

An expert guide to implementing fast, secure, and scalable decentralized applications that work with thousands of users in real time

Key Features

  • Implement advanced features of the Ethereum network to build powerful decentralized applications
  • Build smart contracts on different domains using the programming techniques of Solidity and Vyper
  • Explore the architecture of Ethereum network to understand advanced use cases of blockchain development

Book Description

Ethereum is one of the commonly used platforms for building blockchain applications. It's a decentralized platform for applications that can run exactly as programmed without being affected by fraud, censorship, or third-party interference.

This book will give you a deep understanding of how blockchain works so that you can discover the entire ecosystem, core components, and its implementations. You will get started by understanding how to configure and work with various Ethereum protocols for developing dApps. Next, you will learn to code and create powerful smart contracts that scale with Solidity and Vyper. You will then explore the building blocks of the dApps architecture, and gain insights on how to create your own dApp through a variety of real-world examples. The book will even guide you on how to deploy your dApps on multiple Ethereum instances with the required best practices and techniques. The next few chapters will delve into advanced topics such as, building advanced smart contracts and multi-page frontends using Ethereum blockchain. You will also focus on implementing machine learning techniques to build decentralized autonomous applications, in addition to covering several use cases across a variety of domains such as, social media and e-commerce.

By the end of this book, you will have the expertise you need to build decentralized autonomous applications confidently.

What you will learn

  • Apply scalability solutions on dApps with Plasma and state channels
  • Understand the important metrics of blockchain for analyzing and determining its state
  • Develop a decentralized web application using React.js and Node.js
  • Create oracles with Node.js to provide external data to smart contracts
  • Get to grips with using Etherscan and block explorers for various transactions
  • Explore web3.js, Solidity, and Vyper for dApps communication
  • Deploy apps with multiple Ethereum instances including TestRPC, private chain, test chain, and mainnet

Who this book is for

This book is for anyone who wants to build fast, highly secure, and transactional decentralized applications. If you are an Ethereum developer looking to perfect your existing skills in building powerful blockchain applications, then this book is for you. Basic knowledge of Ethereum and blockchain is necessary to understand the concepts covered in this book.

Table of contents

  1. Title Page
  2. Copyrights and Credits
    1. Mastering Ethereum
  3. About Packt
    1. Why subscribe?
    2. Packt.com
  4. Contributors
    1. About the author
    2. About the reviewers
    3. Packt is searching for authors like you
  5. Preface
    1. Who this book is for
    2. What this book covers
    3. To get the most out of this book
      1. Download the example code files
      2. Download the color images
      3. Conventions used
    4. Get in touch
      1. Reviews
  6. Section 1: Blockchain - Ethereum Refresher
  7. Blockchain Architecture
    1. Beyond Ethereum
      1. Explaining Ethereum
      2. Ethereum's history
      3. Ethereum's development
    2. The EEA
      1. The EEA's vision
      2. The EEA membership
      3. The EEA architecture
    3. Understanding the Ethereum blockchain
      1. The reasoning behind a decentralized blockchain
      2. The blockchain as a set of nodes
      3. The CAP theorem
      4. Introducing the Ethereum Virtual Machine
      5. Introducing the state machine
      6. The P2P network
      7. Consensus rules
      8. Proof-of-work
      9. Proof-of-stake
    4. Workings of smart contracts
      1. Smart contract deployment process
        1. Ethereum transactions
    5. Essential smart contract programming
      1. Solidity
        1. File structure
        2. Variables
          1. Visibility of variables
          2. Uints
          3. Addresses
          4. Strings and bytes
          5. Structs
          6. Enums
          7. Booleans
          8. Arrays
          9. Mappings
          10. Data location
          11. Events
          12. Modifiers
        3. Functions
          1. The fallback function
      2. Vyper
      3. Vyper by example
    6. Summary
  8. Ethereum Ecosystems
    1. Introducing the Ethereum chain specification
      1. The genesis object
    2. Blockchain technology
      1. Application layer
      2. Infrastructure layer
      3. Mining layer
      4. Peer-to-peer layer
        1. Understanding DEVP2P
    3. Blockchain consensus
      1. Introducing blockchain consensus
      2. Envisioning the future
      3. The nothing-at-stake problem
    4. Blockchain economics
      1. Understanding inflation
      2. Evaluating cryptocurrency economics
      3. Determining the value of cryptocurrencies
      4. Ethereum-based tokens
    5. Blockchain metrics
      1. Number of transactions
      2. Address growth
      3. Ether market capitalization
      4. Developer adoption
      5. Miner activity
    6. Summary
  9. Ethereum Assets
    1. Ethereum protocol implementations
      1. Protocol implementations
        1. Understanding Geth
          1. Creating accounts
          2. Downloading the blockchain
          3. Mining with your CPU
        2. Parity
          1. Downloading the blockchain
          2. Creating accounts
          3. Mining with your CPU
      2. Best scenario for each protocol
        1. Smart contract development
        2. Managing accounts
        3. Other use cases
    2. INFURA essentials
      1. Understanding INFURA
      2. Inner workings of INFURA
      3. Using INFURA's dashboard
    3. Decentralized autonomous organizations
      1. Explaining DAOs
      2. Operating within a DAO
      3. Tooling for DAOs
    4. Miscellanea and concerns
      1. Understanding Ethereum improvement proposals
      2. Differentiating the usage of Truffle and IDEs
      3. Understanding smart contract limitations
    5. Creating your own private Ethereum network
      1. Setting up a private blockchain on Mac
      2. Setting up a private blockchain on Windows
    6. Choosing a wallet for Ethereum
      1. Understanding the concept of an Ethereum wallet
      2. Explaining online wallets
        1. Choosing MyEtherWallet
        2. Using MetaMask
      3. Understanding hardware wallets
        1. Using Ledger
        2. Using Trezor
      4. Learning to use multi-signature wallets
    7. Using Etherscan for transactions
      1. Understanding block explorers
      2. Using Etherscan for analyzing transactions
    8. Creating accounts
      1. Creating accounts with MetaMask
      2. Creating an account with Coinbase
    9. Summary
  10. Section 2: Decentralized Application Development Workflow
  11. Mastering Smart Contracts
    1. Getting up to speed
      1. Planning the marketplace idea
      2. Designing the code in Solidity
      3. Deploying your smart contract with Truffle
    2. The EVM in depth
      1. Explaining the EVM
      2. Operation of smart contracts in the EVM
    3. Upgradable and scalable smart contracts
      1. Upgradable smart contracts
        1. Storage smart contracts
        2. Upgradable smart contracts
        3. Proxy smart contracts
      2. Scalable smart contracts
        1. Using state channels for scalable smart contracts
    4. Gas and data-efficient smart contracts
      1. Making gas-efficient smart contracts
      2. Making data-efficient smart contracts
    5. Smart contract security analysis
      1. Techniques to secure a smart contract
    6. Summary
  12. Mastering dApps
    1. Introducing dApp architecture
    2. Installing Ethereum and Truffle
    3. Setting up and configuring Ethereum and Truffle
      1. Installing the required packages
      2. Setting up webpack
      3. Setting up the source folder
    4. Creating dApps
      1. Creating the smart contract
    5. Creating user interfaces
    6. Connecting smart contracts to web applications
      1. Designing the setup form
      2. Implementing the setup function
    7. Summary
  13. Tools, Frameworks, Components, and Services
    1. Using developer tools
      1. Development frameworks
      2. Integrated development environments
      3. Testnet faucets
    2. Understanding Ethereum communication tools
      1. Frontend Ethereum APIs
      2. Backend Ethereum APIs
      3. Application binary interface tools
    3. Making sense of the Ethereum infrastructure
      1. Ethereum clients
      2. Ethereum storage
      3. Ethereum messaging
    4. Learning Ethereum testing and securing tools
      1. Understanding monitoring utilities
      2. Using security testing utilities
      3. Understanding auditing tools
    5. Getting important open source libraries
      1. ZeppelinOS
      2. Using the 0xprotocol
        1. Building a relayer
        2. Becoming market makers
      3. Aragon
        1. AragonPM
        2. AragonOS
        3. AragonJS
        4. AragonUI
        5. AragonCLI
    6. Summary
  14. Deployment on Testnet
    1. Using Ropsten for smart contract development
      1. Features of Ropsten
      2. Getting Ropsten Ether
    2. Understanding Rinkeby with proof-of-authority
      1. Describing proof-of-authority
      2. Getting Rinkeby Ether
    3. Using Kovan for smart contract development
      1. Getting Kovan Ether
    4. Introducing the Mainnet
    5. Summary
  15. Various dApps Integrations
    1. Better React applications
      1. Organizing components properly
      2. Generating components dynamically
      3. Starting up projects faster
    2. Scalable Node.js backends with NGINX
      1. Creating a Node.js server
      2. Getting a hosting solution
      3. Setting up your server on a VPS hosting
      4. Getting a domain name
      5. Setting up NGINX
      6. Adding SSL security
    3. Better web3.js dApps
      1. Setting up a fixed web3.js version
      2. Creating helper functions
      3. Promisifying your functions
      4. Listening to events with web3.js
    4. Building your own Oracles
      1. Building a random generation Oracle
    5. Improving your development workflow
    6. Summary
  16. Decentralized Exchanges Workflow
    1. Introducing decentralized exchanges
      1. Cons of DAXs
      2. Pros of DAXs
      3. Essential trading terms
    2. Understanding the trading and matching engine
    3. Managing cryptocurrency wallets and cold storage
    4. Building the user interface
    5. Building the Ethereum backend
    6. Finishing the dApp
    7. Summary
  17. Section 3: Ethereum Implementations
  18. Machine Learning on the Ethereum Blockchain
    1. Understanding machine learning
    2. Decentralized machine learning marketplaces
    3. Building a smart contract machine learning marketplace
      1. The prediction function
      2. The cost function
      3. The optimization algorithm
      4. The train function
    4. Summary
  19. Creating a Blockchain-based Social Media Platform
    1. Understanding decentralized social media
      1. The initial concept
    2. Creating the user interface
      1. Configuring the webpack style
      2. Setting up the initial structure
      3. Rendering hashtags
      4. Improving the appearance
    3. Building the smart contract
      1. Planning the design process
      2. Setting up the data structures
      3. Documenting the future functions
      4. Implementing the adding content function
      5. Creating the promotion engine
      6. Implementing the getter functions
    4. Finishing the dApp
      1. Setting up the smart contract instance
      2. Decentralizing your data
      3. Creating the hashtag component
      4. Creating the hashtag getter
      5. Creating the publishing functionality
    5. Summary
  20. Creating a Blockchain-Based E-Commerce Marketplace
    1. Creating the user interface
      1. Planning the marketplace interface
      2. Setting up the index page
      3. Configuring the webpack dev server
      4. Creating the Header component
      5. Creating the Home component
      6. Creating the Product component
      7. Creating the Sell component
      8. Creating the Orders component
    2. Understanding ERC-721 tokens
      1. Explaining the ERC-721 functions
      2. The ERC-721 smart contract
    3. Developing the e-commerce smart contract
      1. Creating the publish function
      2. Creating the buy function
      3. Creating the mark orders function
      4. Creating the getter functions
      5. Deploying the smart contract
    4. Finishing the dApp
      1. Setting up the contract instance
      2. Updating the index file
      3. Updating the Buy component
      4. Updating the Sell component
      5. Updating the Orders component
    5. Summary
  21. Other Books You May Enjoy
    1. Leave a review - let other readers know what you think

Product information

  • Title: Mastering Ethereum
  • Author(s): Merunas Grincalaitis
  • Release date: April 2019
  • Publisher(s): Packt Publishing
  • ISBN: 9781789531374