46,44 €
Leverage the power of Hyperledger Fabric to develop Blockchain-based distributed ledgers with ease
Key Features
Book Description
BBlockchain and Hyperledger technologiesare hot topics today. Hyperledger Fabric and Hyperledger Composer are open source projects that help organizations create private, permissioned blockchain networks. These find application in finance, banking, supply chain, and IoT among several other sectors. This book will be an easy reference to explore and build blockchain networks using Hyperledger technologies.
The book starts by outlining the evolution of blockchain, including an overview of relevant blockchain technologies. You will learn how to configure Hyperledger Fabric and become familiar with its architectural components. Using these components, you will learn to build private blockchain networks, along with the applications that connect to them. Starting from principles first, you'll learn to design and launch a network, implement smart contracts in chaincode and much more.
By the end of this book, you will be able to build and deploy your own decentralized applications, handling the key pain points encountered in the blockchain life cycle.
What you will learn
Who this book is for
The book benefits business leaders as it provides a comprehensive view on blockchain business models, governance structure, and business design considerations of blockchain solutions. Technology leaders stand to gain a lot from the detailed discussion around the technology landscape, technology design, and architecture considerations in the book. With model-driven application development, this guide will speed up understanding and concept development for blockchain application developers. The simple and well organized content will put novices at ease with blockchain concepts and constructs.
Das E-Book können Sie in Legimi-Apps oder einer beliebigen App lesen, die das folgende Format unterstützen:
Seitenzahl: 563
Veröffentlichungsjahr: 2018
Copyright © 2018 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the authors, nor Packt Publishing or its dealers and distributors, will be held liable for any damages caused or alleged to have been caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
Commissioning Editor: Sunith shettyAcquisition Editor: Tushar GuptaContent Development Editor: Tejas LimkarTechnical Editor: Dharmendra YadavCopy Editors: Safis EditingProject Coordinator: Manthan PatelProofreader: Safis EditingIndexer: Priyanka DhadkeGraphics: Tania DuttaProduction Coordinator: Deepika Naik
First published: June 2018
Production reference: 1190618
Published by Packt Publishing Ltd. Livery Place 35 Livery Street Birmingham B3 2PB, UK.
ISBN 978-1-78899-452-1
www.packtpub.com
Mapt is an online digital library that gives you full access to over 5,000 books and videos, as well as industry leading tools to help you plan your personal development and advance your career. For more information, please visit our website.
Spend less time learning and more time coding with practical eBooks and Videos from over 4,000 industry professionals
Improve your learning with Skill Plans built especially for you
Get a free eBook or video every month
Mapt is fully searchable
Copy and paste, print, and bookmark content
Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.PacktPub.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at [email protected] for more details.
At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a range of free newsletters, and receive exclusive discounts and offers on Packt books and eBooks.
In my role as the chair of the Hyperledger Technical Steering Committee, I've come to realize the great divide between the enormous hype surrounding blockchain and the depth of understanding of how blockchain technology works, where the technology is on the maturity curve, and how it might be leveraged in the context of the enterprise.
Most of the hype relates to the cryptocurrency aspects of public, permission-less blockchain—ICOs as a substitute for more traditional IPOs, and the potential for disrupting traditional systems of banking, insurance, securities, and so on. It is the potential for disruption and the asymmetric profits that disruption might yield that have driven many to explore how blockchain might be used to one company's advantage over the rest of a given domain. However, what many are discovering is that blockchain is a team sport, and for blockchain to be successful in an enterprise, it demands a degree of industry collaboration not seen before.
The authors of this book take you beyond the hype. They lay a solid foundation for understanding the state of the technology landscape—including active and incubating projects under development at Hyperledger. They provide you with a framework for choosing the right technology platform, designing your solution, and integration with existing systems. And they explain the various governance models for establishing and operating a blockchain business network.
If you are an enterprise architect or developer tasked with developing a blockchain solution for your enterprise or industry, this book is a must-read.
Cheers,
Christopher Ferris IBM Distinguished Engineer, CTO Open Technology IBM Digital Business Group, Open Technologies
Nitin Gaur, as the director of IBM's Blockchain Labs, is responsible forinstituting a body of knowledge and organizational understanding around blockchain technology and industry-specific applications. Tenacious and customer focused, he is known for his ability to analyze opportunities and create technologies that align with operational needs, catapult profitability, and dramatically improve customer experience. He is also an IBM Distinguished Engineer.
Luc Desrosiers is an IBM-certified IT architect with 20+ years of experience. Throughout his career, he has taken on different roles: developer, consultant, and pre-sales architect. He recently moved from Canada to the UK to work in a great lab: IBM Hursley. This is where he had the opportunity to join the IBM Blockchain team. He is now working with clients across multiple industries to help them explore how blockchain technologies can enable transformative uses and solutions.
Venkatraman Ramakrishna is an IBM researcher with 10 years of experience. Following a BTech from IIT Kharagpur and PhD from UCLA, he worked in the Bing infrastructure team in Microsoft, building reliable application deployment software. At IBM Research, he worked in mobile computing and security before joining the Blockchain team. He has developed applications for trade and regulation, and is now working on improving the performance and privacy-preserving characteristics of the Hyperledger platform.
Petr Novotny is a research scientist at IBM Research, with 15+ years of experience in engineering and research of software systems. He received an MSc from University College London and PhD from Imperial College London, where he was also a post-doctoral research associate. He was a visiting scientist at the U.S. Army Research Lab. At IBM, he works on innovations of blockchain technologies and leads the development of blockchain solutions and analytical tools.
Dr. Salman A. Baset is the CTO of security in IBM Blockchain Solutions. He oversees the security and compliance of blockchain solutions being built by IBM in collaboration with partners such as Walmart and Maersk, and interfaces with clients on blockchain solutions and their security. He drives the implementation of the General Data Protection Regulation for blockchain-based solutions. He has also built the identity management system, used by Fortune 500 companies involved in global trade digitization, and IBM Food Trust blockchain solutions.
Anthony O'Dowd works in IBM's Blockchain team. He is based in Europe as part of a worldwide team that helps users build solutions that benefit from blockchain tech. Anthony has a background in middle and back office systems, and has led the development of key IBM middleware in enterprise messaging and integration. He likes to work in different industries to understand how they can exploit middleware to build more efficient, integrated business systems.
If you're interested in becoming an author for Packt, please visit authors.packtpub.com and apply today. We have worked with thousands of developers and tech professionals, just like you, to help them share their insight with the global tech community. You can make a general application, apply for a specific hot topic that we are recruiting an author for, or submit your own idea.
Title Page
Copyright and Credits
Hands-On Blockchain with Hyperledger
Packt Upsell
Why subscribe?
PacktPub.com
Foreword
Contributors
About the authors
Packt is searching for authors like you
Preface
Who this book is for
What this book covers
To get the most out of this book
Download the example code files
Conventions used
Get in touch
Reviews
Blockchain - Enterprise and Industry Perspective
Defining the terms – what is a blockchain?
Four core building blocks of blockchain framworks
Additional capabilities to consider
Fundamentals of the secure transaction processing protocol
Where blockchain technology has been and where it's going
The great divide
An economic model for blockchain delivery
Learning as we go
The promise of trust and accountability
Industries putting blockchain technology to work
Blockchain in the enterprise
What applications are a good fit?
How does the enterprise view blockchain?
Litmus testing to justify the application of blockchain technology
Integrating a blockchain infrastructure for the whole enterprise
Enterprise design principles
Business drivers and evolution
Ensuring sustainability
The principles that drive blockchain adoption
Business considerations for choosing a blockchain framework
Technology considerations for choosing a blockchain framework
Identity management
Scalability
Enterprise security
Development tooling
Crypto-economic models
Decentralization with systemic governance
Enterprise support
Use case-driven pluggability choices
Shared ledger technology
Consensus
Crypto algorithms and encryption technology
Use case-driven pluggable choices
Enterprise integration and designing for extensibility
Other considerations
Consensus, ACID property, and CAP
CAP
ACID
Attestation – SSCs are signed and encrypted
Use of HSMs
Summary
Exploring Hyperledger Fabric
Building on the foundations of open computing
Fundamentals of the Hyperledger project
The Linux Foundation 
Hyperledger
Open source and open standards
Hyperledger frameworks, tools, and building blocks
Hyperledger frameworks
Hyperledger tools
The building blocks of blockchain solutions
Hyperledger Fabric component design
Principles of Hyperledger design
CAP Theorem
Hyperledger Fabric reference architecture
Hyperledger Fabric runtime architecture
Strengths and advantages of componentized design
Hyperledger Fabric – the journey of a sample transaction
Hyperledger Fabric explored
Components in a blockchain network
Developer interaction
Understanding governance in business networks powered by blockchain
Governance structure and landscape
Information technology governance
Blockchain network governance
Business network governance
Summary
Setting the Stage with a Business Scenario
Trading and letter of credit
The importance of trust in facilitating trade
The letter of credit process today
Business scenario and use case
Overview
Real-world processes
Simplified and modified processes
Terms used in trade finance and logistics
Shared process workflow
Shared assets and data
Participants' roles and capabilities
Benefits of blockchain applications over current real-world processes
Setting up the development environment
Designing a network
Installing prerequisites
Forking and cloning the trade-finance-logistics repository
Creating and running a network configuration 
Preparing the network
Generating network cryptographic material
Generating channel artifacts
Generating the configuration in one operation
Composing a sample trade network
Network components' configuration files
Launching a sample trade network
Summary
Designing a Data and Transaction Model with Golang
Starting the chaincode development
Compiling and running chaincode
Installing and instantiating chaincode
Invoking chaincode
Creating a chaincode
The chaincode interface
Setting up the chaincode file
The Invoke method
Access control
ABAC
Registering a user
Enrolling a user
Retrieving user identities and attributes in chaincode
Implementing chaincode functions
Defining chaincode assets
Coding chaincode functions
Creating an asset
Reading and modifying an asset
Main function
Testing chaincode
SHIM mocking
Testing the Init method
Testing the Invoke method
Running tests
Chaincode design topics
Composite keys
Range queries
State queries and CouchDB
Indexes
ReadSet and WriteSet
Multiversion concurrency control
Logging output
Configuration
Logging API
SHIM logging levels
Stdout and stderr
Additional SHIM API functions
Summary
Exposing Network Assets and Transactions
Building a complete application
The nature of a Hyperledger Fabric application
Application and transaction stages
Application model and architecture
Building the application
Middleware – wrapping and driving the chaincode
Installation of tools and dependencies
Prerequisites for creating and running the middleware
Installation of dependencies
Creating and running the middleware
Network configuration
Endorsement policy
User records
Client registration and enrollment
Creating a channel
Joining a channel
Installation of chaincode
Instantiation of chaincode
Invoking the chaincode
Querying the chaincode
Completing the loop – subscribing to blockchain events
Putting it all together
User application – exporting the service and API
Applications
User and session management
Designing an API
Creating and launching a service
User and session management
Network administration
Exercising the application
User/client interaction modes
Testing the Middleware and Application
Integration with existing systems and processes
Design considerations
Decentralization
Process alignment
Message affinity
Service discovery
Identity mapping
Integration design pattern
Enterprise system integration
Integrating with an existing system of record
Integrating with an operational data store
Microservice and event-driven architecture
Considering reliability, availability, and serviceability
Reliability
Availability
Serviceability
Summary
Business Networks
A busy world of purposeful activity
Why a language for business networks?
Defining business networks
A deeper idea
Introducing participants
Types of participant
Individual participants
Organizational participants
System or device participants
Participants are agents
Participants and identity
Introducing assets
Assets flow between participants
Tangible and intangible assets
The structure of assets
Ownership is a special relationship
Asset life cycles
Describing asset's life cycles in detail with transactions
Introducing transactions
Change as a fundamental concept
Transaction definition and instance
Implicit and explicit transactions
The importance of contracts
Signatures
Smart contracts for multi-party transaction processing
Digital transaction processing
Initiating transactions
Transaction history
Transaction streams
Separating transactions into different business networks
Transaction history and asset states
A business network as a history of transactions
Regulators and business networks
Discussing events from the perspective of designing a business network using Composer
A universal concept
Messages carry event notifications
An example to illustrate event structure
Events and transactions
External versus explicit events
Events cause participants to act
Loosely coupled design
The utility of events
Implementing a business network
The importance of de-materialization
Blockchain benefits for B2B and EDI
Participants that interact with the blockchain
Accessing the business network with APIs
A 3-tier systems architecture
Hyperledger Fabric and Hyperledger Composer
Summary
A Business Network Example
The letter of credit sample
Installing the sample
Running the sample
Step 1 – preparing to request a letter of credit
Step 2 – requesting a letter of credit
Step 3 – importing bank approval
Step 4 – exporting bank approval
Step 5 – letter received by exporter
Step 6 – shipment
Step 7 – goods received
Step 8 – payment
Step 9 – closing the letter
Step 10 – Bob receives payment
Recapping the process
Analyzing the letter of credit process
The Playground
Viewing the business network
A description of the business network
The participant descriptions
The asset descriptions
The transaction descriptions
The event descriptions
A model of the business network
Namespaces
Enumerations
Asset definitions
Participant definitions
Concept definitions
Transaction definitions
Event definitions
Examining the live network
Examining a letter of credit instance
Examining participant instances
Examining transaction instances
Submitting a new transaction to the network
Understanding how transactions are implemented
Creating business network APIs
SWAGGER API definitions
Querying the network using SWAGGER
Testing the network from the command line
Creating a new letter using SWAGGER
Network cards and wallets
Access-control lists
Summary
Agility in a Blockchain Network
Defining the promotion process
Smart contract considerations
Integration layer considerations
Promotion process overview
Configuring a continuous integration pipeline
Customizing the pipeline process
Local build
Configuring Travis CI
Customizing the pipeline using .travis.yml
Publishing our smart contract package
Configuring your Git repository
Setting the code owners of our smart contract
Sample content of the CODEOWNERS
Protecting the master branch
Configuring Git for commit signing and validation
Configuring GPG on your local workstation
Testing the end-to-end process
Creating a new transaction
Pushing a commit to the master branch directly
Submitting a pull request with an unsigned commit
Adding test cases
Submitting a pull request with a signed commit
Adding the mergeAssets unit test
Releasing the new version
Updating the network
Notifying the consortium
Upgrading the business network
Downloading a new version
Updating the business network
Summary
Life in a Blockchain Network
Modifying or upgrading a Hyperledger Fabric application
Fabric blockchain and application life cycle
Channel configuration updates
Prerequisites for adding a new organization to the network
Generating network cryptographic material
Generating channel artifacts
Generating the configuration and network components in one operation
Launching the network components for the new organization
Updating the channel configuration
Adding the new organization to the network
Smart contract and policy updates
Modification in chaincode logic
Dependency upgrades in chaincode
Ledger resetting
Endorsement policy update
Upgrading chaincode and endorsement policy on the trade channel
Platform upgrades
System monitoring and performance
Measurement and analytics
What should we measure or understand in a Fabric application
Blockchain applications vis-à-vis traditional transaction processing applications
Metrics for performance analysis
Measurement and data collection in a Fabric application
Collecting health and capacity information
Profiling containers and applications
Measuring application performance
Fabric engineering guidelines for performance
Platform performance characteristics
System bottlenecks
Configuration and tuning
Ledger data availability and caching
Redundant committing peer
Data caching
Fabric performance measurement and benchmarking
Summary
Governance, Necessary Evil of Regulated Industries
Decentralization and governance
Exploring the business models
Blockchain benefits
Supply chain management
Healthcare
Finance – letter of credit
From benefits to profits
Network business model
Founder-led network
Consortium-based network
Community-based network
Hybrid models
Joint venture
New corporation
Role of governance in a business network
Business domains and processes
Membership life cycle
Funding and fees
Regulation
Education
Service life cycle
Disputes
Governance structure
Centralized governance
Strategic governance
Operational governance
Tactical governance
Decentralized governance
Governance and the IT solution
Managed on-boarding
Summary
Hyperledger Fabric Security
Hyperledger Fabric design goals impacting security
Hyperledger Fabric architecture 
Fabric CA or membership service provider
Peer
Smart contract or chaincode
Ledger
Private data
Ordering service
Network bootstrap and governance – the first step towards security
Creating the network
Adding new members
Deploying and updating chaincode 
Data model
Strong identities – the key to the security of the Hyperledger Fabric network
Bootstrapping Fabric CA
Register
Default Fabric roles 
Enroll
Which crypto protocols are allowed in certificate signing requests?
Revoking identities 
Practical considerations in managing users in Fabric CA
Chaincode security
How is chaincode shared with other endorsing peers?
Who can install chaincode?
Chaincode encryption
Attribute-based access control
Pros and cons of attribute-based access control
Common threats and how Hyperledger Fabric mitigates them 
Transaction privacy in Hyperledger Fabric
Channels
Private data
Encrypting transaction data
Hyperledger Fabric and Quantum Computing
General data protection regulation (GDPR) considerations
Summary
The Future of Blockchain and the Challenges Ahead
Summary of key Hyperledger projects
Hyperledger framework – business blockchain technology
Hyperledger tools
Hyperledger Composer
The road ahead for Blockchain
Addressing the divide – the enterprise blockchain and crypto asset-driven ecosystem
Interoperability – understanding business service integration
Scalability and economic viability of the blockchain solution 
Staying engaged with the Hyperledger blockchain 
Summary
Other Books You May Enjoy
Leave a review - let other readers know what you think
We would like to thank our readers in taking time to consume our collective body of work that is representative of our practice, experience, and knowledge gained along the way. This book was motivated by the desire that we and others have had to contribute to the evolution of blockchain technologies. We were also challenged by a lack of a comprehensive guide that addresses myriad considerations, including but not limited to technology design choices, architecture choice, business consideration, and governance models. The authors of this book represent a unique and diverse set of skills, which should be evident in addressing the depth of the content with ease and simplicity. We have collectively focused on organization and flow to ensure not only an easy-to-follow and natural flow but also topical modularity.
The contents of this book are aimed to address a diverse audience, from business leaders to blockchain developers and anyone who would like to learn from practitioners' experience expressed in this book. We believe that not only will the audience enjoy and benefit personally and professionally from the book, but also this book will be used as reference material, a handbook of sorts, and aid in making informed design decisions. We encountered various challenges while writing this book, including our own demanding schedule, but ensured that we deliver up-to date information at the time of release of this content. Blockchain technology landscape is in flux and keeping up with evolution and innovation is a challenge. We have attempted to distill a model that will benefit the reader to create a framework to methodically consume blockchain-related update and build upon the foundation laid out in this book. We have also expended a lot of energy in addressing business design and resulting technology design choices, because unlike other pure technology platforms Blockchain (powered business network), is a very business-specific and technology-centric discipline. We hope the findings and documented considerations from practitioners will arm business leaders and technology managers in making informed decisions and minimizing the failures experienced by the authors.
The technical content covered in this book, aims to provide a solid foundation to a diverse set of skills, including IT professionals, blockchain novices, and advanced blockchain developers. Modeled after a real-world use case, the application development story weaves in various steps from infrastructure creation to Dev-Ops models and model-driven development, covering various enterprise technology management challenges with a focus on the blockchain network-centric impact of application deployment. We have provided a framework for security and performance design, which we hope the technical audience find particularly helpful and establish a solid foundation as a technology design consideration.
We'll conclude the book with a pragmatic view of various challenges and related opportunities, and call for the community of readers to rise up to the challenges and reap the rewards of the resulting opportunities. While this book focuses on and targets Hyperledger projects, we expect the core topics covered in this book to be universally applicable to the blockchain technology discipline. We sincerely hope that our effort in time and acumen is well received by our readers and arm them with a strong foundation to make impactful contributions to progressing the blockchain innovation agenda.
The book benefits business leaders as it provides a comprehensive view on blockchain business models, governance structure, and business design considerations of blockchain solutions. Technology leaders stand to gain a lot from the detailed discussion around the technology landscape, technology design, and architecture considerations in the book. With model-driven application development, this guide will speed up understanding and concept development for blockchain application developers. The simple and well organized content will put novices at ease with blockchain concepts and constructs.
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, with an understanding of the blockchain landscape, 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 Chapter 6 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 many organizations join it and 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, The Future of Blockchain and the Challenges Ahead, looks ahead and discusses the challenges and opportunities that lie ahead. Through the use of open technologies, it invites readers to engage in and promote the blockchain innovation agenda.
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.
Explore the summary and tips in each chapter to get an essence of topics covered.
There are chapters that provide general blockchain business and technology landscape discussions, and there are chapters that go into specific technical how-to. Both are important topics to broaden your knowledge base.
You can download the example code files for this book from your account at www.packtpub.com. If you purchased this book elsewhere, you can visit www.packtpub.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.packtpub.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 athttps://github.com/PacktPublishing/Handson-Blockchain-Development-with-Hyperledger. We also have other code bundles from our rich catalog of books and videos available athttps://github.com/PacktPublishing/. Check them out!
There are a number of text conventions used throughout this book.
CodeInText: Indicates code words in text, database table names, folder names, filenames, file extensions, path names, dummy URLs, user input, and Twitter handles. Here is an example: "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
Any command-line input or output is written as follows:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
4e636f0054fc hyperledger/fabric-peer:latest "peer node start" 3 minutes ago Up 3 minutes 0.0.0.0:9051->7051/tcp, 0.0.0.0:9053->7053/tcp peer0.carrierorg.trade.com
28c18b76dbe8 hyperledger/fabric-peer:latest "peer node start" 3 minutes ago Up 3 minutes 0.0.0.0:8051->7051/tcp, 0.0.0.0:8053->7053/tcp peer0.importerorg.trade.com
9308ad203362 hyperledger/fabric-ca:latest "sh -c 'fabric-ca-se..." 3 minutes ago Up 3 minutes 0.0.0.0:7054->7054/tcp ca_peerExporterOrg
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: "You can apply for a letter of credit by clicking on the Apply button."
Feedback from our readers is always welcome.
General feedback: Email [email protected] and mention the book title in the subject of your message. If you have questions about any aspect of this book, please email us at [email protected].
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.packtpub.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 [email protected] 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.
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 packtpub.com.
Blockchain promises to fundamentally solve the issues of time and trust to address inefficiencies and costs in industries such as financial services, supply chains, logistics, and healthcare. Blockchain's key features include immutability and a shared ledger where transactional updates are performed by a consensus-driven trust system, which can facilitate a truly digital interaction between multiple parties.
This digital interaction is not only bound by systemic trust, but ensures that the provenance of the transactional record maintains an immutable track record of interaction between parties. This very characteristic lends itself to culpability and non-repudiation, and incentivizes fair play. With the blockchain system design, we are attempting to build a system that has implied trust. This trust system leads to reduced risks, and various applied technology constructs such as a cryptography, encryption, smart contracts, and consensus essentially create gates to not only reduce risk but to also infuse added security into the transaction system.
We will be covering the following aspects of blockchain in our discussion for this chapter:
Defining a blockchain
Building blocks of blockchain solutions
Fundamentals of the secure transaction processing protocol
Applications of blockchain
Blockchain in an enterprise
Enterprise design principles
Business considerations for choosing a blockchain framework
Considerations for choosing a blockchain framework
At a technical level, a blockchain can be defined as an immutable ledger for recording transactions, maintained within a distributed network of mutually untrusting peers. Every peer maintains a copy of the ledger. The peers execute a consensus protocol to validate transactions, group them into blocks, and build a hash chain over the blocks. This process forms the ledger by ordering the transactions as is necessary for consistency. Blockchains have emerged with bitcoin (http:// bitcoin.org/) and are widely regarded as a promising technology to run trusted exchanges in the digital world.
A blockchain supporting a cryptocurrency is public, or permissionless, in the sense that anyone can participate without a specific identity. Such blockchains typically use a consensus protocol based on proof of work (PoW) and economic incentives. In contrast, permissioned blockchains have evolved as an alternative way to run a blockchain between a group of known, identified participants. A permissioned blockchain provides a way to secure interactions between a group of entities who share a mutual goal but don't fully trust each other, such as businesses that exchange funds, goods, or information. A permissioned blockchain relies on the identities of its peers, and in so doing can use the traditional Byzantine-fault tolerant (BFT) consensus. BFT is a protocol that has been widely used in IT solutions to reach a consensus on the state of faulty nodes of a network. This protocol is based on the Byzantine General's Problem, whereby a group of general need to reach a consensus on their strategy but one of them maybe treacherous.
Blockchains may execute arbitrary, programmable transaction logic in the form of smart contracts, as exemplified by Ethereum (http://ethereum.org/). The scripts in bitcoin were predecessors of this concept. A smart contract functions as a trusted, distributed application and gains its security from the blockchain and underlying consensus among its peers.
Discerning permissions from a permissionless blockchain is vital for enterprises looking to utilize the blockchain platform. The use case dictates the choice of technology, which depends on consensus systems, governance models, data structure, and so on. With permissioned blockchains, we can do some of the things we already do but in an incrementally better way, which can be significant. In the chart that follows, you can see how a consortium of banks could use Hyperledger, a type of permissioned blockchain, for clearing and settlement without relying on a central clearing house:
Clearing house have been created because banks do not fully trust each other and thus as the intermediary between trades, reduces the risk the one party does not honor his terms leads to a never-ending debate around permissioned versus permissionless blockchains, and while this chapter will not address the debate, blockchain can present a way to either transform or disrupt the current business and business models. Most use cases in regulated industries embark on permissioned blockchain models.
This is due to regulatory requirements and the economic viability of transaction processing, and while permissionless blockchains provide a platform for new business models such as Peer-to-Peer (P2P) transactions and disintermediation-led models, by definition permissionless blockchain architecture relies on a very compute-intensive compute model to ensure transactional integrity. Regardless of the choice in blockchain models, blockchain provides a lot of possibilities for transformation and disruption.
Blockchain has extraordinary potential as a technology platform. In the enterprise, blockchain can provide:
A design approach that keeps transaction data, value, and state inherently close to the business logic
Secure execution of business transactions, validated through a community, in a secure process that facilities the trust and robust transaction processing that are foundational to blockchain
An alternative, permissioned technology that conforms to existing regulations
Blockchain frameworks typically include the following four building blocks:
A shared ledger
: The shared ledger appends only the distributed transaction record. Bitcoin blockchain was designed with the intent to democratize visibility; however, with blockchain, consumer data regulations also need to be considered. Using a properly configured SQL or noSQL distributed database can achieve immutability, or append-only semantics.
Cryptography
: Cryptography in a blockchain ensures authentication and verifiable transactions. Blockchain design includes this imperative because of the focus on assuming computational hardness and making encryption harder for an adversary to break. This is an interesting challenge with bitcoin blockchain because of the economic incentive and its system design. When you're working in a less democratic or permissioned business ledger network, considerations around cryptography change.
Trust systems or consensus
: Trust systems refer to using the power of the network to verify transactions. Trust systems are central to blockchain systems in my view; they are at the heart of blockchain applications, and we believe trust system is the preferred term over
consensus system
since not all validation is done through consensus. This foundational element of trust dictates the overall design and investment in a blockchain infrastructure. With every new entrant in the blockchain space, the trust system is modified, forming variations that are specialized for specific blockchain use cases. Trust, trade, and ownership are staples of blockchain technology. For inter-company transactions, the trust system governs transactions for trade between participating companies. Much work still needs to be done to define the best trust system for specific use cases, such as P2P and sharing economy models with B2B models.
Business rules or smart contracts
: Smart contracts are the business terms that are embedded in a blockchain transaction database and executed with transactions. This is also the rules component of a blockchain solution. It is needed to define the flow of value and state of each transaction.
The following use diagram gives a good idea of these concepts:
The four building blocks are generally accepted and well understood. They have existed for decades prior to blockchain. Shared ledgers are an evolutionary change, similar to the move to computer-based spreadsheets, but the underlying business rules have stayed the same.
What else should be included in enterprise blockchain proposals? Here is a non-exhaustive list of other capabilities to consider:
Auditing and logging
: Including auditing and logging in a blockchain solution can help with addressing regulations for the purposes of non-repudiation, technology root cause analysis, fraud analysis, and other enterprise needs.
Enterprise integration
: It's also worth considering how the solution will be integrated into the enterprise:
Integration with the incumbent Systems of Record
(
SoR
): The goal here is to ensure that the blockchain solution supports your existing systems such as CRM, business intelligence, reporting and analytics, and so forth
Integration as a transaction processing system
: If you want to preserve the system of record as an interim approach to adopting blockchain, integrating it as a transaction processing system makes sense
Design with the intent to include blockchain
: The path of least disruption to your existing systems will accelerate enterprise adoption of blockchain
Monitoring
: Monitoring is an important capability for addressing regulations and ensuring high availability, capacity planning, pattern recognition, and fault identification.
Reporting and regulatory requirements
: Being prepared to address regulatory issues is also very important, even for interim adoption of a blockchain as a transaction processing system. It's recommended that you make connectors to your existing SoR to offload reporting and regulatory requirements until blockchain is enterprise-aware, or the enterprise software is blockchain-aware.
Enterprise authentication, authorization, and accounting
requirements
: In a permissioned enterprise world (unlike permissionless bitcoin blockchains), all blockchain network participants should be identified and tracked. Their roles need to be defined if they are to play a part in the ecosystem.
We mentioned previously that cryptography is one of the core building blocks of a blockchain solution. The fundamental security of the bitcoin blockchain is the elegant cryptographical linkage of all major components of the ledger. Specifically, transactions are linked to each other, mainly through the Merkle tree. A Merkle tree is based on the concept of a tree data structure where every leaf node has a hash calculated of its data and where the non-leaf node have a hash of all of their underlying child. This method provides a way to ensure the integrity of the data, but also provides privacy characteristics by allowing one to remove a leaf that is deemed private but leave the hash, thereby preserving the integrity of the tree. The Merkle tree has its roots incorporated into the block header. The block header includes a reference to the block headers that precede it.
That cryptographically enforced interconnectivity fosters the stability and security of distributed ledgers. At any point, if a link between any of the components is broken, it leaves them exposed to malicious attacks:
Transactions are also cryptographically connected to the rest of the blockchain structure, mainly through the Merkle tree. Once a transaction is modified within a block, with all other parts remaining stable, the link between all transactions of the block and its header are broken:
The new resulting Merkle tree root does not match the one already in the block header, hence providing no connectivity to the rest of the blockchain. If we proceed to change the Merkle tree root in the block's header, we will in turn break the chain of headers and thus the security model of the blockchain itself. Therefore, if we only change the contents of a block, the rest of the blockchain components remain stable and secure, especially as the block headers provide the connecting links by including a hash of the previous block header in the header of the next block.
Blockchain has already been a business disruptor, and I expect it to significantly transform industries, the government, and our lives in the near future.
A significant divided exists between the cryptocurrency and Initial Coin Offering (ICO) world, and the world of regulated business. The latter consists of banks and financial institutions working collectively to assess market potential and operational efficiencies.
Both sides of this division have taken advantage of the momentum around blockchain to further their interests. The blockchain ecosystem has challenged the status quo and defied all odds to make a point—often behaving like an adolescent. It is driven by new business models, promises of disintermediation, and interesting technological innovations. As blockchain gains momentum, the value of bitcoin and other cryptoassets is seeing a meteoric rise, and now that ICO has emerged, it has defied the traditional regulatory framework around fundraising.
On the enterprise side, there are a growing number of industry initiatives around clearing and settlement to enable faster settlement and interbank transfers, transparency through digitization, symmetric dissemination of information in supply chains, and creating adhoc trust between Internet of Things (IoT) devices.
There's a common theme here—that blockchain is here to stay. As it continues to evolve and generate innovative solutions for industry use cases, it will keep inching towards maturity and deliver on its promises of efficiency and significant cost savings built on the foundation of trust.
Business networks, underpinned by blockchain technology, may bring transformation or disruption to industries, but in any case, in order to thrive, blockchain needs an economic model. If disruption is the aim, investments in technology, talent, and market synergy can be combined with the lure of economic incentives. ICOs, for example, typically rely on tokenomics, a term that describes the economic system of value generation in those networks. The token is the unit of value created by the system or network, either through making a platform for providers or consumers, or through co-creating a self-governing value network in its business model that various entities can use to their advantage for creating, distributing, and sharing rewards that benefit all stakeholders.
The ICO front, largely funded by cryptocurrencies, has defied current fundraising mechanisms in venture capitalism (led by crowdfunding projects), and, importantly, the struggle to discern the difference between a security and utility coin is disruptive in principle.
ICOs are looking to create an economic system built on the principles of decentralization, open governance (or self-governance), and transparency, a system that rewards innovation and eradicates disintermediation. ICOs saw some initial failures and some successes, but they nevertheless provided a preview of the future, where cryptoassets will become a basic unit of value—with valuation and fungibility defined by the network they originate from—fueling an economy built for and around innovation.
On the enterprise front, there's been more focus on understanding the technology and reimagining ecosystems, business networks, regulations, confidentiality and privacy, and the business models that impact blockchain networks in various industries. Enterprises looking to explore blockchain want to see quick proof points, use cases that can demonstrate results quickly and help them innovate with blockchain.
Blockchain is helping industries move to a more symmetric dissemination of information by providing built-in control of transactional data, provenance, and historical context. This can lead to more efficient workflows and transformed business processes. Many early projects, however, didn't focus on the core tenets of blockchain, leading to disintermediation, decentralization, and robust self-governance models. There's a good reason for it, though: industries and conventional businesses tend to be focused on their current business agenda, models, growth, and preceding all, regulatory compliance and adherence. This emphasis on current business operations means they're not naturally inclined towards disruptive models.
With any new technology, there is always a learning curve. As blockchain evolved and we began to work with regulated industries, we quickly recognized that in such industries, there are important design considerations to address, things such as confidentiality, privacy, scalability, and performance. These elements can have significant cost implications when it comes to designing blockchain networks, as well as the business models that govern these networks. These challenges have not only been interesting to solve; they've had a positive effect on conventional, regulated industries and businesses by re-energizing innovation in these organizations and inviting the best talent to join in tackling these challenges. Businesses are seeing that ecosystems and networks driven by blockchain technology will contribute to progress and success.
Permissioned networks (regulated, conventional, and enterprise business networks) may also need to begin uncovering an incentive model to motivate organizations to join a platform that promotes the idea of creation, distribution, and sharing of rewards, benefiting all stakeholders. The economic incentives behind tokenomics can't be blindly adopted by a lot of conventional businesses and industries, but that doesn't mean those industries shouldn't start the journey of exploring possible business models that will enable value creation and elevate some desperately needed modernization efforts.
Blockchain technology promises to be the foundation for a secure transaction network that can induce trust and security in many industries that are plagued with systemic issues around trust and accountability. From a technology point of view, blockchain facilitates a system of processing and recording transactions that is secure, transparent, auditable, efficient, and immutable. These technology characteristics lend themselves to addressing the time and trust issues that current-day distributed transaction systems are plagued with.
Blockchain fundamentally shifts the multi-tier model to a flat-tier transaction processing model. This carries the promise to fundamentally disrupt industries by disintermediation, by inducing efficacy in new system design or simply by creating new business models.
Disintermediation indicates reducing the use of intermediaries between producers and consumers, such as by investing directly in the securities market rather than going through a bank. In the financial industry, every transaction has historically required a counter party to process the transaction. Disintermediation involves removing the middleman, which by definition disrupts the business models and incentive economies that are based on mediation. There's been a wave of disruption in recent years as a result of digital technologies, which have, in turn, been driven by marketing insights and the desire for organizations to provide a richer user experience.
Blockchain is a technology that aims to catapult this disruption by introducing trade, trust, and ownership into the equation. The technology pattern represented by blockchain databases and records has the potential to radically improve banking, supply chains, and other transaction networks, providing new opportunities for innovation and growth while reducing cost and risk.
Let's briefly look into blockchain use cases:
Now that we've looked at where blockchain is emerging in various industries, let's talk about what principles should guide the use of blockchains in an enterprise. Why would an enterprise want to apply blockchain technology to one of its systems or applications?
Organizations will need to establish criteria for use during the application design process to help them assess where they can best apply blockchain technology. The following are some examples of criteria that could help an enterprise determine which applications or systems would benefit from it:
Applications that adhere to trade, trust, and ownership
: As described previously, these three tenets—trade, trust and ownership
—
are fundamental to any blockchain system. Trade and ownership imply the churn and the transfer of ledger entries, while trust points to the trustless nature of a transaction system.
Applications that are fundamentally transactional in nature
: There is often a debate about why we can't achieve the benefits of blockchain from a distributed database, that is, a no-SQL or a relational database. But a multi-party transaction is what makes an application suitable for blockchain. There needs to be long-running processes with numerous micro-transactions that will be verified and validated by the blockchain-powered transaction system. H
owever, d
atabases can still be used for persistence or replication to fit enterprise systems. Other considerations include small data set sizes that could increase over time, logging overhead, and so on.
Business networks that are comprised of non-monopolistic participants
: This third criteria addresses distributed versus decentralized computation models. Blockchain trust systems can work within any model; however, the trust aspect of a blockchain business network comes from multi-party participants with non-monopolistic participation (the consortium permissioned network model). Oligopolistic participation might be acceptable (the private permissioned network model), but it's essential to devise a trust model that assures the prevention of centralized control, even with rational behavior of the participants. Many internal use cases do not adhere to this principle and are more for distributed application models.
For enterprises trying to either understand or determine where to employ blockchain meaningfully, there's a simple approach to thinking through use case selection. An appropriate use case for a sustainable blockchain solution will achieve long-term business objectives and provide a strong return on technology investment.
This starts with an enterprise problem—an issue big enough for the enterprise to expend resources/time—and the recognition of cohorts that have the same problem. When companies realize that an enterprise problem is also an industry problem (such as security lending, collateral lending, and so on), they've found a use case where the promise of blockchain has the most potential.
While organizations are determining the benefits of various aspects of blockchain for their enterprise applications, they also need to recognize the fragmentation of the whole blockchain landscape. There are numerous innovative approaches available for solving a specific challenge with blockchain. A lot of vendors offer variants of the trust system that are specialized to address particular use cases, and they've defined the use cases that will benefit most from blockchain in a given industry, for example. Such specialized vendors often promise a fast solution to meet consumer demands for quick digital interactions.
The tenets of blockchain can be instrumental in delivering rapid consumer-driven outcomes such as decentralized, distributed, global, permanent, code-based, programmable assets, and records of transactions. We should exercise caution with regards to thinking of blockchain as a hammer to solve every enterprise application challenge, but it can be of use in many transactional applications.
Now, let's discuss how blockchain is perceived in the enterprise and some of the challenges that arise with enterprise adoption of the technology. In the following section, I'll focus on three areas that help set the tone for blockchain in an enterprise context.
Radical openness is an aspect of blockchain as a digital trust web, but in an enterprise, it's vital to consider the impact and implications of radical openness.
A public blockchain can operate with extreme simplicity, supporting a highly distributed master list of all transactions, which is validated through a trust system supported by anonymous consensus. But can enterprises directly apply the model of the trustless system without modifying the fundamental tenets of blockchain?
Do organizations view this disruptive technology as a path to their transformation or merely a vehicle to help them improve their existing processes to take advantage of the efficiencies that the trust system promises? No matter what, enterprises will want the adoption of blockchain to be as minimally disruptive to the incumbent system as it can be, and that won't be easy to achieve! After all, the design inefficiencies of the incumbent system are what have compelled the enterprise to consider this paradigm shift. A lot of the concepts and use cases for blockchain are still distant from enterprise consumption.
The first industry to experiment with and adopt blockchain was the financial services sector, as it has been facing down the fear of being disrupted by another wave of start-ups. Like many industries, it is also driven by consumer demands for faster, lower-cost transactions. Financial services has a well-defined set of use cases including trade financing, trade platform, payment and remittance, smart contracts, crowd funding, data management and analytics, marketplace lending, and blockchain technology infrastructure. The uses for blockchain we've seen in this industry will likely permeate to other industries such as healthcare, retail, and the government in the future.
The blockchain is a nascent technology that brings together a lot of good ideas, but it still has some maturing to do for enterprise use. The lack of defined standards to promote interoperability between multi-domain chains could be a challenge. Enterprises that adopt it will therefore need to build competency so that they can contribute to further innovation and help with necessary blockchain standards development. This, in turn, could help bring unique opportunities to both improve existing business practices and develop new business models built in a blockchain-powered trust web:
Fundamentally, blockchain addresses three aspects of the transaction economy:
Trade
Ownership
Trust
The notable technology elements of blockchain are:
Technology behind the trust system
: Consensus, mining, and the public ledger
Secret communication on open networks
: Cryptography and encryption
Non-repudiation systems
: Visibility to stacks of processes
While the implications of blockchain technology may be profound, organizations should devise a set of enterprise-specific criteria that can be applied to existing or new projects that may gravitate towards enterprise blockchains.
Given the versatility of blockchain technology and the current hype curve, enterprises should use a chain decision matrix as a tool to ensure that they have a structured approach to apply a foundational technology to a business domain. This approach will also lend itself to a consistent blockchain infrastructure and trust system management, which will prove vital as many application-driven chains evolve and the demand for enterprise visibility, management, and control grow.
Any enterprise adoption of blockchain should have the goal of disrupting incumbent systems. Thinking about integration with enterprise systems of record is one way to work towards this. In this manner, an enterprise can implement blockchain-driven transaction processing and use its existing systems of record as an interface to its other applications, such as business intelligence, data analytics, regulatory interactions, and reporting.
It's vital to separate the infrastructure for enterprise blockchain technology from the business domain that uses chain technology to gain competitive advantage. Blockchain can be seen as an enterprise chain infrastructure that's invisible to businesses and operating behind the scenes, while promoting the interprise synergy between various business-driven chains. The idea is to separate the business domain from the technology that supports it. A chain application ought to be provisioned by a business domain that has a suitable trust system. The trust system, as I've stated repeatedly, is central to any blockchain endeavor, and therefore it should be appropriate to the needs of a given business application. The cost of the infrastructure and compute requirements will be dictated by the choice of trust system available to an enterprise.
By separating out the blockchain technology infrastructure, designing an architecture around a pluggable trust system by using trust intermediaries and a design that promotes flexibility, and a modular trust system, the business can focus on the business and regulatory requirements, such as AML, KYC, nonrepudiation, and so on. The technology infrastructure for blockchain applications should be open, modular, and adaptable for any blockchain variant, thereby making the blockchain endeavor easy to manage.
Interprise synergy suggests driving synergies between numerous enterprise blockchains to enable inter and intra enterprise chain (interledger) connections. In this model, the transactions would cross the various trust systems, giving visibility into the interactions to enterprise governance and control systems. Fractal visibility and the associated protection of enterprise data are important to consider when looking at these interactions between business units and external enterprises. An invisible enterprise chain infrastructure can provide a solid foundation to evolve enterprise connectors and expose APIs to make incumbent systems more chain-aware.
Interprise synergy will flourish due to conditional programmable contracts (smart contracts) between the business chains:
How can an enterprise know if it is ready for blockchain? More importantly, when considering blockchain consumption, should its focus be on integration with incumbent transaction systems, or an enterprise-aware blockchain infrastructure?
To take full advantage of the promise of enterprise blockchain, an integrated enterprise will need more than one use case and will need to drive interprise synergy. The most successful blockchain consumption strategy should focus on technology initially and then consider integration with existing enterprise business systems. This will facilitate collective understanding and accelerate enterprise adoption of the blockchain, hopefully on the path of least disruption.
As stated previously, blockchain technology promises to be the foundation for a secure transaction network that induces trust and security in industries that are plagued with systemic issues around trust and accountability. It aims to generate market and cost efficiencies.
