Preface
This Learning Path is your easy reference for exploring and building blockchain networks using Ethereum, Hyperledger Fabric, and Hyperledger Composer. It begins with an overview of blockchain and shows you how to set up an Ethereum development environment for developing, packaging, building, and testing campaign-decentralized applications. You'll learn Solidity – the de facto language for developing decentralized applications in Ethereum. You'll configure the Hyperledger Fabric and use these components to build private blockchain networks and applications that connect to them. Starting with the principles first, you'll learn to design and launch a network, implement smart contracts in chaincode, and much more.
By the end of this Learning Path, you'll be able to build and deploy your own decentralized applications by handling the key pain points encountered in the blockchain life cycle.
Who This Book Is For
This Learning Path is designed for blockchain developers who want to build decentralized applications and smart contracts from scratch using Hyperledger. A basic familiarity or exposure to any programming language will be useful to get started with this course.
What This Book Covers
Chapter 1,  Blockchain - Enterprise and Industry Perspective, you've heard about blockchain and you are wondering, what is all the fuss about? In this chapter, we explore why blockchain is a game changer, what innovation it brings, and what the technology landscape is.
Chapter 2,  Exploring Hyperledger Fabric, starts with an understanding of the blockchain landscape, then we turn our attention to Hyperledger Fabric. The aim of this chapter is to walk you through the deployment of each component of Hyperledger Fabric while unveiling/building the architecture.
Chapter 3, Setting the Stage with a Business Scenario, describes a business use case and then focuses on understanding the process of creating a good business network, using blockchain from requirements to design.
Chapter 4,  Designing a Data and Transaction Model with Golang, aims to define what makes up a smart contract in Hyperledger Fabric. It will also introduce you to some terms regarding smart contracts and get you to experience the development of a chaincode using the Go language.
Chapter 5, Exposing Network Assets and Transactions, leveraging the smart contract written in the previous chapter, this chapter looks at the required integration of application to the network. It takes the readers through the process of configuring a channel, and installing and invoking chaincode, from a client application and considers the various integration patterns that might be used.
Chapter 6, Business Networks, has an objective to introduce and uncover the skills and tools needed to model a business network. Working at a higher level of abstraction, the foundation, tools, and framework will provide the reader with a way to quickly model, design, and deploy a complete end-to-end business network.
Chapter 7, A Business Network Example, putting the concepts of the previous chapter into practice, this chapter walks through the steps to deploy a full business network from end-user application to smart contracts.
Chapter 8, Agility in a Blockchain Network, focuses on the aspects required to maintain agility in a blockchain network. Applying DevOps concepts, the reader is presented with a continuous integration / continuous delivery pipeline.
Chapter 9, Life in a Blockchain Network, aims to raise the reader's awareness on the key activities and challenges that organizations and consortium may face when adopting a distributed ledger solution, ranging from management of application changes to maintenance of adequate performance levels. A successful network deployment will hopefully see that many organizations join it and that the number of transactions increase.
Chapter 10, Governance –The Necessary Evil of Regulated Industries, governance is a necessary evil for regulated industries, but governance is not required only for business network that deal with use cases for regulated industries. It is also a good practice to ensure longevity and scalability of a business network. This chapter explores vital considerations for production readiness for any founder-led blockchain network.
Chapter 11,  Hyperledger Fabric Security, lays the foundation for security design of blockchain networks. Various security constructs are discussed and Hyperledger Fabric security is explained in detail. An essential chapter to understand security design considerations.
Â
Chapter 12, Introduction to Blockchain Technology, gives an overview of the key concepts, such as cryptography and hash algorithms, the distributed ledger, transactions, blocks, proof of work, mining, and consensus. We cover Bitcoin, the mother of blockchain technology, in detail. We briefly introduce Ethereum by pointing out some limitations of Bitcoin and how they are addressed by Ethereum. While Bitcoin and Ethereum are examples of public blockchains, IBM's Hyperledger is used as an example of enterprise blockchains. Toward the end of this chapter, we look at the evolution of blockchain, through 1.0, 2.0, 3.0, and beyond, and we examine their use cases.
Chapter 13, Ethereum Fundamentals, covers the basic concepts of Ethereum, such as smart contracts, ether, consensus algorithms, EVM, gas, and accounts. We will discuss Ethereum performance and review ideas on how to improve the overall performance via proof of work, casper, plasma, and sharding.
Chapter 14, Overview of Solidity Programming, discusses what solidity is, as well as the tools for the solidity development environment. We then discuss smart contracts and their common patterns. We cover the important topic of smart contract security. Finally, we show how to write a smart contract with a use case of crowdfunding.
Chapter 15, Building an Ethereum Blockchain Application, looks at what a DApp is. We give a quick overview of web3.js. We explain how to set up an Ethereum development environment, as well as how to develop and test a DApp.
Chapter 16, Exploring an Enterprise Blockchain Application Using Hyperledger Fabric, gets into the key concepts of Hyperledger Fabric, along with the core components. We explain how to create a Hyperledger Fabric environment, how to write a chaincode, and how to set up Hyperledger Fabric configuration.
Chapter 17, Implementing a Business Network Using Hyperledger Composer, provides an overview of Hyperledger Composer and talks about how to set up a Hyperledger Composer environment. We discuss business scenarios, the business network archive, and how to implement a business transaction function.
Chapter 18, Blockchain Use Cases, first talks about popular blockchain use cases across industries, including the financial sector, civil services, supply chains, the Internet of Things (IoT), and healthcare, at a high level. We will then proceed to a discussion of the proper use cases for DApps, before then developing a successful DApp. Finally, we take the health data-sharing use case and comment at a high level on building a DApp for it.
Â
Â
Â
Â
Â
Â
Â
Â
To Get the Most out of This Book
We've focused on organization and flow. The content is made to ensure not only an easy-to-follow and natural flow but also topical modularity. Each chapter explores a facet of blockchain. While Hyperledger projects are specifically discussed, the core areas of focus are universal to blockchain technology discipline.
This learning path aims to be a development path into the world of blockchain technology. The chapters are arranged to ensure that they can be followed easily and flow naturally.
Business users can skip the chapters with detailed descriptions on how to develop blockchain applications and, instead, focus on the chapters with general descriptions of the technology and use cases.
It is recommended that IT users download the code and make modifications for adopting to their own use cases or exercises.
Download the Example Code Files
You can download the example code files for this book from your account at www.packt.com. If you purchased this book elsewhere, you can visit www.packt.com/support and register to have the files emailed directly to you.
You can download the code files by following these steps:
- Log in or register at www.packt.com.
- Select the
SUPPORT
tab. - Click on
Code Downloads & Errata
. - Enter the name of the book in the
Search
box and follow the onscreen instructions.
Once the file is downloaded, please make sure that you unzip or extract the folder using the latest version of:
- WinRAR/7-Zip for Windows
- Zipeg/iZip/UnRarX for Mac
- 7-Zip/PeaZip for Linux
Â
The code bundle for the book is also hosted on GitHub at https://github.com/PacktPublishing/Blockchain-Development-with-Hyperledger. In case there's an update to the code, it will be updated on the existing GitHub repository.
We also have other code bundles from our rich catalog of books and videos available at https://github.com/PacktPublishing/. Check them out!
Conventions Used
Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: "The orderer belongs to its own organization called TradeOrdererOrg
."
A block of code is set as follows:
- &ExporterOrg Name: ExporterOrgMSP ID: ExporterOrgMSP MSPDir: crypto-config/peerOrganizations/exporterorg.trade.com/msp AnchorPeers: - Host: peer0.exporterorg.trade.com Port: 7051
When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:
pragma solidity ^0.4.15;
import 'zeppelin/contracts/math/SafeMath.sol';
….
contract ExampleCoin is ERC20 {
//SafeMath symbol is from imported file SafeMath.sol'
using SafeMath for uint256;
…
}
Any command-line input or output is written as follows:
mkdir ~/insurance-claim && cd ~/insurance-claim
Bold: Indicates a new term, an important word, or words that you see onscreen. For example, words in menus or dialog boxes appear in the text like this. Here is an example: "When the preceding request is validated by mining nodes, the HelloWorld
 smart contract is invoked."
Â
Â
Note
Warnings or important notes appear like this.
Note
Tips and tricks appear like this.
Get in Touch
Feedback from our readers is always welcome.
General feedback: If you have questions about any aspect of this book, mention the book title in the subject of your message and email us at customercare@packtpub.com
.
Errata: Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you have found a mistake in this book, we would be grateful if you would report this to us. Please visit www.packt.com/submit-errata, selecting your book, clicking on the Errata Submission Form link, and entering the details.
Piracy: If you come across any illegal copies of our works in any form on the Internet, we would be grateful if you would provide us with the location address or website name. Please contact us at copyright@packt.com
with a link to the material.
If you are interested in becoming an author: If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, please visit authors.packtpub.com.
Reviews
Please leave a review. Once you have read and used this book, why not leave a review on the site that you purchased it from? Potential readers can then see and use your unbiased opinion to make purchase decisions, we at Packt can understand what you think about our products, and our authors can see your feedback on their book. Thank you!
For more information about Packt, please visit packt.com.