Programming Hyperledger Fabric
Creating Permissioned Blockchains
Siddharth Jain
  • MEAP began June 2020
  • Publication in Spring 2021 (estimated)
  • ISBN 9781617297236
  • 400 pages (estimated)
  • printed in black & white

The author has done justice to it by really starting from the basics and explaining with wit the core concepts and taking the reader slowly to the core of Fabric.

Satej Kumar Sahu
Because blockchain applications store data in immutable decentralized databases, they allow for fast account reconciliation, secure tracking and tracing, transparent records, and no costly third-party auditing—all huge benefits to modern business! Focused on building permissioned, private business applications rather than cryptocurrencies, Programming Hyperledger Fabric teaches you how to build Blockchain applications that are useful and functional in the real world. Using the flexible, modular, and built-for-enterprise Hyperledger Fabric framework, you’ll learn how to develop and effectively deploy enterprise-ready blockchain applications to production across multiple servers in the cloud.

About the Technology

Hyperledger Fabric is a free, open source, and enterprise-grade framework for creating industrial blockchain applications. Fabric has been used to create online marketplaces, transparent insurance claims processes, and supply chain management apps for some of the world’s biggest companies. Its flexible SDK simplifies many challenges of blockchain development, letting developers write smart contracts and build client applications in either Java, JavaScript, or Go. The decentralized architecture of Fabric blockchain apps means that all parties must agree before a change is committed to a shared database—while still preserving privacy and data protection with Fabric’s selective sharing features.

About the book

Programming Hyperledger Fabric is a hands-on guide to developing blockchain applications for enterprise use cases such as supply chains, financial accounting, and logistics. You’ll learn by building a complete decentralized application for tracking products in a pharmaceutical supply chain, setting up infrastructure, securing communications, and establishing consensus chapter by chapter. The book is focused on solving the problems of deploying blockchain apps to production and is filled with reliable tips and tricks for utilizing Docker and other technologies, handling Fabric networks, and troubleshooting Fabric apps. By the time you’re done, you’ll be ready to bring effective and useful business blockchain apps from tomorrow into today.
Table of Contents detailed table of contents

Part 1: The Basics

1 Blockchain Primer

1.1 What is a Blockchain?

1.1.1 How does it all work?

1.1.2 So what’s the big deal?

1.2 Two Types of Blockchains: Permissioned and Permissionless

1.3 What is Hyperledger Fabric?

1.3.1 What is AWS Blockchain, Azure Blockchain Workbench, IBM Blockchain (Oh My!)?

1.4 Why use Blockchain?

1.4.1 Cost of Verification

1.4.2 Cost of Networking

1.4.3 Raising Capital

1.5 How Blockchain Works?

1.6 How Fabric Works?

1.7 Fabric’s ordering service. Introduction to Consensus and CFT vs. BFT

1.8 Blockchain vs. Shared Database

1.9 Bitcoin’s Proof of Work (PoW) and other consensus protocols

1.10 Permissioned vs. Permissionless Blockchains

1.11 Challenges facing Blockchain Technology

1.11.1 Challenges facing permissionless blockchains

1.11.2 Challenges facing permissioned blockchains

1.11.3 Challenges common to both

1.12 Which Blockchain Platform should I use?

1.13 Summary

1.14 Further Reading

2 A Closer look at Fabric

2.1 How are identities managed in Fabric?

2.1.1 Fabric CA

2.1.2 How client application interacts with Fabric CA?

2.1.3 Alternate designs

2.1.4 Idemix Certificates

2.2 Choosing the right database for your key-value store

2.3 Introducing Docker

2.4 Securing communication between machines using Transport Layer Security (TLS) and Client Authentication

2.5 Steps to provision a Fabric network

2.5.1 Collective Decisions

2.5.2 Individual (i.e., per organization) Decisions

2.5.3 Provisioning Steps

2.6 Fabric Consensus and Forks

2.7 Thought Exercise: Is Git a Blockchain?

2.8 Summary

2.9 Further Reading

3 Writing Your First Smart Contract

3.1 The Fabric Codebase

3.2 Defining the problem: Tracking assets through a supply chain

3.3 The Smart Contract Boilerplate: Getting to know Node and Typescript

3.3.1 package.json

3.3.2 Installing dependencies

3.3.3 Main Entry Point

3.3.4 Compiling Typescript

3.3.5 Checking the code for style violations

3.3.6 Running unit tests

3.3.7 Running the smart contract

3.4 Writing the smart contract

3.4.1 create

3.4.2 Buffers

3.4.3 update

3.4.4 verify

3.5 Restrictions on smart contracts

3.6 Summary

3.7 Further Reading

Part 2: Provisioning a Network

4 Provisioning a Local Three Org Test or Development Network

4.1. A Short Primer on Networking

4.2. Generating crypto material

4.3. Generate genesis block

4.3.1. Global vs. Org-specific orderer addresses

4.3.2. Inspecting the genesis block

4.4. Generating channel configuration transaction

4.5. Provisioning the orderer

4.6. Provisioning CouchDB

4.6.1. Advanced (Optional)

4.7. Provisioning peer nodes

4.7.1. Dev vs. Net Mode

4.7.2. Starting peer nodes

4.7.3. Understanding the Internals

4.8. Shutting down and re-starting the network

4.9. Summary

5 Debugging Fabric

5.1. Debugging the orderer with the command line debugger dlv

5.2. Debugging from VS Code

5.3. Limitations of Delve

5.4. Debugging the peer

5.5. Summary

6 Provisioning a Channel and Installing the Chaincode

6.1. Create channel

6.2. Understanding identity verification in Fabric

6.3. Join peers to channel

6.4. Package Chaincode

6.5. Install Chaincode

6.6. Approve Chaincode

6.7. Commit Chaincode

6.8. Understanding Internals of Chaincode Installation and Instantiation

6.8.1. Install Phase

6.8.2 Commit Phase

6.9. Summary

6.10. Further Reading

7 Performing Transactions on the Network

7.1. Launch chaincode and attach VS Code Debugger

7.2. Creating Assets

7.3. Updating Assets

7.4. Verify Assets

7.5. Upgrading the chaincode

7.6. Out of band changes to the world state db

7.7. Understanding the Internals of Chaincode Launch and Registration

7.8. Other ways of debugging chaincode

7.8.1. Using the command-line debugger that comes with Node

7.8.2. Using Launch via NPM configuration in VS Code

7.9. Understanding the Internals of Chaincode Invocation

7.10. Using fabric-network to perform transactions

7.10.1. Update Anchor Peers

7.10.2. Install fabric-network

7.10.3. Create Identity Wallet

7.10.4. Perform Transactions

7.11. Summary

8 Updating channel configuration

8.1. Updating channel configuration

8.2. Summary

9 Dockerizing the Three-Org Network

9.1. Docker Basics

9.1.1. What is Docker and why does it matter?

9.1.2. Docker vs. Moby

9.1.3. Installing Docker

9.1.4. Docker Components

9.1.5. Images, Containers, Host and Services - the building blocks of Docker

9.2. Provision orderer using Docker

9.3. From Zero to Hero with Docker

9.3.1. Container Basics

9.3.2. Inspecting Logs

9.3.3. Where are the Logs?

9.3.4. Log Drivers

9.3.5. Inspecting an image

9.3.6. Cmd vs. Entrypoint

9.3.7. Debugging containers that crash on startup

9.3.8. The Dockerfile

9.3.9. Installing Packages

9.3.10. Building Images

9.3.11. Downloading Images

9.3.12. Listing Images

9.4. Provision peer using Docker

9.4.1. Troubleshooting

9.5. Troubleshooting a chaincode container that won�t start

9.6. Stopping and Re-starting the Network

9.7. Using Docker Compose to provision a network

9.8. Summary

Part 3: Developing Real-World Applications

10 Handling Data Privacy

11 Using Fabric CA for Issuing Identities

12 Securing Communication with TLS

13 Provisioning an OpenLDAP server

14 Deploying to the Cloud


Appendix A: Installing Software and Prerequisites

A.1 Installing Xcode CLI tools

A.2 Installing Homebrew

A.3 Installing Git

A.4 Installing Node

A.5 Installing Go and Delve

A.6 Installing Fabric Source Code

A.7 Installing Docker CE

A.7.1 Mac

A.7.2 Linux

A.8 Installing Fabric Binaries, Samples and Docker Images

A.9 Installing VS Code

A.10 Installing Azure CLI

A.11 Installing SourceTree

A.12 Other tools

A.13 ~/.bash_profile

Appendix B: Bonus Chapter: The Bitcoin

B.1 Anatomy of a Bitcoin transaction

B.1.1 Understanding a cryptographic hash

B.1.2 Public keys and addresses

B.1.3 Digital Signatures

B.1.4 How is the ownership of UTXOs proved?

B.1.5 Transaction Validation

B.1.6 Types of Transactions

B.2 Handling concurrency: The mining network

B.2.1 Why batch transactions into blocks?

B.2.2 Collisions, forks, conflict resolution and the myth of immutability

B.3 Making the ledger secure and tamper-proof: The Proof of Work

B.4 Bitcoin Lab

B.4.1 BlockHeader.ts

B.4.2 Block.ts

B.4.3 Blockchain.ts

B.4.4 Putting it all together

B.4.5 Hacking the blockchain

B.5 Summary

B.6 Further Reading

B.7 Exercises

What's inside

  • Where Fabric fits in to the blockchain landscape
  • The ins and outs of deploying real-world applications
  • Developing smart contracts and client applications in Node
  • Debugging and troubleshooting
  • Securing production applications

About the reader

For experienced software developers. Examples are written in TypeScript. No prior experience with Hyperledger or other blockchain technologies is required.

About the author

Siddharth Jain is a Data Management Fellow at Johnson & Johnson. He holds a Ph.D. in electrical engineering and computer sciences from the University of California, Berkeley and has more than 10 years of experience developing large-scale commercial applications and products, such as Bing Maps, Uber Movement, and other sites such as

placing your order...

Don't refresh or navigate away from the page.
Manning Early Access Program (MEAP) Read chapters as they are written, get the finished eBook as soon as it’s ready, and receive the pBook long before it's in bookstores.
print book $35.99 $59.99 pBook + eBook + liveBook
Additional shipping charges may apply
Programming Hyperledger Fabric (print book) added to cart
continue shopping
go to cart

eBook $33.59 $47.99 3 formats + liveBook
Programming Hyperledger Fabric (eBook) added to cart
continue shopping
go to cart

Prices displayed in rupees will be charged in USD when you check out.

FREE domestic shipping on three or more pBooks