Blockchain Quick Start Guide

Book description

Learn quick and effective techniques to get up and running with building blockchain including Ethereum and Hyperledger Fabric.

Key Features

  • Understand the key concepts of decentralized applications and consensus algorithms
  • Learn key concepts of Ethereum and Solidity programming
  • Practical guide to get started with build efficient Blockchain applications with Ethereum and Hyperledger

Book Description

Blockchain is a technology that powers the development of decentralized applications.This technology allows the construction of a network with no single control that enables participants to make contributions to and receive benefits from the network directly.

This book will give you a thorough overview of blockchain and explain how a blockchain works.You will begin by going through various blockchain consensus mechanisms and cryptographic hash functions. You will then learn the fundamentals of programming in Solidity – the defacto language for developing decentralize, applications in Ethereum. After that, you will set up an Ethereum development environment and develop, package, build, and test campaign-decentralized applications.The book also shows you how to set up Hyperledger composer tools, analyze business scenarios, design business models, and write a chain code. Finally, you will get a glimpse of how blockchain is actually used in different real-world domains.

By the end of this guide, you will be comfortable working with basic blockchain frameworks, and develop secure, decentralized applications in a hassle-free manner.

What you will learn

  • Understand how blockchain hashing works
  • Write and test a smart contract using Solidity
  • Develop and test a decentralized application
  • Build and test your application using Hyperledger Fabric
  • Implement business network using Hyperledger Composer
  • Test and interact with business network applications

Who this book is for

The book is for developers, analysts, or anyone looking to learn about Blockchain in a quick and easy manner.

Table of contents

  1. Title Page
  2. Copyright and Credits
    1. Blockchain Quick Start Guide
  3. About Packt
    1. Why subscribe?
    2. Packt.com
  4. Contributors
    1. About the authors
    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. Conventions used
    4. Get in touch
      1. Reviews
  6. Introduction to Blockchain Technology
    1. The genealogy analogy
      1. Bitcoin
      2. Why Bitcoin
      3. A peer-to-peer network
      4. Cryptography and hash functions
      5. The distributed ledger, blocks, transactions, addresses, and UTXO
    2. The consensus mechanism
      1. Forking
      2. Mining and difficulty level
      3. Hacking – the 51% problem
      4. Private keys and Bitcoin wallets
      5. Bitcoin scripting
      6. Altcoins
      7. Ethereum
    3. Enterprise blockchain – Hyperledger
    4. The evolution of blockchain
    5. Summary
  7. Ethereum Fundamentals
    1. An overview of Ethereum
    2. Ethereum basic concepts
      1. Ether
      2. ERC20 tokens
      3. Smart contracts
      4. Ethereum virtual machines
      5. Ethereum gas
      6. Account
      7. Oracle
      8. Other concepts
    3. Performance
      1. Throughput
      2. Proof-of-Stake (PoS)
      3. Casper
      4. Plasma
      5. Sharding
    4. Summary
  8. Overview of Solidity Programming
    1. What is solidity?
    2. Tools for solidity development environment
      1. Browser-based IDE
        1. Remix
        2. EthFiddle
      2. Command-line development management tools
        1. Truffle
    3. Introduction to smart contracts
      1. Layout of a solidity source file
        1. Pragma
        2. Comments
        3. Import
        4. Paths
        5. Relative paths
      2. Structure of a contract
        1. State variables
        2. Data type
        3. Enum type
        4. Struct type
        5. Mapping
        6. Functions
        7. Input parameters
        8. Access modifiers
        9. Output parameters
        10. Modifiers
        11. Events
        12. Constructor
        13. Constant state variables, unit, and functions
          1. Ether units
          2. Time units
      3. Inheritance, abstract, and interface
    4. Common smart contract patterns
      1. Access restriction
      2. State machine
    5. Smart contract security
      1. Keep contract simple and modular
      2. Use the checks-effects-interactions pattern
      3. DoS with block gas limit
      4. Handle errors in external calls
    6. Case study – crowdfunding campaign
    7. Summary
  9. Building an Ethereum Blockchain Application
    1. Decentralized application overview
      1. web3.js quick overview
      2. Provider
    2. DApp development tools
      1. Truffle
      2. Ganache
    3. Setting up an Ethereum development environment
      1. Installing Truffle
      2. Installing Ganache
      3. Creating a Truffle project
        1. Launching the Ganache environment
    4. Deploying a smart contract
    5. Writing a campaign decentralized application
      1. Selecting a web3 provider
      2. Loading account information
      3. Loading project information
      4. Handling the fund function
      5. checkGoalReached
    6. Summary
  10. Exploring an Enterprise Blockchain Application Using Hyperledger Fabric
    1. Key concepts in Hyperledger Fabric
      1. Ledger
      2. Chaincode
      3. Channel
    2. Core component model
      1. Peers
      2. Membership service provider (MSP)
      3. Certificate authority (CA)
      4. Ordering service
        1. Hyperledger Fabric basic transaction flow
      5. Issuance claim
    3. Setting up a Hyperledger Fabric environment
      1. Installation prerequisites
      2. Installing Hyperledger Fabric
    4. Writing chaincode
      1. Development tools
        1. LiteIDE 
        2. JetBrains Gogland
        3. Visual Studio Code
      2. Chaincode key concept and APIs
      3. Defining an issuance claim
      4. Initializing the chaincode
      5. Invoking the chaincode
      6. AddCompany
      7. ReportLost
      8. RequestedInfo
      9. SubmitClaim, ConfirmClaimSubmission, ApproveClaim
        1. Query
        2. getHistory
    5. Configuring Hyperledger Fabric
      1. Generating the certificate
      2. Generating an orderer genesis block
      3. Generating a channel configuration transaction
      4. Overview of Hyperledger Fabric Docker composer configuration files
      5. Fabric project directory structure
      6. Docker-compose-base.yaml
      7. Peer-base.yaml
      8. Starting the Hyperledger Fabric network
      9. Creating a channel
      10. Joining channels
      11. Updating the anchor
      12. Installing chaincode
      13. Instantiating the chaincode
      14. Invoking add broker
      15. Invoking add insurer
      16. Invoking ReportLost
      17. Invoking RequestedInfo
      18. Invoking SubmitClaim
      19. Invoking ConfirmClaimSubmission
      20. Invoking ApproveClaim
      21. Querying claim history
      22. End-to-end test execution 
    6. Summary
  11. Implementing Business Networks Using Hyperledger Composer
    1. Hyperledger Composer – a quick overview
      1. Yeoman generator
      2. Composer REST server
      3. LoopBack connector
      4. JavaScript SDK
      5. Composer playground
      6. Composer-cli
    2. Setting up a Hyperledger Composer environment
      1. Installation prerequisites
      2. Installing the development environment
    3. Analyzing business scenarios
    4. Business network archive
      1. Network model file (.cto)
      2. Script file (.js)
      3. Access control list (ACL) file (.acl)
      4. Query file (.qry)
      5. Designing business models
    5. Implementing the business transaction function
      1. Testing in the playground
      2. Deploying a business network
      3. Integrating with REST server
      4. Generating the Hyperledger Composer REST API
    6. Summary
  12. Blockchain Use Cases
    1. Blockchain use case examples
      1. Payment and settlement services
      2. Import and export finance
      3. Immutable ledger
      4. Regulatory compliance and auditing
      5. Identity theft detection
      6. Funds back-office operation
      7. Collateral management
      8. Healthcare systems
      9. Real estate trading and rental markets
      10. IP market
      11. Elections
      12. HR and recruiting
      13. Public records
      14. Reduce contract disputes
      15. Sharing economy
      16. Integration with IoT
      17. Facilitate commercial and social relationships
    2. How to choose a proper use case
    3. DApp use case – healthcare data sharing
      1. The business problem
      2. A blockchain solution
    4. Summary
  13. Other Books You May Enjoy
    1. Leave a review - let other readers know what you think

Product information

  • Title: Blockchain Quick Start Guide
  • Author(s): Xun Wu, Weimin Sun
  • Release date: December 2018
  • Publisher(s): Packt Publishing
  • ISBN: 9781789807974