Book Image

Blockchain with Hyperledger Fabric - Second Edition

By : Nitin Gaur, Anthony O'Dowd, Petr Novotny, Luc Desrosiers, Venkatraman Ramakrishna, Salman A. Baset
Book Image

Blockchain with Hyperledger Fabric - Second Edition

By: Nitin Gaur, Anthony O'Dowd, Petr Novotny, Luc Desrosiers, Venkatraman Ramakrishna, Salman A. Baset

Overview of this book

Blockchain with Hyperledger Fabric - Second Edition is a refreshed and extended version of the successful book on practical Hyperledger Fabric blockchain development. This edition includes many new chapters, alongside comprehensive updates and additions to the existing ones. Entirely reworked for Hyperledger Fabric version 2, this edition will bring you right up to date with the latest in blockchain. Using a real-world Trade Finance and Logistics example, with working code available on GitHub, you’ll really understand both how and why Hyperledger Fabric can be used to maximum effect. This book is your comprehensive guide and reference to explore and build blockchain networks using Hyperledger Fabric version 2. This edition of the book begins by outlining the evolution of blockchain, including an overview of relevant blockchain technologies. Starting from first principles, you’ll learn how to design and operate a permissioned blockchain network based on Hyperledger Fabric version 2. You will learn how to configure the main architectural components of a permissioned blockchain network including Peers, Orderers, Certificate Authorities, Channels, and Policies. You’ll then learn how to design, develop, package, and deploy smart contracts, and how they are subsequently used by applications. This edition also contains chapters on DevOps, blockchain governance, and security, making this your go-to book for Hyperledger Fabric version 2.
Table of Contents (18 chapters)
16
Another Book You May Enjoy
17
Index

Fundamentals of the secure transaction processing protocol

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 every non-leaf node has a hash of all its underlying children.

This method provides us with a way to ensure the integrity of the data, but also provides privacy characteristics by allowing us 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, as shown in the following diagram:

Figure 1.3: Block headers with references to the preceding block headers

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 those 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 is 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.

Figure 1.4: Anatomy of a block