100% found this document useful (6 votes)
26 views66 pages

Download Complete Blockchain Essentials: Core Concepts and Implementations 1st Edition Ramchandra Sharad Mangrulkar PDF for All Chapters

Concepts

Uploaded by

huvindjuly
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (6 votes)
26 views66 pages

Download Complete Blockchain Essentials: Core Concepts and Implementations 1st Edition Ramchandra Sharad Mangrulkar PDF for All Chapters

Concepts

Uploaded by

huvindjuly
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 66

Download Full Version ebookmass - Visit ebookmass.

com

Blockchain Essentials: Core Concepts and


Implementations 1st Edition Ramchandra Sharad
Mangrulkar

https://ebookmass.com/product/blockchain-essentials-core-
concepts-and-implementations-1st-edition-ramchandra-sharad-
mangrulkar/

OR CLICK HERE

DOWLOAD NOW

Discover More Ebook - Explore Now at ebookmass.com


Instant digital products (PDF, ePub, MOBI) ready for you
Download now and discover formats that fit your needs...

Blockchain Essentials: Core Concepts and Implementations


(ePub Convert) 1st Edition Ramchandra Sharad Mangrulkar

https://ebookmass.com/product/blockchain-essentials-core-concepts-and-
implementations-epub-convert-1st-edition-ramchandra-sharad-mangrulkar/

ebookmass.com

Core Concepts in Cardiac Surgery 1st Edition David Taggart

https://ebookmass.com/product/core-concepts-in-cardiac-surgery-1st-
edition-david-taggart/

ebookmass.com

Oracle Database Programming with Visual Basic.NET:


Concepts, Designs and Implementations Ying Bai

https://ebookmass.com/product/oracle-database-programming-with-visual-
basic-net-concepts-designs-and-implementations-ying-bai/

ebookmass.com

Celebrations for the Woolworths Girls Elaine Everest

https://ebookmass.com/product/celebrations-for-the-woolworths-girls-
elaine-everest/

ebookmass.com
Introduction to Computing 1st Edition David A. Joyner

https://ebookmass.com/product/introduction-to-computing-1st-edition-
david-a-joyner/

ebookmass.com

Victorians and Numbers: Statistics and Society in


Nineteenth Century Britain Lawrence Goldman

https://ebookmass.com/product/victorians-and-numbers-statistics-and-
society-in-nineteenth-century-britain-lawrence-goldman/

ebookmass.com

Fachwissen Osteologie 1. Auflage. Edition Andreas Kurth

https://ebookmass.com/product/fachwissen-osteologie-1-auflage-edition-
andreas-kurth/

ebookmass.com

Waiting for the Pieces (Gravity Hill Book 1) Taylor


Wilson-West

https://ebookmass.com/product/waiting-for-the-pieces-gravity-hill-
book-1-taylor-wilson-west/

ebookmass.com

The Wiley Blackwell Companion to Comparative Theology: A


Festschrift in Honor of Francis X. Clooney, SJ 1st Edition
Axel M. Oaks Takacs
https://ebookmass.com/product/the-wiley-blackwell-companion-to-
comparative-theology-a-festschrift-in-honor-of-francis-x-clooney-
sj-1st-edition-axel-m-oaks-takacs/
ebookmass.com
Rethinking Place through Literary Form Rupsa Banerjee

https://ebookmass.com/product/rethinking-place-through-literary-form-
rupsa-banerjee/

ebookmass.com
Blockchain
Essentials
Core Concepts and Implementations

Ramchandra Sharad Mangrulkar
Pallavi Vijay Chavan
Blockchain Essentials
Ramchandra Sharad Mangrulkar • Pallavi Vijay Chavan

Blockchain Essentials
Core Concepts and Implementations
Ramchandra Sharad Mangrulkar Pallavi Vijay Chavan
Mumbai, Maharashtra, India Mumbai, Maharashtra, India

ISBN-13 (pbk): 978-1-4842-9974-6 ISBN-13 (electronic): 978-1-4842-9975-3


https://doi.org/10.1007/978-1-4842-9975-3

Copyright © 2024 by Ramchandra Sharad Mangrulkar and Pallavi Vijay Chavan


This work is subject to copyright. All rights are reserved by the Publisher, whether the whole or part of the material is concerned,
specifically the rights of translation, reprinting, reuse of illustrations, recitation, broadcasting, reproduction on microfilms or in
any other physical way, and transmission or information storage and retrieval, electronic adaptation, computer software, or by
similar or dissimilar methodology now known or hereafter developed.
Trademarked names, logos, and images may appear in this book. Rather than use a trademark symbol with every occurrence of
a trademarked name, logo, or image we use the names, logos, and images only in an editorial fashion and to the benefit of the
trademark owner, with no intention of infringement of the trademark.
The use in this publication of trade names, trademarks, service marks, and similar terms, even if they are not identified as such,
is not to be taken as an expression of opinion as to whether or not they are subject to proprietary rights.
While the advice and information in this book are believed to be true and accurate at the date of publication, neither the authors
nor the editors nor the publisher can accept any legal responsibility for any errors or omissions that may be made. The publisher
makes no warranty, express or implied, with respect to the material contained herein.

Managing Director, Apress Media LLC: Welmoed Spahr


Acquisitions Editor: Smriti Srivastava
Development Editor: Laura Berendson
Coordinating Editor: Shaul Elson

Cover designed by eStudioCalamar


Cover image by [email protected]

Distributed to the book trade worldwide by Apress Media, LLC, 1 New York Plaza, New York, NY 10004, U.S.A. Phone 1-
800-SPRINGER, fax (201) 348-4505, e-mail [email protected], or visit www.springeronline.com. Apress Media,
LLC is a California LLC and the sole member (owner) is Springer Science + Business Media Finance Inc (SSBM Finance
Inc). SSBM Finance Inc is a Delaware corporation.
For information on translations, please e-mail [email protected]; for reprint, paperback, or audio rights,
please e-mail [email protected].
Apress titles may be purchased in bulk for academic, corporate, or promotional use. eBook versions and licenses are also
available for most titles. For more information, reference our Print and eBook Bulk Sales web page at http://www.apress.com/
bulk-sales.
Any source code or other supplementary material referenced by the author in this book is available to readers on GitHub (https://
github.com/Apress). For more detailed information, please visit https://www.apress.com/gp/services/source-code.

Paper in this product is recyclable


To our cherished daughter, Mansi:
Your unwavering support, encouragement, and constant
sympathy were invaluable during the creation of this book.
Without you, it would have been completed in half the time.
Contents

1 Introduction to Blockchain . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.1 Prerequisites . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.2 Blockchain Myths . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.3 Blockchain and Decentralization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.4 What Is Blockchain? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.5 Disruptive Technology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.6 History . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.6.1 Milestones in Blockchain Development . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.7 Features of Blockchain . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
1.8 Present Growth . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
1.9 Predicted Market . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
1.10 Blockchain Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
1.10.1 Public . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
1.10.2 Private . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
1.10.3 Federated . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
1.10.4 Hybrid . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
1.10.5 Difference Between Public and Private Blockchains . . . . . . . . . . . . . . . . . . . 14
1.11 Blockchain Framework . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
1.11.1 Hardware/Infrastructure Layer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
1.11.2 Data Layer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
1.11.3 Network Layer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
1.11.4 Consensus Layer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
1.11.5 Application and Presentation Layer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
1.12 A Block and Its Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
1.12.1 A Block . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
1.12.2 Block Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
1.12.3 Ledger . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
1.12.4 Distributed . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
1.12.5 Transparency . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
1.12.6 Confirmation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
1.12.7 Proof of Work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
1.12.8 Block Awards . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
1.12.9 Transactions and UTXOs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
1.12.10 Consensus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22

vii
viii Contents

1.13 Scaling Blockchain . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23


1.13.1 Issues in Scaling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
1.13.2 Off-Chain Computation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
1.13.3 Sharding in Blockchain . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
1.14 Blockchain DApps and Usecases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
1.15 Laboratory Work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
1.15.1 Program for Implementing Blockchain in Python . . . . . . . . . . . . . . . . . . . . . 26
1.15.2 Program for Mining a New Block in Blockchain and Printing It . . . . . . . . . 28
1.15.3 Program for Creating Four Blocks in Blockchian and Printing
and Traversing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
1.15.4 Implementing Blockchain and Printing All Fields as per Etherscan.io . . . . . 32
1.15.5 Implementing Blockchain and UTXo in Python . . . . . . . . . . . . . . . . . . . . . . . 35
1.15.6 Explanation of Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
1.15.7 Implementation of PoW Algorithm in Python . . . . . . . . . . . . . . . . . . . . . . . . 37
1.15.8 Implementation of PoS Algorithm in Python . . . . . . . . . . . . . . . . . . . . . . . . . 40
1.15.9 Program to Fetch the Latest Block Information from Ethereum
Blockchain Using Etherscan API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
1.15.10 Explanation of Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
1.16 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
1.17 Exercise . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
1.17.1 Multiple Choice Questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
1.17.2 Short Answer Questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
1.17.3 Long Answer Questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
1.17.4 Practical Questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
1.17.5 Answer Set of MCQ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
2 Essentials of Blockchain Programming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
2.1 Cryptography Primitives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
2.1.1 Hash Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
2.2 Hash Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
2.2.1 Properties of Hash Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
2.2.2 Hash Pointers and Data Structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
2.2.3 Tampering Is Computationally Challenging . . . . . . . . . . . . . . . . . . . . . . . . . . 49
2.2.4 Role of Hashes in Blockchain . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
2.3 Secure Hash Algorithm (SHA) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
2.3.1 SHA Algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
2.3.2 Hashing Patterns . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
2.4 Public Key Cryptography . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
2.4.1 Secure Hash Algorithm-3 (Keccak) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
2.5 Merkle Tree . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
2.5.1 Merkle Tree Creation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
2.5.2 Role of Merkle Tree in Blockhain . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
2.5.3 Structure of Merkle Tree . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
2.5.4 Merkle Proof . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
2.5.5 Proof of Membership . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
2.5.6 Proof of Nonmembership . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
Contents ix

2.5.7 Advantages of Merkle Trees . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60


2.5.8 Applications of Merkle Trees . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
2.5.9 Merkle Tree Proof of Reserves . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
2.6 Public Key Cryptography . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
2.6.1 Public and Private Keys . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
2.6.2 Public Key Encryption Algorithms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
2.6.3 Digitally Signed Transaction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
2.6.4 Digital Signing in Blockchain . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
2.7 Laboratory Work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
2.7.1 Program in Python that Demonstrates the Use of Hashlib Library
to Generate the SHA-3 Hash of a Message . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
2.7.2 Python Program that Takes a String and the Desired Number of Leading
Zeros from the User and Outputs the Input String, the Nonce Value for
Which the Leading Zeros Puzzle Is Solved, and the Corresponding Hash
Generated . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
2.7.3 Program to Create Hash Code from Given Input String . . . . . . . . . . . . . . . . . 65
2.7.4 Program in Python that Demonstrates How to Use the SHA-256 Hash
Function and Its Application in a Simple Blockchain . . . . . . . . . . . . . . . . . . 66
2.7.5 Write a Program in Python to Verify Hash Properties . . . . . . . . . . . . . . . . . . 67
2.7.6 Program to Demonstrate a Simple Implementation of a Blockchain Using
Hash Codes as a Chain of Blocks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
2.7.7 Program to Demonstrate the Mining Process in Blockchain . . . . . . . . . . . . . 70
2.7.8 Program to Create a Merkle Tree in Blockchain . . . . . . . . . . . . . . . . . . . . . . . 72
2.7.9 Program to Prove Membership and Nonmembership in a Merkle Tree
Blockchain . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
2.7.10 Explanation of Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
2.7.11 Program to Demonstrate How to Prove the Membership and
Nonmembership of an Element in a Merkle Tree Blockchain . . . . . . . . . . . . 75
2.7.12 Program in Python that Demonstrates RSA Digital Signature Scheme . . . . 76
2.8 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
2.9 Exercise . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
2.9.1 Multiple Choice Questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
2.9.2 Short Answer Questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
2.9.3 Long Answer Questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
2.9.4 Practical Questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
2.9.5 Programming Questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
3 Bitcoin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
3.1 What Is Bitcoin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
3.2 History . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
3.3 Predicted Market . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
3.4 Wallet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
3.4.1 Bitcoin Wallets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
3.4.2 Custodial Wallet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
3.4.3 Noncustodial Wallet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
3.4.4 Software Wallet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
3.4.5 Hardware Wallet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
3.4.6 Features of Digital Wallet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
x Contents

3.4.7 Difference Between Digital Wallet and Bank Accounts . . . . . . . . . . . . . . . . . 87


3.4.8 Top Digital Wallet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
3.5 Digital Keys and Addresses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
3.5.1 Private Keys . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
3.5.2 Public Keys . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
3.6 Addresses in Bitcoin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
3.7 Transaction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
3.7.1 Transaction Lifecycle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
3.7.2 Creating Transactions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
3.7.3 Broadcasting Transactions to the Bitcoin Network . . . . . . . . . . . . . . . . . . . . . 91
3.7.4 Propagating Transactions on the Bitcoin Network . . . . . . . . . . . . . . . . . . . . . 92
3.7.5 Data Structures for Transaction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
3.7.6 Types of Transactions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
3.7.7 Transaction Input and Output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
3.8 Digital Signature . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
3.9 Mining and Consensus in Bitcoin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
3.9.1 Mining . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
3.9.2 Consensus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
3.9.3 Decentralized Consensus in Bitcoin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
3.9.4 Mining and Racing in Bitcoin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
3.9.5 Cost of Mining in Bitcoin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
3.9.6 Consensus Attacks in Bitcoin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
3.10 Forking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
3.10.1 Hard Fork . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
3.10.2 Soft Fork . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
3.11 Laboratory Work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
3.11.1 Program to Generate Private Keys Securely on a Hardware Wallet . . . . . . . 102
3.11.2 Program to Generate Public-Private Key Pairs, Encrypting and Storing
Private Keys Securely and Signing Transactions Using the Private Key . . . 103
3.11.3 Program to Demonstrate Some of the Features of a Digital Wallet . . . . . . . . 104
3.11.4 Program to Compare the Features of Popular Digital Wallets, Rank Them
Based on User Reviews and Ratings, and Recommend a Digital Wallet
Based on User Preferences . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
3.11.5 Program to Deploy a Smart Contract to Blockchain Using a Tool Like
Remix IDE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
3.11.6 Program that Measures the Transaction Throughput of EOA–EOA
Transactions and CA–CA Transactions Using Various Gas Limits
on the Ethereum Network . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
3.11.7 Program that Uses Web3 to Categorize Ethereum Addresses as EOA or
Contract Addresses and Evaluates Its Accuracy and Performance on a
Large Dataset of Addresses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110
3.11.8 Program that Simulates the Life Cycle of a Transaction on the Ethereum
Network and Measures the Time and Resources Required . . . . . . . . . . . . . . 111
3.11.9 Program for Implementing ECDSA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
3.11.10 Program to Create a Bitcoin Transaction and Sign It with a SIGHASH
Flag Using the bitcoinlib Library . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
3.11.11 Program for Bitcoin Mining . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
Contents xi

3.11.12 Program that Demonstrates How to Identify 51% Attacks


on a Blockchain . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
3.11.13 Program to Demonstrate the Concept of Forking . . . . . . . . . . . . . . . . . . . . . . 116
3.11.14 Program to Detect and Deal with 51% Attacks in the Bitcoin
Blockchain . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118
3.12 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
3.13 Exercise . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
3.13.1 Multiple Choice Questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
3.13.2 Short Answer Questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120
3.13.3 Long Answer Questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
4 Ethereum Blockchain . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
4.1 Overview of Ethereum Blockchain . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
4.1.1 Key Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124
4.1.2 EVM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125
4.2 History of Ethereum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125
4.2.1 Ledger to State Machine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125
4.2.2 Ethereum Network . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127
4.3 Smart Contracts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128
4.4 Challenges in Implementing Smart Contracts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129
4.4.1 Smart Contract Life Cycle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129
4.4.2 Introducing Solidity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
4.4.3 Global Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131
4.5 Ethereum Development Tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134
4.6 Ethereum Transactions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135
4.6.1 Transaction Life Cycle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136
4.7 Gas and Transaction Fees . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136
4.7.1 Addressing Gas Fees . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136
4.7.2 Factors Affecting Gas Price . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137
4.7.3 Calculating Gas Costs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137
4.7.4 Gas Fee Calculation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138
4.7.5 Implications of Base Fee . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138
4.7.6 Transaction Cost Predictability . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138
4.7.7 Future with PoS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138
4.7.8 Gas Fees and Orchid . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139
4.7.9 Example 1: Wallet-to-Wallet Transfer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139
4.7.10 Example 2: Deploying a Simple Contract . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139
4.7.11 Avoiding Ethereum Gas Fees . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140
4.8 Laboratory Work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141
4.8.1 Solidity Program for Displaying Hello Message . . . . . . . . . . . . . . . . . . . . . . . 141
4.8.2 Program for Demonstrating Simple Increment and Decrement
Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142
4.8.3 Smart Contract Development with Solidity . . . . . . . . . . . . . . . . . . . . . . . . . . . 143
4.8.4 Implementing Security Measures in Smart Contracts . . . . . . . . . . . . . . . . . . . 145
4.8.5 Developing an ERC-20 Token . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147
4.8.6 Building a Simple DApp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150
4.8.7 Interacting with Off-Chain Data Using Oracles . . . . . . . . . . . . . . . . . . . . . . . 151
xii Contents

4.8.8
Program to Demonstrate a Basic Example of Smart Contract Interaction
and Ownership Management on Ethereum Blockchain . . . . . . . . . . . . . . . . . 153
4.8.9 Program to Create a Decentralized Blind Auction Smart Contract on the
Ethereum Blockchain, Enabling Participants to Place Concealed Bids,
Reveal Them, and Determine the Highest Bidder While Ensuring Secure
Fund Management and Transparent Auction Outcomes. This Contract
Facilitates a Trustless and Tamper-Resistant Auction Mechanism,
Promoting Fairness and Efficiency in Auction Processes . . . . . . . . . . . . . . . . 155
4.8.10 Program to Showcase the Vulnerability of Reentrancy Attacks in a Smart
Contract Context and Demonstrate the Implementation of a Solution
Using a Reentrancy Guard . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160
4.9 Mist Browser . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162
4.9.1 Guidlines for Using Mist Browser . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162
4.9.2 Mist and Geth . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163
4.9.3 Geth’s Role . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163
4.10 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163
4.11 Exercise . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164
4.11.1 Multiple Choice Questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164
4.11.2 Long Answer Questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165
5 Hyperledger . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167
5.1 Introduction to Hyperledger . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167
5.1.1 The Purpose of Hyperledger . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167
5.2 Hyperledger Architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168
5.2.1 Infrastructure Layer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168
5.2.2 Framework Layer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169
5.2.3 Tool Layer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170
5.3 Hyperledger Community and Development . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170
5.4 Hyperledger Smart Contracts (Chaincode) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170
5.5 The Functioning of Hyperledger . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171
5.5.1 Contributor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171
5.5.2 Endorser . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171
5.5.3 Consenter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171
5.5.4 Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171
5.5.5 Advantages of Hyperledger . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171
5.5.6 Limitations of Hyperledger . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173
5.6 Hyperledger Projects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173
5.6.1 Comparison of Hyperledger with Other Blockchain Frameworks . . . . . . . . 174
5.6.2 Hyperledger Fabric in Blockchain . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177
5.6.3 Consensus in Hyperledger Fabric . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178
5.7 Hyperledger Consortiums and Networks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180
5.8 Hyperledger and Blockchain as a Service (BaaS) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181
5.8.1 Hyperledger Adoption Through BaaS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181
5.8.2 Advantages and Considerations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182
5.9 Laboratory Work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182
5.9.1 Program to Demonstrate Interaction with a Hyperledger Fabric
Blockchain Network Using the Hyperledger Fabric JavaScript SDK . . . . . . 182
Contents xiii

5.9.2
Program to Demonstrate How Hyperledger Fabric Could Be Used in a
Healthcare Context to Manage Patient Medical Records . . . . . . . . . . . . . . . . 184
5.9.3 Program to Demonstrate the Implementation of a Basic Government
Application Using Hyperledger Fabric . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187
5.9.4 Program to Demonstrate Finance Application Using Hyperledger
Fabric . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 188
5.9.5 Program to Demonstrate the Implementation of a Finance and Payments
System Using Hyperledger Fabric . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 190
5.9.6 Explanation of Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193
5.9.7 Program to Demonstrate Simple Interoperability Using the Hyperledger
Fabric JavaScript SDK to Interact with the Network and Demonstrate
How Two Different Smart Contracts Can Work Together . . . . . . . . . . . . . . . 194
5.9.8 Program to Demonstrate Smart Contract Modeling with Composer and
Docker . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195
5.9.9 Program for Demonstrating Hyperledger Caliper, a Benchmarking Tool
That Measures the Performance of Hyperledger Blockchain Applications
Under Various Conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 197
5.9.10 Running Caliper Benchmarks with Docker . . . . . . . . . . . . . . . . . . . . . . . . . . . 197
5.10 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 198
5.11 Exercise . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 198
5.11.1 Multiple Choice Questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 199
5.11.2 Short Answer Questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 200
5.11.3 Long Answer Questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 200
5.11.4 Programming Questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201
6 Case Studies Using Blockchain . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203
6.1 Blockchain – The Technology for Document Management . . . . . . . . . . . . . . . . . . . . . . 203
6.1.1 The Ownership . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203
6.1.2 Introduction and Background . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203
6.1.3 Problem Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 204
6.1.4 Use Case Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 204
6.1.5 Solution Architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 204
6.1.6 Implementation Steps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205
6.1.7 Smart Contracts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 206
6.1.8 Data Management and Security . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 206
6.1.9 Interoperability and Integration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 206
6.1.10 User Experience . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 206
6.1.11 Results and Benefits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207
6.1.12 Challenges and Lessons Learned . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207
6.1.13 Future Enhancements and Scalability . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207
6.1.14 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207
6.2 Case Study 2: Blockchain in the Food Supply Chain . . . . . . . . . . . . . . . . . . . . . . . . . . . 208
6.2.1 Introduction and Background . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 208
6.2.2 Problem Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 208
6.2.3 Use Case Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 208
6.2.4 Solution Architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 208
6.2.5 Implementation Steps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 209
6.2.6 Smart Contracts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210
xiv Contents

6.2.7 Data Management and Security . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210


6.2.8 Interoperability and Integration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210
6.2.9 User experience . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210
6.2.10 Results and Benefits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210
6.2.11 Challenges and Lessons Learned . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211
6.2.12 Future Enhancements and Scalability . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211
6.2.13 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211
6.3 Case Study 3: Blokchain in the Insurance Industry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211
6.3.1 Introduction and Background . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211
6.3.2 Problem Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212
6.3.3 Use Case Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212
6.3.4 Solution Architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212
6.3.5 Implementation Steps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212
6.3.6 Smart Contracts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212
6.3.7 Data Management and Security . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214
6.3.8 Interoperability and Integration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214
6.3.9 User Experience . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215
6.3.10 Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215
6.3.11 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215
6.4 Case Study 4: India’s Income Tax Department’s Simplification of Tax Procedures . . . 215
6.4.1 Introduction and Background . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215
6.4.2 Problem Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216
6.4.3 Use Case Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216
6.4.4 Solution Architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216
6.4.5 Implementation Steps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216
6.4.6 Smart Contracts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217
6.4.7 Tax Authority Interaction (Not Implemented in This Simplified
Example) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 218
6.4.8 Event Log . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 218
6.4.9 Data Management and Security . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 218
6.4.10 Interoperability and Integration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 218
6.4.11 User Experience . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219
6.4.12 Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219
6.4.13 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219
6.5 Case Study 5: Retail Banking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 220
6.5.1 Introduction and Background . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 220
6.5.2 Problem Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 220
6.5.3 Use Case Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 221
6.5.4 Solution Architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 221
6.5.5 Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 221
6.5.6 Data Management and Security . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 222
6.5.7 Network Security . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223
6.5.8 Incident Response . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223
6.5.9 Interoperability and Integration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223
6.5.10 User Experience . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224
6.5.11 Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224
6.5.12 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 225
6.6 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 225
Contents xv

6.7 Exercise . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 226


6.7.1 Multiple Choice Questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 226
6.7.2 Short/Long Answer Questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227
7 Beyond Blockchain . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229
7.1 Blockchain for the Metaverse . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229
7.2 Emergence of the Metaverse . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229
7.3 Understanding the Metaverse . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 230
7.4 Metaverse Layers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 230
7.4.1 Spatial Computing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231
7.4.2 Metaverse Components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232
7.5 Metaverse Through Immersive Technologies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233
7.5.1 Challenges in Metaverse Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . 234
7.6 Blockchain’s Role in the Metaverse . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 236
7.6.1 Why Blockchain Technology Is Crucial for the Metaverse . . . . . . . . . . . . . . 236
7.6.2 Interoperability and Standards . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237
7.6.3 Security and Trust . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237
7.6.4 Monetization and Incentives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237
7.7 Digital Scarcity and Ownership of Virtual Assets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237
7.8 Building Trust and Security in the Decentralized Metaverse . . . . . . . . . . . . . . . . . . . . . 238
7.8.1 Trustless Nature of the Metaverse . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 238
7.8.2 Zero Trust Security in the Metaverse . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 238
7.9 Data Hub for Crypto, DeFi, NFT, Metaverse . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 239
7.9.1 Real-Time Data Streaming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 239
7.10 Digital Trust Networks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 240
7.10.1 Diverse Applications of Digital Trust Networks . . . . . . . . . . . . . . . . . . . . . . . 240
7.10.2 Peer-to-Peer Marketplaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241
7.10.3 Platform Ecosystems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241
7.10.4 Zero Trust Security Systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241
7.10.5 Digital Identity Platforms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241
7.10.6 Decentralized Autonomous Organizations . . . . . . . . . . . . . . . . . . . . . . . . . . . 241
7.11 Beyond Cryptocurrency: Transforming ESG, Digital Assets,
and Financial Markets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241
7.11.1 Environmental, Social, and Governance (ESG) . . . . . . . . . . . . . . . . . . . . . . . 242
7.11.2 Digital Assets and Currency . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 242
7.11.3 Central Bank Digital Currencies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 242
7.11.4 Blockchain Modernizing Financial Markets . . . . . . . . . . . . . . . . . . . . . . . . . . 242
7.11.5 Blockchain and AI: A Synergy for Trust and Intelligence . . . . . . . . . . . . . . . 243
7.11.6 Data Analysis and Predictive Insights . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243
7.11.7 Smart Contract Automation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243
7.11.8 Enhanced Security . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243
7.11.9 Scalability and Performance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243
7.12 The Future of Banks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 244
7.12.1 Instant and Efficient Cross-Border Payments . . . . . . . . . . . . . . . . . . . . . . . . . 244
7.12.2 Streamlined Trade Finance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 244
7.12.3 Innovative Revenue Streams . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 244
xvi Contents

7.13 Blockchain and Sustainable Technologies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 244


7.13.1 Renewable Energy Trading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 245
7.13.2 Environmental Conservation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 245
7.14 Tangle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 246
7.15 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 247
7.16 Short/Long Answer Questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 248

Bibliography . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 249
Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 253
About the Authors

Dr. Ramchandra Mangrulkar is a Professor in the Department


of Information Technology in the Dwarkadas J. Sanghvi College
of Engineering in Mumbai, India. He holds various memberships
in professional organizations such as IEEE, ISTE, ACM, and
IACSIT. He completed his Doctor of Philosophy (Ph.D.) in Com-
puter Science and Engineering from S.G.B. Amravati University
in Maharashtra and Master of Technology (MTech) in Computer
Science and Engineering from the National Institute of Technology,
Rourkela. Dr. Mangrulkar is proficient in several technologies and
tools, including Microsoft’s Power BI, Power Automate, Power
Query, and Power Virtual Agents, Google’s Dialog Flow, and Over-
leaf. With over 22 years of combined teaching and administrative
experience, Dr. Mangrulkar has established himself as a knowl-
edgeable and skilled professional in his field. He has also obtained
certifications like Certified Network Security Specialist Interna-
tional CyberSecurity Institute (ICSI) – Certified Network Security
Specialist (CNSS) from ICSI, UK. Dr. Mangrulkar has an extensive
publication record, with 95 publications including refereed/peer-
reviewed international journal publications, book chapters with
international publishers (including ones indexed in Scopus), and
international conference publications.
Dr. Pallavi Vijay Chavan is Associate Professor at Ramrao Adik
Institute of Technology, D. Y. Patil “Deemed-to-be-University,”
Navi Mumbai, MH, India. She has been in academia for the past
17 years working in the area of computing theory, data science,
and network security. In her academic journey, she has published
research in data science and security with reputable publishers
such as Springer, Elsevier, CRC Press, and Inderscience. She has
published 2 books, over 7 book chapters, more than 10 interna-
tional journal papers, and over 30 international conference papers.
Presently she serves as advisor to five Ph.D. research scholars in
related fields. She completed her Ph.D. at Rashtrasant Tukadoji
Maharaj Nagpur University, Nagpur, MH, India, in 2017. In 2003,

xvii
xviii About the Authors

she earned the first merit position at Nagpur University for a B.E. in
Computer Engineering. She is the recipient of research grants from
University Grants Commission (UGC), Council of Scientific &
Industrial Research (CSIR), and University of Mumbai. She serves
as a reviewer for Elsevier and Inderscience journals. Her motto is
“Teaching is a mission.”
About the Technical Reviewer

Dr. Parikshit Mahalle is a senior member of the Institute of


Electrical and Electronics Engineers and Professor, Dean of Re-
search and Development and -Chair of the Department of Arti-
ficial Intelligence and Data Science at Vishwakarma Institute of
Information Technology, Pune, India. He completed his Ph.D. at
Aalborg University, Denmark, and continued as a postdoctoral
researcher at Communication, Media & Information Technologies,
Copenhagen, Denmark. He has over 23 years of teaching and
research experience. He is a former member of the Board of Studies
in Computer Engineering and former chairman of the Department
of Information Technology at Savitribai Phule Pune University
and various universities and autonomous colleges throughout India.
He owns 15 patents, has published over 200 research studies and
papers (2950+ Google Scholar, 1550+ H index-25 and Scopus
citations, 438 H index-8, Web of Science, and H index-10 ci-
tations), and has authored/edited 56 books with Springer, CRC
Press, Cambridge University Press, and others. He is editor in
chief for IGI Global’s International Journal of Rough Sets and
Data Analysis and Inderscience’s International Journal of Grid
and Utility Computing, is a member of the editorial review board
for IGI Global’s International Journal of Ambient Computing and
Intelligence, and serves as a reviewer for various reputable journals
and conferences. His research interests include machine learning,
data science, algorithms, Internet of Things, identity management,
and security. He currently advises eight Ph.D. students in the areas
of IoT and machine learning, and six students have successfully
defended their Ph.D. under his supervision from Savitribai Phule
Pune University. He is also the recipient of the Best Faculty Award
by Sinhgad Institutes and Cognizant Technology Solutions. He has
delivered over 200 lectures at the national and international levels.

xix
Preface

Blockchain has become the buzzword of the day. Developers are focusing on more user-friendly
applications with the help of blockchain, achieving decentralization and a trustless environment
without third-party involvement. This includes diverse concepts and tools that play major roles in
developing crypto-based applications in various programming languages. The distributed ledger and
smart contracts involved reveal the importance of blockchain in creating immutable and transparent,
cryptographically secure record-keeping of transactions. The programming approach helps to shed
light on the core concepts of blockchain and relevant applications in easy steps. This helps to motivate
learners to become part of the solution to most of the applications demanding trustless and inde-
pendent autonomous systems. The identification and examination of blockchain technology beyond
cryptocurrency will help to investigate alternative solutions using many blockchain-supportive tools.
The main purpose of this book is to present the difficult concepts of blockchain technology in very
accessible and easy-to-understand language using a programming approach so that learners can easily
grasp the key concepts arising from the emerging notion of blockchain technology. Another purpose
of this book is to make available the experience of academia and industry to the target audience
through hands-on programming.
This book presents the concepts of blockchain technology in a concise manner with clear and easy
examples using trending blockchain programming languages. The book fills a gap of address issues
surrounding the practical implementation of blockchain concepts using case studies. The book also
highlights the usefulness of blockchain technology beyond its current applications.

Mumbai, India Ramchandra Sharad Mangrulkar


September 2023 Pallavi Vijay Chavan

xxi
Acknowledgements

We extend our sincere gratitude to the dedicated contributors and accomplished researchers in the
field of blockchain for their invaluable contributions and pioneering work.

xxiii
Introduction to Blockchain
1

Readers of this book are likely to have some knowledge and basic idea about the enormous potential
of the trending, decentralizing, and trustworthy technology called blockchain. This technology
represents an innovation in the digital ecosystem that has significantly impacted trusted computing
activities, resulting in an enhanced level of protection from cyber security threats.
This chapter lays out the fundamentals of blockchain technology, presenting its theoretical
background, historical milestones, and present growth trends. Further, the conceptual view of a block
in blockchain and the types of blockchain are described. The chapter discusses the basic skill set and
libraries required to start doing “blockchain programming,” which is a key objective of this book. The
chapter ends with a few examples and their implementation in Python.

1.1 Prerequisites

The prerequisites for blockchain technology include:

• Understanding of cryptography: Cryptography is the foundation of blockchain technology. A basic


understanding of cryptographic concepts, such as hashing, public-key encryption, and digital
signatures, is necessary.
• Distributed systems: Blockchain is a distributed system that runs on multiple nodes. Therefore, it
is essential to have a good understanding of distributed systems to build and deploy blockchain
applications.
• Data structures and algorithms: Blockchain technology relies on complex data structures such as
Merkle trees and algorithms such as consensus algorithms. Understanding of these concepts is
crucial for building a robust blockchain system.
• Networking and security: Blockchain technology requires a good understanding of networking
protocols, such as TCP/IP, HTTP, and HTTPS. Additionally, a solid understanding of security
concepts, such as firewalls, encryption, and authentication, is necessary to develop secure
blockchain applications.
• Smart contracts: Smart contracts are self-executing contracts with the terms of the agreement
between buyer and seller directly written into lines of code. Knowledge of smart contract
programming languages, such as Solidity, is necessary for building decentralized applications.

© The Author(s), under exclusive license to APress Media, LLC, part of Springer Nature 2024 1
R. S. Mangrulkar, P. Vijay Chavan, Blockchain Essentials,
https://doi.org/10.1007/978-1-4842-9975-3_1
2 1 Introduction to Blockchain

• Business and economics: Blockchain technology is disrupting traditional business models and
creating new opportunities. Understanding the economics of blockchain and how it can be applied
to business is essential for leveraging its potential.
• Legal and regulatory dimensions: Blockchain technology operates in a regulatory gray area in
many countries, and regulations are constantly evolving. Understanding the legal and regulatory
environment in which blockchain operates is critical for creating compliant and successful
blockchain applications.

1.2 Blockchain Myths

Blockchain is an emerging technology. The following list dispels some of the myths surrounding
blockchain:

• Blockchain is the same thing as Bitcoin (or any other cryptocurrency)


There is a misleading idea that if you learn blockchain technology, you will become a good trader!
This is untrue. Blockchain is not equivalent to any cryptocurrency, whether Bitcoin or any other
currencies on the market like Altcoins. In fact, blockchain is a technology, whereas Bitcoin is
a cryptocurrency that makes use of blockchain technology. Blockchain has many applications
outside the crypto world. Blockchain technology provides a full support system for developing
cryptocurrencies, whereas Bitcoin is a fundamental application that builds on this emerging
blockchain technology.
• Blockchain can solve all security issues
Blockchain cannot be used to definitively eliminate corruption or fraudulent activities.
Blockchain’s many applications have been developed by players in the various models governing
economies around the world. Blockchain cannot all issues related to security. Solving all societal
issues using blockchain is a formidable challenge. Thus, careful consideration needs to be given
as to which societal issues should be addressed using blockchain.
• Blockchain is the only possible technology
Blockchain is not necessarily the best technology for solving your problems; they might be better
solved employing technology that does not use blockchain. It is possible that many different
existing technologies would yield better results in terms of security without the use of blockchain.
• Blockchain and distributed databases are similar technologies
Blockchain and distributed databases are different technologies. Blockchain is not a distributed
databases. Blockchain is not designed to store and secure data. Blockchain and distributed
databases are two different technologies, each with its own merits and demerits and different
potential to solve different problems. Both are essential, and one cannot easily replace the other.

1.3 Blockchain and Decentralization

Blockchain technology emerged to solve most of the issues in decentralization. Decentralization


refers to the distribution of power or authority away from a single central entity to multiple individuals
or groups. In the context of technology, it refers to systems or networks that operate without a central
authority controlling them. Figure 1-1 gives an overview of centralized and decentralized systems.
Decentralization is required to address trust issues, that is, the different parties involved do not
trust each other, but they should cooperate. The network of different entities such as businesses,
individuals, government, private- and public-sector organizations, with their own interests, can come
1.4 What Is Blockchain? 3

Figure 1-1 Overview: centralized and decentralized systems

Figure 1-2 Blocks and chain in blockchain

together and cooperate with each other to solve societal issues. Decentralization and blockchain work
together to create a secure, transparent, and tamper-proof system that operates without the need for a
central authority.

1.4 What Is Blockchain?

Blockchain is an append-only, immutable, never-ending chain of data where data, once added, cannot
be deleted or modified, achieving a tamper-proof system. The immutable property of blockchain
means no one can change it. Its append-only nature ensures that no one can erase data once they are
written in the blockchain. This append-only nature of blockchain makes it a never-ending but fully
traceable system. Figure 1-2 shows the basic idea of blocks and chain in blockchain.
Every individual player maintains a copy of the blockchain, removing the need for central
administration or centralization. The addition of information to the existing blockchain happens in
the form of a new block appended at the end while at the same time ensuring that all copies of the
local blockchain available to the different network players must also be updated in the same order.
This will ensure data consistency in the blockchain, and all copies will be the same. This doubtlessly
will require an additional authentication and validation mechanism, but at a superficial level, everyone
will have an updated copy of the blockchain.
The data structure in blockchain consists of a chain of blocks linked together with the help of
current and previous pointers. These two fields store the hashed data of the contents of the block, the
previous pointer stores the hashed data of the previous block, and the current pointer stores the hashed
data of the current block.
The data are stored in the blockchain in a transparent way and are available to everyone, allowing
anyone to validate and verify the data as and when required.

Definition 1.1 Blockchain is a decentralized, immutable, append-only public ledger.


4 1 Introduction to Blockchain

1.5 Disruptive Technology

Clayton Christensen introduced the idea of disruptive technologies in a 1995 Harvard Business
Review article. Disruptive technology refers to any innovation that disrupts an existing market or
industry, displacing established products or services and creating new markets and opportunities.
These technologies often have a transformative effect on society, leading to changes in business
models, consumer behavior, and even cultural norms.
Not all innovations are disruptive technologies. It is the process rather than product or services.
Blockchain is a sustaining innovation rather than a disruptive innovation in the financial sector.
Disruptive technologies typically emerge from unexpected sources and are often initially dismissed
as inferior or irrelevant by established players in the market. However, as they gain momentum and
become more widely adopted, they can completely change the competitive landscape and reshape
entire industries.
The following are examples of disruptive technologies:

• Ecommerce: The rise of ecommerce in the 2000s disrupted traditional brick-and-mortar retail,
creating new opportunities for businesses to sell products and services online.
• Personal computers: The development of personal computers in the 1970s and 1980s disrupted the
established mainframe computer industry, creating new markets and opportunities for businesses
and individuals.
• Social media: The emergence of social media in the 2010s disrupted traditional media and
advertising industries, leading to the rise of new platforms for content creation and distribution.
• Digital photography: The advent of digital photography in the 1990s disrupted the traditional film
photography industry, leading to the demise of many established companies and the emergence of
new players in the market.

Blockchain is considered a disruptive technology for several reasons:

• Decentralization: One of the key features of blockchain technology is its ability to operate
in a decentralized manner, without the need for intermediaries such as banks or government
institutions. This eliminates the need for trust in centralized institutions, which can be slow,
expensive, and prone to corruption.
• Immutable and transparent: Blockchain technology is immutable and transparent, meaning that
once data are added to a blockchain, it cannot be modified or deleted. This creates a high degree of
trust in the data stored on the blockchain and eliminates the need for intermediaries to verify data.
• Security: Blockchain technology is secured by cryptographic algorithms that make it virtually
impossible to tamper with the data stored on the blockchain. This creates a high degree of security
for transactions and other data stored on the blockchain.
• Smart contracts: Smart contracts are self-executing contracts with the terms of the agreement
between buyer and seller being directly written into lines of code. This eliminates the need for
intermediaries to execute and enforce contracts, which can be slow, expensive, and prone to errors.
• Tokenization: Blockchain technology enables the creation and exchange of digital assets, or tokens,
which can represent anything of value, such as currency, property, or ownership rights. This creates
new opportunities for businesses to generate value and disrupt traditional business models.
1.6 History 5

1.6 History

Blockchain, a technology with the potential to become the foundation of global record-keeping
systems, was introduced a mere decade ago by anonymous individuals associated with the digital
currency Bitcoin, under the pseudonym Satoshi Nakamoto. Despite its relatively recent inception,
blockchain has quickly gained recognition as a transformative innovation, poised to revolutionize
various industries through its decentralized and secure nature.

1.6.1 Milestones in Blockchain Development

The subsection discusses some of the significant milestones in the development of blockchain
technology (Figure 1-3).

1. 2008 – The publication of Bitcoin’s whitepaper by Satoshi Nakamoto marked the groundbreaking
introduction of the cryptocurrency. This event revolutionized the financial landscape, ushering in
a new era of decentralized digital currency. The whitepaper laid the foundation for a peer-to-peer
electronic cash system that would eventually disrupt traditional monetary systems worldwide.
2. 2009 – The inaugural Bitcoin transaction between Satoshi Nakamoto and Hal Finney stands as
a significant milestone in cryptocurrency history. This historic event symbolized the practical
application and transferability of Bitcoin as a digital currency. The transaction showcased the

Figure 1-3 Blockchain timeline


6 1 Introduction to Blockchain

potential of Bitcoin as a decentralized payment system, setting the stage for its widespread
adoption and subsequent impact on the financial industry.
3. 2011 – Namecoin’s launch marked a groundbreaking moment as it became the first alternative
cryptocurrency to utilize blockchain technology. This pioneering step opened the door for a
multitude of innovative blockchain-based digital assets. Namecoin’s introduction demonstrated
the potential for decentralized systems beyond traditional currencies, paving the way for the
development of various blockchain applications and cryptocurrencies.
4. 2013 – Vitalik Buterin’s creation of Ethereum unleashed a revolutionary platform enabling
the creation of smart contracts and decentralized applications (dApps). Ethereum’s emergence
introduced a new paradigm in blockchain technology, empowering developers to build complex
applications on a decentralized network. Buterin’s vision laid the foundation for a vibrant
ecosystem of dApps, fueling innovation and transforming industries through the power of
decentralized computing.
5. 2015 – The formation of the Enterprise Ethereum Alliance united leading corporations and
blockchain startups, fostering collaboration in the advancement of blockchain technology. This
alliance served as a catalyst for exploring the potential of Ethereum in various industries and
promoting blockchain adoption on a global scale. The Enterprise Ethereum Alliance aimed
to accelerate innovation, establish industry standards, and drive the mainstream integration of
blockchain solutions across sectors.
6. 2016 – The Hyperledger Project, initiated by the Linux Foundation, set out to develop open-
source blockchain software specifically tailored to enterprise applications. This strategic launch
brought together industry leaders and technologists to collaborate on building scalable and
interoperable blockchain solutions. By providing a collaborative platform, the Hyperledger
Project aimed to accelerate the adoption of blockchain technology among businesses, fostering
transparency, efficiency, and trust in enterprise operations.
7. 2017 – The cryptocurrency market witnessed an unprecedented surge in value, primarily led by
Bitcoin, accompanied by an explosive growth in initial coin offerings (ICOs). This phenomenon
resulted in widespread frenzy and speculation, attracting investors seeking to capitalize on
the potential returns of digital assets. The soaring value of cryptocurrencies and the ICO
boom reshaped the financial landscape, bringing both opportunities and risks while fueling the
development of innovative blockchain projects worldwide.
8. 2018 – Blockchain-based platforms like IBM’s Food Trust have emerged as transformative
solutions for supply chain management, enabling enhanced transparency and traceability within
the food industry. By leveraging blockchain technology, these platforms offer a secure and
immutable record of every step in the supply chain, promoting accountability and reducing fraud.
The adoption of such blockchain solutions has the potential to revolutionize the way we track and
verify the origins, quality, and safety of food products, ensuring consumer confidence and driving
industry-wide improvements.
9. 2019 – Facebook’s launch of the Libra cryptocurrency encountered substantial regulatory scrutiny
and widespread resistance from governments worldwide. The ambitious project aimed to create
a global digital currency, but concerns over data privacy, monetary sovereignty, and potential
risks to the financial system led to intense pushback. The Libra initiative highlighted the
complex challenges and regulatory hurdles that arise when tech giants venture into the realm
of cryptocurrencies and sparked discussions on the future of digital currencies in a regulated
environment.
10. 2020 – Major financial institutions like JP Morgan and Goldman Sachs have embraced blockchain
technology, recognizing its potential for efficiency and security in financial operations. Simulta-
neously, numerous countries have launched their own central bank digital currencies (CBDCs),
1.7 Features of Blockchain 7

aiming to leverage the benefits of blockchain and enhance their monetary systems. This combined
trend showcases the growing acceptance and integration of blockchain technology within the
traditional financial sector, paving the way to transformative changes in how transactions and
currencies are managed globally.
11. 2021 – In a historic move, El Salvador became the first country to officially adopt Bitcoin as legal
tender in 2021. This decision enabled businesses to utilize Bitcoin for paying employee salaries
and established its acceptance as a valid payment method throughout the country. El Salvador’s
embrace of Bitcoin as a form of currency marked a significant milestone in the mainstream
acceptance and integration of cryptocurrencies into national economies.
12. 2022 – The year 2022 witnessed notable blockchain growth, particularly in the emergence of
national cryptocurrencies. This concept revolved around the idea of CBDCs, where central banks
opted to develop their own digital coins instead of relying on decentralized cryptocurrencies.
This trend highlighted a shift toward more centralized control over digital currencies, with central
banks exploring the benefits and challenges of issuing their own blockchain-based currencies.
13. 2023 – The year 2023 has witnessed a notable focus on environmentally friendly blockchains,
facilitated by carbon offsetting practices and energy-conscious network architectures. The
adoption of greener blockchains will be made more feasible through the utilization of eco-friendly
algorithms like proof of stake. These developments signify a growing commitment to reducing
the environmental impact of blockchain technology and promoting sustainable practices within
the industry.

1.7 Features of Blockchain

The remarkable attention and interest surrounding blockchain technology can be attributed to several
key factors (Figure 1-4).

1. Immutable
Immutability lies at the core of blockchain technology, rendering it an unchangeable and enduring
network. By operating through a network of nodes, the blockchain ensures that once a transaction
is recorded, it becomes permanent and resistant to modification. This immutability characteristic
establishes the blockchain as a secure and trustworthy ledger, bolstering confidence in its integrity
and authenticity.

Figure 1-4 Features of blockchain


8 1 Introduction to Blockchain

2. Distributed
Transparency is a fundamental feature of blockchain technology, as all network participants
possess a copy of the ledger, ensuring complete visibility. By employing a public ledger,
the blockchain offers comprehensive information regarding participants and transactions. The
distributed computational power across multiple computers enhances the efficiency and reliability
of the network, leading to improved outcomes in terms of security and consensus.
3. Decentralized
Blockchain technology operates as a decentralized system, devoid of a central authority, whereby
numerous nodes collaborate to authenticate and validate transactions. Every node within a
blockchain network possesses an identical copy of the ledger, ensuring consistency and eliminating
the need for a central point of control. This decentralized architecture enhances the security,
resilience, and transparency of the network, making it resistant to single points of failure or
manipulation.
4. Secure
In a blockchain, each record undergoes individual encryption, bolstering the overall security of
the network. The absence of a central authority does not grant unrestricted access to add, update,
or delete data on the network. Cryptographic hashing assigns a unique identity to every piece of
information on the blockchain, ensuring the integrity and immutability of the data. Each block
contains a distinctive hash along with the hash of the preceding block, creating cryptographic
links between blocks. Modifying the data would require changing all the hash IDs, an exceedingly
challenging and practically infeasible task.
5. Consensus
Consensus plays a vital role in blockchain networks by enabling efficient and impartial decision-
making. It involves the use of algorithms that allow a group of active nodes to reach swift and
reliable agreements, ensuring the smooth operation of the system. Although nodes may lack trust in
one another, they rely on the consensus algorithm at the heart of the network to facilitate consensus.
Various consensus algorithms exist, each with its own advantages and disadvantages. A consensus
algorithm is essential for any blockchain to maintain its value and integrity.
6. Unanimous
In a blockchain network, agreement on the validity of records is crucial before their inclusion.
When a node intends to add a block, it requires majority consensus through voting, ensuring that the
block can be added to the network. Unauthorized addition, modification, or deletion of information
is prevented. Updates to records occur simultaneously, rapidly propagating throughout the network.
Therefore, any changes without the consent of the majority of nodes are practically impossible due
to the stringent consensus requirements in place.
7. Smart Contract
Smart contracts are agreements whose provisions are encoded in computer code and automatically
execute. Without intermediaries, they automate, facilitate, and enforce contractual agreements.
Smart contracts augment a blockchain with programmable capabilities, allowing actions and
transactions to be activated automatically when predefined conditions are met. This function
improves the efficacy and independence of blockchain applications, such as financial services and
supply chain management.
1.9 Predicted Market 9

1.8 Present Growth

The growth of blockchain technology has continued to accelerate in recent years. Here are some
examples of its present growth:

• Investment: According to a report by CB Insights, global investment in blockchain startups has


increased steadily, with over USD .8.2 billion raised across 342 deals in 2021 alone.
• Enterprise adoption: Major corporations, including IBM, Walmart, and Visa, are investing in and
implementing blockchain technology for supply chain management, payment processing, and
other applications.
• Cryptocurrency adoption: Cryptocurrencies such as Bitcoin and Ethereum have seen significant in-
creases in adoption and investment. In 2021, the total market capitalization of all cryptocurrencies
surpassed USD 2 trillion.
• Government interest: Several governments around the world are exploring the use of blockchain
technology for various applications, including the development of CBDCs and voting systems.
• NFTs: The emergence of nonfungible tokens (NFTs) on blockchain platforms has created a new
market for digital assets and has the potential to revolutionize the art, music, and gaming industries.
• Increased scalability: The development of new blockchain technologies, such as sharding and
layer-2 solutions, is addressing the issue of scalability, making it possible to process more
transactions per second and enabling more widespread adoption.

1.9 Predicted Market

The market for blockchain technology is expected to continue to grow in the coming years. The
market size of blockchain technology globally was valued at USD 10.02 billion in 2022. It is projected
to experience significant growth at a compound annual growth rate (CAGR) of 87.7% from 2023 to
2030. This growth can be attributed to the rising venture capital funding in companies involved in
blockchain technology.

• Etherium will dominate


In 2023, Ethereum is poised to become the leading blockchain platform, driven by updates such
as the Merge and the Shanghai upgrade. These enhancements will enhance usability, performance,
and scalability, particularly with the implementation of proto-danksharding. As a result, Ethereum
will solidify its position as the preeminent player in the blockchain industry.
• Ethereum Staking
In 2023, Ethereum has emerged as the leading platform for staking, with over $20 billion staked,
driving innovation in this field. EigenLayer, a notable project, offers “security as a service” to other
blockchain platforms, leveraging Ethereum’s staked security to enhance their own. EigenLayer’s
upcoming EigenDA protocol aims to introduce a restaking mechanism in 2023, further advancing
staking innovation. With growing demand for ETH staking and the development of new solutions,
Ethereum will solidify its role as a global settlement layer for the Web3 ecosystem.
• Evolution of NFTs In the coming year, NFTs will expand beyond digital art, driven by major brands
like Starbucks. NFT rewards programs will inspire other commercial leaders to follow suit. The
fusion of physical and digital experiences will fuel NFT adoption. Projects lacking adaptation and
utility may fail, while recognized ones like CryptoPunks could thrive. The widespread commercial
use of NFTs will shape their future.
• Future of Tech Crypto
10 1 Introduction to Blockchain

Cryptocurrency enables trading and investment, while “tech crypto” prioritizes peer-to-peer
networks and global software for transactions. The shift toward tech crypto includes decentralized
finance and nonfinancial decentralized applications. Growing adoption of tech crypto will bolster
its importance, paving the way to the next bull market and providing stability amid market
fluctuations.
• Reputation Management in Web3
Decentralized identity and reputation systems will be vital for Web3 transactions in 2023, allowing
reputation transfer and holistic identity views. Projects like Intuition are leading the way by
leveraging attested data for a deeper understanding of identity. These systems will be fundamental
to Web3, enabling global decentralized coordination and supporting diverse interactions and
transactions.
• Bitcoin’s Market Challenges
Bitcoin’s market share is likely to be challenged in the coming year due to various factors. The lack
of daily utility compared to other tokens and ecosystems with higher commercial use diminishes
Bitcoin’s appeal. Criticism related to environmental concerns and the energy-intensive proof-of-
work system adds to the challenges. Bitcoin’s failure to serve as a risk-off digital gold hedge may
hinder its progress, creating an opportunity for a more utility-driven layer 1 asset in the next bull
run.
• Web 3.0 Gaming
In 2023, Web 3.0 gaming is set to overcome its early flaws and integrate Web3 utility and gaming
aesthetics more seamlessly. The industry’s focus will shift toward gameplay-centered studios,
moving away from token-centric projects. Game projects will leverage advanced technologies to
enhance gameplay experiences and drive growth in the Web 3.0 gaming market. The upcoming
year holds promise for Web 3.0 gaming to engage the global gaming community of three billion
players and reshape its negative reputation.

1.10 Blockchain Types

Blockchain is a digital ledger technology that provides a secure and transparent way of storing and
sharing data. There are different types of blockchain, each with its unique features and characteristics
(Figure 1-5).
Some of the blockchain types are categorized into permissioned and permissionless; they overlap
is illustrated in Figure 1-6.
The following subsections present the characteristics of various categories of blockchain and
provides examples of each.

Figure 1-5 Types of blockchain


1.10 Blockchain Types 11

Figure 1-6 Permissionless vs. permissioned blockchain

1.10.1 Public

A public blockchain is a type of blockchain technology that is open to anyone, and anyone with
Internet facilities is eligible to participate. It operates in a decentralized manner, allowing participants
to validate blocks and send transactions without the need for permission from a central authority.
Public blockchains often use two major consensus algorithms: proof of work (PoW) and proof of
stake (PoS).
They are characterized by their openness, transparency, and lack of central authority. Nodes can
join and leave a network freely, and all nodes can verify new data added to the blockchain.
Public blockchains employ incentive mechanisms to ensure the correct operation of the system.
They are permissionless, meaning anyone can access the blockchain without requiring permission,
and the ledger is shared and transparent. Participants in a public blockchain can remain anonymous,
as real names and identities are not necessary. Public blockchains offer users greater freedom and
flexibility in how they use the platform, without the limitations imposed by regulations.

Characteristics of Public Blockchain

• Permissionless and open to all


• Cooperation among all nodes to verify data
• Use of incentive mechanism-based protocols
• Shared and transparent ledger
• Secure with 51% rule
• Anonymous and hidden user identity
• Absence of regulations or limitations on participant
• No way to track transactions
12 1 Introduction to Blockchain

Examples of Public Blockchain

Examples of public blockchains include Bitcoin (BTC), Ethereum (ETH), Ripple (XRP), Litecoin
(LTC), Cardano (ADA), and Stellar (XLM) are examples of public blockchains.

1.10.2 Private

Private blockchains are blockchain networks that are permissioned and accessible only to a specific
group of people or organizations. Unlike public blockchains, where anyone can participate in the
network, private blockchains are designed to restrict access to certain authorized users. Private
blockchains are often used by organizations to build secure and private networks that can improve
efficiency and reduce costs.

Characteristics of Private Blockchain

• Private blockchains operate in a closed network and have permissions managed by an organization.
• They are suitable for specific use cases where organizations want to exert control over access and
network parameters.
• The advantages of private blockchains include faster transaction speeds, better scalability, and
customization options.
• However, private blockchains go against decentralization and distributed ledger principles. They
rely on centralized nodes, which can create challenges in establishing trust and compromise
security.
• Use cases for private blockchains include supply chain management, asset ownership verification,
and internal voting systems.
• Private blockchains provide organizations with control and customization but may sacrifice the
decentralization and security offered by public blockchains.

Examples of Private Blockchain

Hyperledger Fabric, Corda, Quorum, Multichain, and R3 Corda Enterprise are examples of private
blockchains.

1.10.3 Federated

A federated blockchain is a type of blockchain network that operates under a federated consensus
model. It involves a consortium of organizations or nodes that work together to validate transactions
and maintain the blockchain. Federated blockchains are permissioned, meaning access and participa-
tion are restricted to authorized entities within the consortium.
In a federated blockchain, the consensus mechanism is typically based on a select group of
nodes that form the federation. These nodes are responsible for validating transactions and reaching
consensus on the state of the blockchain. Unlike public blockchains, federated blockchains are more
centralized as the decision-making power lies with the participating entities.
1.10 Blockchain Types 13

Federated blockchains offer advantages such as improved scalability, faster transaction speeds,
and enhanced privacy and security compared to public blockchains. They are suitable for use cases
where a consortium of organizations needs to collaborate and share data while maintaining control
and privacy.

Characteristics of Federated Blockchain

• Permissioned and accessible only to authorized entities within a consortium


• Consensus achieved through a select group of nodes forming the federation
• Improved scalability and faster transaction speeds compared to public blockchains
• Enhanced privacy and security features
• More centralized decision-making compared to public blockchains
• Suitable for consortium-based collaborations and data sharing

Examples of Federated Blockchain

IBM Blockchain Platform, Ripple, Quorum (Enterprise Ethereum), Corda Enterprise, and Hyper-
ledger Fabric Consortium Networks are examples of federated blockchains.

1.10.4 Hybrid

A hybrid blockchain is a combination of both public and private blockchains, offering the benefits
of both models. It allows for the interoperability of different blockchain networks and enables
the exchange of data and assets between them. Hybrid blockchains provide flexibility in terms of
transparency, control, and scalability.
In a hybrid blockchain, certain parts of the network are public, allowing for open participation
and transparency, while other parts are private, providing restricted access and enhanced privacy.
The integration of public and private blockchains enables organizations to leverage the advantages
of public networks for certain use cases while maintaining control and privacy for sensitive data or
operations.
The hybrid model offers the ability to customize the level of decentralization and privacy based
on specific requirements. It provides a balance between transparency and confidentiality, making
it suitable for various applications, such as supply chain management, healthcare, finance, and
government sectors.

Characteristics of Hybrid Blockchain

• Combination of public and private blockchains


• Flexibility in terms of transparency and control
• Interoperability between different blockchain networks
• Customization of decentralization and privacy
• Suitable for applications with varying requirements
14 1 Introduction to Blockchain

Table 1-1 Comparison of Public and Private Blockchains


Basis of Comparison Public Blockchain Private Blockchain
Access Permissionless Permissioned
Network actors Don’t know each other Know each other
Decentralized vs. centralized Decentralized More centralized
Order of magnitude Lower Higher
Native token Yes Not necessary
Speed Slow Fast
Transactions per second Fewer More
Security More secure Less secure
Energy consumption More Less
Consensus algorithms Proof of work, proof of stake, etc. Proof of elapsed time, raft, etc.
Attacks Risk of collision or 51% attack No minor collision, known validators
Effects Disrupt current business models Reduce transaction costs and data redundancies
Examples Bitcoin, Ethereum, etc. R3, EWF, B3i, Corda

Examples of Hybrid Blockchain

Dragonchain, Ardor, Wanchain, XinFin, and MultiChain are examples of hybrid blockchain plat-
forms.

1.10.5 Difference Between Public and Private Blockchains

Let us differentiate between public and private blockchains with respect to a few criteria as given in
Table 1-1.

1.11 Blockchain Framework

A blockchain framework is a set of protocols, rules, and standards that define the structure and
operations of a blockchain network. A blockchain framework has the following five major layers
(Figure 1-7).

1.11.1 Hardware/Infrastructure Layer

The bottom-most layer of the blockchain is the hardware or infrastructure layer. It involves servers
hosted in data centers that store the content of the blockchain. These servers provide the necessary
resources for the blockchain network to function effectively. Some important features of this layer are
as follows:

• The top layer of the blockchain is the hardware or infrastructure layer, consisting of servers hosted
in data centers.
• The servers store the content of the blockchain and provide necessary resources.
• Client–server architecture is different from blockchain’s peer-to-peer (P2P) network.
1.11 Blockchain Framework 15

Figure 1-7 Blockchain framework

• Blockchain utilizes a P2P network of computers to calculate, validate, and record transactions in a
shared ledger.
• Transactions are organized into blocks in an ordered format.
• The end result is a distributed database that tracks all data, transactions, and relevant information.
• Nodes, which are computers in the P2P network, play a crucial role in the blockchain.
• Nodes verify transactions, group them into blocks, and roadcast them to the network.
• Once consensus is reached, nodes update their local copies of the ledger and commit the block to
the blockchain network.
• Any device that connects to the blockchain network becomes a node and contributes to the
network’s functioning.

1.11.2 Data Layer

By combining the use of linked lists, Merkle trees, and digital signatures, blockchain technology
establishes a secure and transparent structure for storing and verifying data. Some of the important
features of the data layer are as follows:

• The blockchain’s data structure relies on a linked list, which consists of blocks with transactions
and pointers to previous blocks.
• Pointers in the linked list refer to the location of other variables and maintain the sequential order
of blocks.
• The blockchain employs a Merkle tree, a binary tree of hashes, to ensure security, integrity, and
immutability.
• The Merkle tree holds important information such as the hash of the previous block, date, nonce,
block version number, and current difficulty goal.
• Transactions on the blockchain are digitally signed, providing authentication and integrity.
• The digital signature allows anyone with the corresponding public key to verify the authenticity of
a transaction.
• Data encryption further enhances security and protects the sender’s or owner’s identity.
• The structure of a block on the blockchain is determined by the data layer.
16 1 Introduction to Blockchain

1.11.3 Network Layer

The network layer, also known as the P2P layer, is responsible for facilitating communication between
nodes in a blockchain network. It enables transactions, block propagation, and discovery among the
nodes. Some important features of the network layer are as follows:

• The network layer focuses on maintaining the validity of the blockchain network’s current state by
enabling effective communication, synchronization, and information propagation between nodes.
• In a P2P network, distributed nodes collaborate to achieve a common goal, and in the context of
blockchain, they perform tasks related to transactions and contribute to the overall functioning of
the network.
• There are two types of nodes: full nodes and light nodes. Full nodes handle crucial functions
such as mining, enforcing consensus rules, and validating transactions. Light nodes, on the other
hand, have limited capabilities and primarily store the blockchain headers, allowing them to send
transactions but with fewer responsibilities compared to full nodes.

1.11.4 Consensus Layer

The consensus layer is a critical component of blockchain platforms like Ethereum, Hyperledger, and
others. It plays a fundamental role in the functioning of these platforms. Some of the notable feature
of the consensus layer are as follows:

• The consensus layer validates blocks, ensures correct ordering, and achieves agreement among
participants.
• In a distributed P2P network, the consensus layer establishes essential agreements and rules for
maintaining integrity and security.
• Consensus ensures agreement on the validity and order of transactions, preventing manipulation
and maintaining fairness.
• The consensus layer maintains power distribution and decentralization, preventing a single entity
from controlling the blockchain.
• It enables collective decision-making and agreements among network participants.

1.11.5 Application and Presentation Layer

This is the nearest layer from user perspective. Some of the important features of this layer are:

• The application and presentation layer is the user-facing part of the blockchain that provides a
graphical user interface (GUI) and allows users to interact with the network.
• It includes execution layer and application layer protocols, such as smart contracts, scripts, and
frameworks.
• Users can communicate with the blockchain network through various applications like wallets,
social media apps, browsers, and NFT platforms.
• These applications interact with the blockchain network using application programming interfaces
(APIs).
• The semantic layer within this layer is where transaction validations and executions take place,
ensuring the integrity and accuracy of transactions.
1.12 A Block and Its Structure 17

• One key characteristic of these applications is their decentralized data storage, which sets them
apart from traditional applications.
• Decentralized data storage provides secure and tamper-proof storage of data, enhancing the overall
security and trustworthiness of the blockchain network.
• Users can access and manage their data securely within these applications, knowing that their
information is stored in a decentralized and immutable manner.

1.12 A Block and Its Structure

A block is an essential component of a blockchain, typically comprising a collection of transactions.


Its structure consists of a preamble that stores metadata such as a timestamp and reference to the
previous block (known as the parent block) and a body that contains the actual transaction data. The
unique cryptographic hash of each block ensures the chain’s integrity. Blocks are chained together in
chronological order to create a secure and immutable ledger.

1.12.1 A Block

A blockchain block is a fundamental component of a blockchain database that serves as a data


structure for permanently recording transaction data in a cryptocurrency blockchain. It contains a
collection of the most recent transactions that have not yet been validated by the network. Once
the data within a block are validated, the block is considered closed, and a new block is created to
accommodate and validate new transactions.
The significance of a block lies in its role as a secure and immutable storage unit. Once information
is written into a block, it becomes a permanent part of the blockchain and cannot be altered or removed
without detection.

1.12.2 Block Structure

The structure of a block in a blockchain can vary depending on the specific implementation and type
of blockchain. However, in general, a block typically consists of several components (Figure 1-8).

• Block header: The block header contains metadata about the block, including the block number,
timestamp, and the hash of the previous block in the chain.
• Nonce: A nonce is a random number generated by miners in order to solve the cryptographic
puzzle required to add a block to a blockchain.
• Transaction data: The transaction data section contains the actual data that are being added to the
blockchain. This can include information such as the sender and recipient addresses, the amount
of cryptocurrency being transferred, and any additional data related to the transaction.
• Block hash: The block hash is a unique identifier that represents the contents of the block. It
is generated by hashing the block header and transaction data using a specific cryptographic
algorithm.
• Merkle tree: The Merkle tree is a data structure used to efficiently store and verify large amounts
of transaction data. The transactions are hashed and combined in pairs to form a series of hashes,
which are then combined until a single root hash is produced.
18 1 Introduction to Blockchain

Figure 1-8 Block structure

1.12.3 Ledger

In the context of blockchain, a ledger is a digital record-keeping system that records all transactions
made on the network. The ledger maintains a permanent and tamper-proof record of all transactions.
Since a blockchains commonly track transactions, they are often referred to as ledgers or some times
distributed ledgers.
The ledger is decentralized; no central authority controls it. Instead, all nodes on the network have
a copy of the ledger. The copy is updated in real time as long as new transactions are made. All nodes
can view the transactions and their associated data.
The ledger is usually maintained using cryptographic algorithms, such as hashing, ensuring the
integrity and security of the data. Each block on the blockchain contains a hash of the previous block,
creating a chain of blocks that are linked together. This creates an immutable ledger that cannot be
altered or tampered with without the consensus of the network. To say that anyone can operate a node
means the blockchain can be stored in a distributed manner called a distributed ledger. This makes it
very difficult for an attacker, who must make changes to a number of copies across the network. This
causes the prevention of a denial-of-service (DoS) attack, since there is no single point of failure.
The ledger can also be permissioned or permissionless. In a permissioned blockchain, access to
the ledger is restricted to authorized participants, whereas in a permissionless blockchain, anyone can
participate in the network and view the ledger.
The ledger provides a transparent, secure, and tamper-proof record of all transactions made on the
network.
1.12 A Block and Its Structure 19

1.12.4 Distributed

Distributed refers to the way in which data are stored and processed across a network of computers
or nodes. The workload is shared across multiple nodes, rather than being centralized in a single
location.
Allowing anyone to operate a node means the blockchain can be stored in a distributed manner.
Each node has a copy of the entire blockchain, and each node is responsible for verifying transactions
and maintaining the integrity of the network. Distributed architecture provides several benefits,
including the following:

• Resource sharing:
In a distributed system, computers connect and share resources like software and hardware. Re-
source sharing involves remote access to components, reducing costs and improving convenience.
Data sharing ensures consistency and facilitates information exchange.
• Heterogeneity:
Distributed systems are diverse, with varying hardware, programming languages, networks, and
implementations, all working together efficiently.
• Scalability:
Scalability in distributed systems involves accommodating more users and computers, without
altering components but designing them to handle growth effectively.
• Concurrency:
The concurrency property of distributed systems enables simultaneous execution of multiple ac-
tivities across different machines, managed by a common system, allowing for parallel processing.
• Fault tolerance:
Distributed systems enhance fault tolerance and availability through software recovery and
hardware redundancy, ensuring reliable operation despite failures.
• Openness:
Openness in distributed systems refers to their capability to adapt and enhance hardware and
software components as needed, enabling seamless integration of new components through
standardized interfaces. This ensures compatibility and allows for resource sharing services.

1.12.5 Transparency

Transparency refers to the ability of anyone on a network to view and verify transactions and other
data on the blockchain.
In a blockchain network, transactions are public and visible to all nodes on the network. This
means that anyone can view the transaction data, including the sender, receiver, amount, and all other
relevant details.
The transparency of the blockchain provides several benefits, as follows:

• Trust:
The transparency of blockchain instills trust by allowing anyone to verify the validity and proper
execution of transactions.
• Accountability:
The public nature of blockchain ensures accountability for all participants’ actions on the network.
20 1 Introduction to Blockchain

• Fraud prevention:
The transparency of blockchain makes it more difficult for bad actors to commit fraud or engage
in other malicious activities on a network.
• Efficiency: The transparency of blockchain improves network efficiency by eliminating intermedi-
aries and reducing transaction costs.

1.12.6 Confirmation

Block confirmation refers to the process of validating and adding transactions to a blockchain. This
verification involves solving mathematical puzzles, ensuring transaction integrity, and preventing
double-spending. Nodes compete to solve these puzzles, and the first node to succeed is rewarded
for its efforts. Validated transactions are added to a block, which is then appended to the blockchain
through the process of mining.
Block confirmation is crucial for maintaining the integrity and security of the blockchain.
Once a transaction is confirmed and added to the blockchain, it becomes permanent and cannot
be altered. This process eliminates the need for intermediaries, enhances network efficiency, and
reduces transaction costs. Confirmation helps prevent fraudulent activities and ensures trust within
the blockchain network.

1.12.7 Proof of Work

Proof of work (PoW) is a consensus algorithm used in most cryptocurrencies to prevent double-
spending. It requires users to solve complex mathematical puzzles to validate transactions and add
them to the blockchain. PoW ensures transaction integrity and prevents fraud, making it necessary for
maintaining a secure and trustworthy network.
In PoW, transactions are grouped into blocks, and miners use computing power to hash block
data and find solutions to puzzles. The hashing process creates a unique fingerprint for each block,
making it impossible to reverse-engineer the original data. Miners play a guessing game, modifying
a nonce value until they find a hash that meets protocol conditions. Successful miners are rewarded
with cryptocurrency and can broadcast the new block to the network, where other participants update
their blockchains accordingly.
The difficulty of finding valid hashes increases with network hash rate, ensuring a controlled block
discovery rate. While mining can be computationally expensive, the potential rewards incentivize
miners to contribute their resources to secure the blockchain.

1.12.8 Block Awards

Block rewards, also known as mining rewards, are a type of incentive provided to miners in a
blockchain network as compensation for their efforts in verifying transactions and adding new blocks
to the blockchain.
The block reward consists of newly generated coins and transaction fees given to miners for
securing the network. As an example, the current reward is 6.25 coins per block, which undergoes
a halving event every four years to limit the total supply. While the block reward remains stable,
transaction fees can fluctuate. Transactions are initiated through a wallet and transmitted to a
decentralized network of nodes, which validate and authenticate the transaction details. Nodes play
Random documents with unrelated
content Scribd suggests to you:
lines. Downright fraud is possible, as in the concealment or false
weighing of dutiable articles, the publication of false statements
regarding the financial condition of fiduciary institutions, the covering
up of defects in tenement house building, and so on. Practices of this
character are extremely dangerous, however, as they are subject to
detection and consequent punishment by the first more than
ordinarily inquisitive inspector. Criminal chances are materially
improved by the bribery of officials who are thus bound to
concealment both by money interest and their own fear of exposure.
Vigilant and honest administration of the laws and the infliction of
sufficient penalties, particularly if they involve the imprisonment of
principals, may be trusted to reduce such practices to a minimum.
There are, however, other and more open methods of attack upon
the regulation of business by the state. Appeal may be made to the
courts in the hope that laws of this character may be declared
unconstitutional. Business interests may also seek their repeal or
amendment at the hands of the legislature. No one who accepts the
fundamental principles of our government can quarrel with either of
these two modes of procedure. While doubtless intended to secure
the public interest, attempts to regulate industry by the state may in
given cases really defeat this end. And the latter likelihood would be
increased almost to the point of certainty if legitimate protests from
the businesses affected were stifled. On the other hand attempts
may be made by business interests to influence courts or
legislatures corruptly. Assuming that the honesty of all the
departments of government would be proof against such attempts
there is still another possibility. A business affected by some form of
state regulation may endeavour to call to its aid the influence of
party. This final method of procedure may also be conducted in a
perfectly legitimate fashion. Public sentiment may be honestly
converted to the view that the amendment or repeal of the law, as
demanded by the business interest, is also in the interest of the state
as a whole. On the other hand the effort may be made, either by
large contributions to campaign funds, or by other still more
objectionable means, to enlist the support of party regardless of the
public welfare. Carrying out these various methods of procedure to
their logical conclusion brings us, therefore, face to face with the
question which underlies the whole fabric of political corruption,
namely how shall our party organisations be supported and
financed?
Reserving this issue for subsequent discussion, certain general
features of the reaction of industry against state regulation must be
noted as of immense importance. Black as it is corruption after all is
a mere incident in this struggle. The broad lines of development
which the Republic will follow in the near future would seem to
depend largely upon the outcome of this great process. Certain
social prophets tell us insistently that there are but two possibilities: if
the state wins the upper hand the inevitable result will be socialism; if
on the other hand business triumphs we must resign ourselves to a
more or less benevolent financial oligarchy. Imagination is not
lacking to embellish or render repulsive this pair of alternatives. From
Plato to Herbert George Wells all social prophets have been thus
gifted with the power of depicting finely if not correctly the minutiæ of
the world as it is to be. Time, the remorseless confuter of all earlier
forecasters of this sort, has shown them to be singularly lacking in
the ability to anticipate the great divergent highways of development,
—sympodes in Ward’s phrase,—which have opened up before the
march of human progress and determined the subsequent lines of
movement. So it may well be in the present case. The social futures,
one or the other of which we are bidden by present day prophets to
choose, are like two radii of a circle. They point in very different
directions, it is true, but between them are many possible yet
uncharted goals. And if social development may be likened to
movement in three instead of only two dimensions the lines open to
the future are enormously more divergent than our seers are wont to
conceive. Employing a less mathematical figure, prophecy usually
proceeds from the assumption that cataclysmic changes are
immediately impending. Otherwise, by the way, the prophets would
utterly fail to attract attention. But this presupposes an extremely
plastic condition of society. If social structures, however, really are so
plastic, they may then be remoulded not into one or two forms
merely, but into many other forms conceivable or inconceivable at
the present time. Current and widely accepted forecasts to the
contrary, therefore, one may still venture to doubt that our through
ticket to 1950 or 2000 a.d. is inscribed either “socialism” or “financial
oligarchy,” and stamped “non-transferable.”
Whatever the future may bring forth faith has not yet been lost in
the efficacy of state regulation. It is certainly within the bounds of
possibility that some working balance between government and
industry may be established through this means which will continue
indefinitely. As late as 1870, according to Mr. Dicey, individualistic
opinions dominated English law-making thought.[57] Reaction from
the doctrine of laisser faire was, if anything, even later in the United
States. For a considerable period after the turning point had been
passed measures of state regulation were weakened by survivals of
old habits of thought. Even to-day the period of construction and
extension along the line of state regulation seems far from finished.
Certain inevitable errors have required correction, but no major
portion of the system has been abandoned. Further progress should
be made easier by accumulating experience and precedents.
It is significant of the temper of the American people on this
question that an increasing number of the great successes of our
political life are being made by the men who have shown themselves
strongest and most resourceful in correcting the abuses of business.
Under present conditions no public man suspected of weakness on
this issue has the remotest chance of election to the presidency or to
the governorship of any of our larger states. On the purely
administrative side of the system of state regulation new and more
powerful agencies,—such as the Bureau of Corporations and the
various state Public Service Commissions,—have been devised
recently to grapple with the situation.
Considering the extreme importance of the work which such
agencies have to perform it is improbable that either their position, or
the position of government in general, is as yet sufficiently strong
with reference to corporate interests. Under modern conditions
success in business means very large material rewards. Important
as are industry and commerce, however, certain parts of the work
which the state is now performing are, from the social point of view,
immensely more valuable. The commonweal requires that our best
intellect be applied to these tasks. Any condition which favours the
drafting of our ablest men from the service of the state into the
service of business is a point in favour of the latter wherever the
conflict between them is joined. Yet not infrequently we witness the
promotion of judges to attorneyships for great corporations, the
translation of men who have won their spurs in administrative
supervision of certain kinds of business to high managerial positions
in these same businesses. As long as our morals remain as
mercenary as those of a Captain Dugald Dalgetty there may seem to
be little to criticise in such transactions. Doubtless loyalty is shown
by the men concerned to the government, their original employer,
and to the corporation, their ultimate employer. If, however, there is
to be an exchange of labourers between these fields it would be
vastly better for the state if the man who had succeeded brilliantly in
business should normally expect promotion to high governmental
position. As things are at present the glittering prizes known to be
obtained by ex-government officials who have gone into corporation
service cannot have the most favourable effect upon the minds and
activities of officials remaining in public positions requiring them to
exercise supervision over business activities.
It is high time that there should be a reversal of policy in this
connection. We need urgently greater security of tenure, greater
social esteem, much higher salaries, and ample retiring pensions for
those public officials who are on the fighting line of modern
government. Incomes as large as those of our insurance presidents
or trust magnates are not needed, although in many cases they
would be much more richly deserved. There is recompense which
finer natures will always recognise in the knowledge that they are
performing a vitally important public work. In spite of the loss which
political corruption causes the state it is probably more than made up
by the devoted, and in part unrequited, work of its good servants.
Still the labourer is worthy of his hire. It is both deplorable and
disastrous that the current rewards of good service should be so
meagre while the rewards of betrayal are so large.[58]
But it may be objected that public sentiment in a democracy will
not support high salaries even for the most important public services,
that democracies notoriously remunerate their higher officials very
much less adequately than monarchies. The time is ripe, however,
for challenging this attitude. As long as government work is looked
upon as a dull, soulless, and not extremely useful routine, popular
opposition to high salaries is not only comprehensible but
praiseworthy. Once convinced of the value of certain services,
however (and there is plentiful opportunity to do this), it is doubtful if
self-governing peoples will show themselves less intelligent than
kings. Even now engineers directing great and unusual public
undertakings are frequently paid larger salaries than high officers of
government charged with the execution of ordinary functions.
Recognition of the importance of the work of the specialist is much
more common now than formerly. The development of science and
large scale industry is daily enforcing this lesson. As regards the
unwillingness of democracy to pay well, a change that has recently
come over the policy of certain labour unions is worth noting. Instead
of ordering strikes they have on occasion taken a lesson from the
procedure of their employers, and resorted to the courts for the
redress of grievances. And in doing so they have called in the very
ablest lawyers they could find, paying the latter out of the funds of
the union fees as large as they could have earned on the opposing
side. A similar illustration is afforded by the policy of the Social-
democratic party in Germany which for a considerable period has
recognised and met the necessity of remunerating its leaders in
editorial, parliamentary, and propagandist work at professional rates
far higher than the average wages received by the party rank and
file.[59] Demos may despise aristocracy of birth but he is perhaps not
so incapable of comprehending the aristocracy of service as many of
his critics suppose.

By the system of regulation, as we have seen, government is


brought into close contact with business along many lines. But the
state is also one of the largest sellers and buyers in the markets of
the world, and as such has many other intimate points of contact
with economic affairs. Like any individual or corporation under the
same circumstances it is liable to be victimised by practices
designed fundamentally to make it sell cheaply or buy dearly,—both
to the advantage of corrupt outside interests. Franchise grabbing is
perhaps the most magnificent single example of the difficulties the
state encounters when it appears as a vendor. Popular ignorance of
the real nature of such valuable rights has been responsible for
enormous losses on this score. A city which for any reason had to
dispose of a parcel of land would find itself safeguarded in some
measure by the fact that a large number of its citizens were familiar
with real estate values and methods. Knowledge of intangible
property is very much less common. There has been a great deal of
effective educational work along this line, however, and that
community is indeed backward which at the present time does not
understand perfectly that perpetual franchises without proper
safeguards of public interests are fraudulent on their face.
Administrative agencies such as were referred to in connection with
business regulation, and particularly public service commissions, are
doing extremely valuable work in cutting down the possibilities of
franchise corruption. The grabbing of alleys, the seizure of water
fronts, and the occupation of sidewalks are minor forms of the same
sort of evil which can no longer be practised with the impunity
characteristic of the good old free and easy days of popular
ignorance and carelessness.
In disposing of its public domain, although here, of course, the
price obtained was not the major consideration on the part of the
government, notorious cases of corruption were of common
occurrence. Recent developments, particularly in connection with
timber, mineral, and oil lands, reveal the stiffer attitude which the
public and the government are taking on this question. Time was
also when deposits of public funds yielded little or no interest to cities
and counties. At bottom such loan transactions were sales, i.e., the
sale of the temporary use of public monies. Quite commonly
treasurers were in the habit of considering themselves responsible
for the return of capital sums only, and any interest received was
regarded as a perquisite of office. The system had all the support of
tradition and general usage; it was frequently practised with no effort
at concealment and without protest on moral or business grounds.
Nowadays its existence would be regarded as a sign of political
barbarism, and would furnish opportunity for charges of corruption
about which effective reform effort would speedily gather.
The element of selling is not of major importance in many services
performed by the state which nevertheless require constant watching
in order to prevent corrupt misuse. Efforts to use the mails
improperly are continually being made by get-rich-quick schemes,
swindlers, gamblers, and touts of all descriptions. Crop reports are
furnished without charge, but extraordinary precautions are
necessary to prevent them from leaking out.
Instances such as the foregoing also serve to illustrate the point
that any extension of the functions of government results in an
enlargement of the opportunities for political corruption. Government
railways, for example, would afford venal public officials many
crooked opportunities (as e.g., for false billing, charges, and
discrimination) which do not now exist as direct menaces to public
administrative integrity. Private management of railways, however,
has not been so free from such evils as to be able to use this
argument effectively against nationalisation. Municipalities selling
water, gas, or electricity, are notoriously victimised on a large scale
by citizens whose self-interest as consumers overcomes all thought
of civic duty or common honesty.[60] There is one other closely
related phenomenon connected with the extension of the economic
functions of government which will perhaps not so readily be thought
of as corrupt, and which yet deserves consideration from that point
of view. Public service enterprises under government ownership and
management are always exposed to what some writers stigmatise as
“democratic finance,”—that is strong popular pressure to reduce
rates. Cost of production and the general financial condition of a
given city may make the reduction of the prices charged for water,
electricity, or gas, frankly contrary to public policy. Yet the self-
interest of the consumer suggests the use of his vote and political
influence to compel such reductions. Of course his action is not
consciously corrupt, but it has every other characteristic feature of
this evil.
The state is a much larger buyer than seller, and manifold are the
possibilities of malpractice in connection with its enormous
purchases of land, materials, supplies, and labour. Yet nothing in our
contemporary political life is more marvellous than the light-hearted
indifference with which the public regards the voting and expenditure
of sums running into the millions. We recall vaguely that the great
constitutional issues of English history were fought out on fiscal
grounds, but we find the budget of our own city a deadly bore. We
rise in heated protest whenever the tax rate is advanced by a
fraction of a mill, but we regard with indifference the new forms either
of necessary expenditure or needless extravagance which make
such increases inevitable. There is one general advantage which
state buying has over state selling, however. A great many of the
purchases of government are made in competitive markets where
fair price rates are ascertainable with comparative ease. Even large
public contracts such as for erecting public buildings or for road
construction are usually resolvable into a number of comparatively
simple processes and purchases. Of course there are exceptions, as
for example government contracts with railroad companies for
carrying mail. But as a rule the ordinary purchasing operations of the
state are simpler and more easily comprehensible than such acts of
sale as franchise grants,—to mention the one of most importance
from the view point of possible corruption. It is precisely at this
vulnerable point on the buying side of governmental operations that
the New York Bureau of Municipal Research has struck home. With
a skill that amounts to positive genius this voluntary agency has
placed before the people the ruling market prices and the
enormously higher prices actually paid by officials for public supplies.
Taking the purchasing departments of our best organised private
corporations as a model it has drawn practical plans for the
installation of similar methods as part of our municipal machinery.
Equipped with field glasses and mechanical registering devices its
agents have kept tab upon the flaccid activities of labourers in the
public service and have contrasted the long distance results thus
obtained with the suddenly energised performances of the same
men when they knew themselves to be under observation. It has co-
operated quietly and effectively with all willing officials in improving
the methods of work in their offices, in installing more logical
accounting systems and better methods of recording work done; and
it has fought effectively, with the penalty of discharge by the
Governor in two cases, those officials who were not amenable to
proper corrective influences. And finally the Bureau has attacked the
city budget and has even succeeded in making that dry and
formidable document the object of active and intelligent public
interest. Yet the cost of the Bureau’s work has been out of all
proportion small in comparison with the benefits obtained. “Less than
$30,000 was spent in 1908 in securing for four million people the
beginnings of a method of recording work done when done, and
money spent when spent, which will henceforth make inefficiency
harder than efficiency, and corruption more difficult than honesty.”[61]
It is extremely gratifying to note the widespread interest which this
work is arousing. Philadelphia and Cincinnati have established
bureaus under the supervision of the parent organisation, and other
cities are earnestly considering similar action. There would seem to
be ample opportunity for the employment of the same sort of agency
in connection with our state governments, and possibly in certain
fields of national administration. Altogether it is by far the most
noteworthy recent effort to stamp out governmental inefficiency and
corruption. Other efforts are being made to the same end,
particularly where extravagance is concerned. In many cities
business men’s clubs, improvement associations, and taxpayers’
leagues, are watching expenditure as it has never been watched
before. Public officials have co-operated loyally in a number of
cases. Occasional discoveries have been made of safeguards and
powers in the law which had been long forgotten or unused. The
progress of uniform bookkeeping is rapid and highly significant in this
connection. Aided largely by the latter development census reports,
particularly the special issues dealing with statistics of cities of over
30,000 inhabitants, are making it possible to compare municipalities
on strictly quantitative lines as to the cost and efficiency of various
services. Altogether we are developing a new financial alertness and
intelligence that should materially cut down various forms of political
inefficiency and corruption, particularly on the purchasing side of
governmental operations. It is not too much to say that the methods
by which these results are to be effected are either at hand or
capable of being worked out on demand. The question now is simply
one of funds and the training of specialists to do the work.

Efforts by the state to regulate or suppress vice and crime bring


about reactions on the part of the interests affected not unlike those
which follow from the attempt to regulate legitimate business.[62] The
corrupt practices thus occasioned are among the commonest and
most objectionable that society has to contend with. Very large
money returns in the aggregate are obtainable by political
organisations which protect vice. It is doubtful, however, whether
such sources of income are ordinarily so productive financially as the
various corrupt relationships between business and politics
described above. On the other hand the alliance between politics
and the underworld has the advantage, from an unmoral point of
view, that it yields not only money but also strong support at the
polls. And as some of the voters whose support is thus secured may
be depended upon for work as repeaters, ballot-box staffers, and
thugs, the net political power which they wield is much greater than
their number alone would indicate. There is one other important
difference between the corruption arising from the attempt to
regulate legitimate business and that which arises from the
regulation of vice. In the former case a “deal” can frequently be
consummated between two principals, the leader of a centralised
business interest on the one hand and the leader of a centralised
political organisation on the other. Something of the secrecy and the
binding personal obligation of a “gentleman’s agreement” are thus
obtained. Of course to carry out the compact the political leader must
control the action of his dependents in public office, but the latter,
whatever they may suspect, know nothing definite about the
agreement into which the boss has entered. The protection of vice
cannot be managed by so small a number of conspirators.
Compliance by the whole police force with orders from the “front” is
necessary. Every patrolman knows what is going on when he is told
that he must not molest dives, gambling hells, or brothels. Members
of the force may or may not be used to collect protection money and
pass it “higher up,” but since there are many establishments which
must pay tribute the employment of a considerable corps of
collectors is necessary. In any event the number of those who have
knowledge amounting to legal evidence is likely to be much larger in
the case of the protection of vice than in the case, for example, of a
corrupt franchise grant. Exposure either by some disgruntled police
officer or by some overtaxed purveyor of vice is likely to come at any
moment.
When revelations of this kind are made the moral uprising which
follows seldom lacks force. Cynics may sneer at such popular
manifestations as paroxysms of virtue, but practical political leaders
are not likely to underestimate the damage which they are capable of
inflicting. Even if the machine emerges comparatively unharmed
from such a period of attack the heads of some of the leaders are
likely to fall before the popular fury. Remembering Fernando Wood’s
caution about the necessity of “pandering a little to the moral
element in the community,” farsighted bosses are therefore more
and more inclined to limit their operations in the field of vice
protection and to seek support from their relations with legitimate
business interests. If this process is carried on further, as now seems
likely, the general problem we are considering will be simplified by
the reduction to a minimum of corruption by the vicious element,
although, of course, we would still have on our hands the large
question of corruption in the interests of otherwise legitimate
business.
With all their mistakes and wasted energy moral uprisings will help
this development materially. After a “spasm” things seldom fall back
into the lowest depths of their former state. We need more frequent
spasms, at least until we shall have learned to live continuously and
steadily on a higher plane. The gravest evil of the present
intermittent situation would seem to be that in our occasional fits of
indignation we write requirements into the law which, considering the
prevalence of minor vicious habits among large masses of the
people, are impossible of execution. One of the lessons which we
have learned in attempting to regulate business is that legislation of
this sort must be supplemented by special administrative agencies if
it is to have any effect whatever. Admirable child labour laws, for
example, remain absolutely futile without labour commissioners and
a force of inspectors created particularly to see them enforced. Yet in
the regulation of vice we rush on heedlessly piling one new duty after
another upon an already overburdened and underpaid police force.
As a consequence its chiefs become habituated to the idea that they
can exercise discretion as to what laws are to be enforced and what
laws may with impunity be neglected. Usually the police decision of
such questions is that crime must be dealt with vigilantly and
severely, vice, on the other hand, with large tolerance. No better
situation could be devised for the schemes of corruptionists.
Moreover the latter are materially aided in their nefarious work by the
high standards and the severe penalties which the moral element
has written into the law. Using these as clubs the corrupt politician
can extort much larger contributions than would otherwise be
possible. There are only two ways in which this situation may be
met. Either we must reduce our too ambitious programmes for the
regulation of vice, or we must strengthen our police forces until they
are adequate to meet the demands placed upon them.
In whatever way this question may be decided there is ample
ground for demanding the application of the most thoroughgoing civil
service reform rules to our police establishments. It is well known
that the rank and file of our police forces despise the dirty work
forced upon them by the political wretches “higher up.” No man
capable of the heroic deeds which are commonplace in the annals of
the police service rings the doors of bawdy houses and collects a
tithe from the sorrowful wages of shame except under the
compulsion of the sternest bread and butter necessity. Usually it is
necessary to select the yellow dogs of the force for this particular
devil’s work, and the promotion of such creatures for their pliancy is
a stench in the nostrils of their honest comrades. If one doubts that
this is the real spirit of the police force let him consider the character
of the fire departments of nearly all of our cities. The men in the latter
service are chosen from the same class, face dangers of the same
magnitude, and receive wages of about the same amount as
policemen. In the main they deserve and receive high praise for their
efficiency and honesty. It is true that they are not exposed to the
corrupt temptations which surround policemen, and also that their
work is held up to exacting standards by business men and
insurance companies. The fact remains that our police forces are
constructed of the same human material as our fire fighting forces. It
is difficult to avoid the conclusion that if we adapt our requirements in
the regulation of vice to the capacities of our forces, (or vice versa); if
we criticise and appreciate their work in the same way as we do the
work of their sister department; if we place their appointment, tenure,
and promotion, upon grounds of merit and utterly exclude the
influence of the corrupt “higher-ups,” we will have gone a long ways
toward drying up the most despicable of the sources of political
corruption.

Certain of the moral aspects of tax dodging have been dealt with
in an earlier connection.[63] Contrary as it may seem to the principle
of economic interest there is a good deal of carelessness and
stupidity in this field, and cases are occasionally found of property
that has been over-assessed. On the other hand more or less
deliberate dodging is indulged in very largely. So far as this practice
deserves the stigma of corruption it is a stigma which rests to a very
considerable extent upon the so-called class of “good citizens.”
Certain residents of “swell suburbs” who daily thank God that their
government is not so corrupt as that of the neighbouring city are
among the worst offenders of this kind. As directors of corporations
men of the same standing are sometimes responsible for
monumental evasions. Of course what was said with regard to the
reaction of business against state regulation holds good here also.
There are plenty of legitimate methods of protesting against unjust or
oppressive taxes,—before the courts, before legislatures, and by
open propaganda designed to influence party organisations. But the
furtive concealment or misrepresentation of taxable values is a
matter of entirely different moral colour, and it is the latter practice
that we now have to consider.
Tax dodging is so common and so well established that it has built
up an exculpatory system of its own. Instead of bringing his
conscience up to the standards set by the law the ordinary property
owner inquires into the practice of his neighbours, and governs
himself accordingly. Wherever business competition is involved the
threat of possible bankruptcy practically forces him into this course.
Yet withal our citizen is likely to be somewhat troubled in his mind
about his conduct, at least until he learns how shamelessly John
Smith who lives just a little way down the street has behaved. This
information quite restores his equanimity, and at the next
assessment he may outdo Smith himself. Thus the extra legal, if not
frankly illegal, neighbourhood standard tends constantly to become
lower. And not only taxpayers but tax officials themselves are
affected by local feeling and fall into the habit of closing their eyes to
certain kinds of property and expecting only a certain percentage of
the valuation fixed by law to be returned.
Back of such neighbourhood ideas on taxation there are at least
two lines of defence. One is that our present tax system is highly
illogical, bothersome, and burdensome. To a considerable extent,
unfortunately, this is the case, but it does not justify illegal methods
of seeking redress. Not much argument is required to convince the
ordinary property owner that all the inequities of the existing system
fall with cumulative weight upon his devoted head. His pocketbook
affirms this view more strongly perhaps than he would care to admit,
but anyhow the net result is that he feels himself more or less
pardonable for evading the burden as far as he can. The other
common excuse for tax dodging is supplied by the conviction that
much of the money raised by government is wasted or stolen. The
logic based upon this premise is most curiously inverted, but none
the less it sways the action of great multitudes. Politicians are a set
of grafters, says our taxpayer. The more money they get the more
they will waste and steal. I will punish the rascals as they deserve by
dodging my taxes, that is by becoming a grafter myself. Seldom,
however, is the latter clause clearly expressed. Yet the existence of
corruption on one side of the state’s activities is thus made the
excuse for corruption on another side whereby the state is mulcted
of much revenue which it might receive. Of course evasion results in
higher tax rates, which, by the way, fall crushingly upon the citizen
who makes full and honest returns, and thus part of the loss in
income to the government is made up. It seems clear, however, that
in the long run government income is materially reduced by the
feeling prevalent among taxpayers which has just been described
and the procedure based upon it. On the whole this is by far the
most serious single economic consequence of political corruption. It
is bad enough that public money should be stolen, that public work
should be badly done, and that politicians and contractors should
grow rich in consequence, but it is far worse that the state should be
starved of the funds necessary to perform its existing functions
properly and to extend its activities into new fields. In the regulation
of industry, in education, philanthropy, sanitation, and art, American
government is very far from achieving what it should do in the public
interest and what it could do more efficiently and cheaply than any
other agency. Yet our progress toward this goal is perpetually
hindered by the existence of waste and corruption on the one hand,
and the consequent peremptory shutting of the taxpayers’
pocketbooks on the other hand.
Consideration of the theory underlying tax dodging reveals certain
broad lines of correction. In proportion as our tax system
approximates greater justice, the evasion which defends itself on the
ground of the inequities of the present system will tend to disappear.
To show how this may be done is beyond the limits of the present
study. Suffice it to say that the work which reformers and students of
public finance are now doing on inheritance, income, and corporation
taxes, on the taxation of unearned increment, on various applications
of the progressive principle, and so on, should eventuate in the
tapping of much needed new sources of income, and thus facilitate
the correction of present unjust burdens. The introduction of
economical methods and the elimination of the grosser forms of
corruption in the field of government expenditure will weaken the
excuses offered for evasion on the ground of public waste and graft.
There is an overwhelming mass of evidence to show that the
American taxpayer, once convinced of the necessity of a given public
work and further assured that it will be honestly executed, is
generous to the point of munificence. The annals of our cities are full
of the creation of appointive state boards composed of men of the
highest local standing and intrusted with the carrying out of some
great single project,—the erection of a city hall building, the
construction of a water works and filtration plant, or of a park system.
Very few such commissions are grudged the large sums of money
necessary for their undertakings. If every ordinary branch of our
government enjoyed public confidence to a similar degree such
special boards would no longer be needed, and ample funds would
be forthcoming from taxpayers for all our present functions and for
other new and worthy functions which might be undertaken greatly to
the public advantage. Finally our system of tax administration, like
our system of government regulation of business, needs
strengthening. Larger districts and centralised power in the hands of
the assessors will help to lift them above the neighbourhood feeling
which is responsible for so much evasion. Higher salaries will bring
expert talent and backbone sufficient to resist the pressure brought
to bear by large interests. As a matter of fact the first threat of a virile
execution of the laws wipes out a considerable part of the tax
dodging in a community.
There would also seem to be much virtue in the plan for the
reduction of the tax rate advocated by the Ohio State Board of
Commerce.[64] Given a community with a high general tax rate it
may be the case, for example, that only about fifty per cent of true
value is being returned. Everybody knows it; everybody is sneakingly
ashamed of it. Still fundamental honesty is supposed to exist in the
man who does not cut the percentage below say, forty; the really
mean taxpayer is he who risks twenty-five per cent on what he feels
obliged to return and conceals whatever he can into the bargain.
Under such circumstances it is proposed to take the heroic step of
reducing the tax rate to one-half its existing figure or even less.[65] If
this can be done it is hoped that taxpayers can be induced to return
their property at full value, and that much personal property will
come out of the concealment into which it has fled under the menace
of a high general property tax rate. In support of this argument cases
are cited where a reduction of the personal property tax rate alone
has brought in much larger returns and converted into a source of
revenue a form of taxation which everywhere under high rates shows
a tendency to dwindle to practically nothing.
As against the plan it may be said that taxpayers are habitually
suspicious and extremely likely to regard any change whatever as
certain to increase their burdens. Many of them would see nothing in
the proposition beyond a tricky device to screw up their valuations
under the pretext of low rates with the intention of falling upon them
later with rates as high or higher than before. Unless the reform were
fully understood and then backed up by the most vigorous
administration there would be grave danger that revenues would
materially suffer. Given these conditions essential to success,
however, the plan would seem decidedly worth trying. A community
willing to take the plunge, it is pointed out, would enjoy large
advantages over its less enterprising competitors in the advertising
value of a low tax rate, particularly as a means of inducing new
industries to locate in its midst. The reform would probably not
increase revenue, indeed it does not aim to do so, but it would yield
a moral return of immense value. Self respect would be restored to
many otherwise thoroughly good citizens, and public opinion, to the
tone of which the taxpaying class contributes largely, would be lifted
to higher planes. Under the present vicious system there must be a
considerable number who realise secretly and more or less vaguely
the inherent kinship between their conduct and that of the corrupt
political organisation under which they live, and who in consequence
remain inactive and ashamed when movements for better things in
city, state, or nation, are on foot.

In our earlier study of the nature of political corruption an effort


was made to distinguish between bribery and auto-corruption. As
examples of the latter, legislators may employ knowledge gathered
on the floor of the chamber or in committee rooms for the purpose of
speculating to their own advantage on stock or produce exchanges;
administrative officials who by virtue of their position learn in
advance any information which may affect the market (i.e., crop
reports) can do likewise; knowledge of important judicial decisions
before they are handed down may be exploited in a similar fashion;
insiders who have access to plans for projected public improvements
are in a position to acquire quietly the needed real estate for sale at
much advanced prices to the city or state when condemnation
proceedings are actually begun. In addition to large and striking
transactions of this sort there are innumerable smaller possibilities
for auto-corruption which present themselves to public functionaries
ranging in rank from the highest places in the official hierarchy to that
of the policeman on his beat. Logically the practices under
consideration are not separable from the general forms of political
corruption as the term is applied in the present discussion. Instead
they would seem to be a special method of carrying on corrupt
transactions of many different kinds. All cases of auto-corruption,
however, have the common feature that bribery by an outside
interest is excluded, and this absence of bribery has sometimes led
to the assertion that the practices included under this heading are
“honest grafts.” An illusory appearance of innocence is also
conferred by the difficulty of tracing the incidence of the burdens
resulting from such transactions. There is no moral ground for such
favourable distinctions, however. On the contrary, auto-corruption is
clearly worse than bribery in that an entire transaction of this
character must be guiltily designed and executed wholly by one
person, and that person an official charged with knowledge which
should be used only in the public interest. Moreover the profits of his
secret treachery may be turned entirely into his private bank
account. If so he cannot even plead in justification that he has been
acting in behalf of a party organisation by gathering and contributing
the funds necessary to its management. The latter feature of auto-
corruption stands in need of special consideration.
It may be laid down as a principle of fairly general applicability that
political corruption as such is disadvantageous to the party
organisation permitting it. From a purely tactical point of view it would
be the extreme of bad party management to tolerate loose conditions
under which a large number of officials could graft freely on their own
account and place the entire proceeds in their own pockets. Whether
they confined themselves to auto-corruption or accepted bribes
singly or in combinations the case would not be materially altered. A
day of reckoning at the polls would surely come, and it would find the
party treasury unprovided with the means of defence. Yet conditions
of this character prevailed pretty generally prior to the advent of
strongly centralised political machines. Corruption was extremely
diffuse, personal responsibility for it widely scattered, party
responsibility not so clear. Manipulation required whole corps of
lobbyists, “third houses,” “black horse cavalry,” and the like. Under
present conditions the party organisation with strongly centralised
management has a direct interest in limiting corruption and also in
seeing that contributions which arise from such practices as it
tolerates actually flow into the party war chest. Corruption in purely
selfish interest becomes treachery to the party as well as treachery
to the state. Of course even under strong centralised and permanent
party control cases of auto-corruption still occur, and at times officials
receive bribes without turning in their quotas. If so, however, it may
fairly be presumed that they make their peace with the organisation
in other ways. They may be exempt from paying tribute, but they are
nevertheless obliged to deliver votes or influence. Many sins are laid
at the door of the machine. It has at least the advantage of enabling
us to centralise responsibility for all corrupt practices which occur
under its management.
From this point of view one may undertake an outline of the form
of corruption connected with political control. All the preceding forms
of political corruption may be considered the obverse, this is the
reverse of the die. None of the practices earlier considered can be
carried on without danger; the corruption of political control is the
crooked means of avoiding the cumulative effects of these practices.
It is not popular, it is not good politics even in the narrowest practical
acceptance of that term, for a political organisation to grant corrupt
favours to business, to wink at the violation of the law by vice, to
allow its partisans in office to sell government property cheap and
buy government supplies dear. If any of these things are permitted
the organisation, like the common criminal, must take care to lay
aside “fall money” against a day of trial.
One might feel greater confidence in the restraining influence of
party centralisation were it not for the fact that the more dangerous
to party success are the forms of corruption which an organisation
tolerates the more lucrative they are apt to be. Though its sins be as
scarlet still they produce funds sufficient to buy indulgences and to
leave a handsome profit over. In connection with business
regulation, for example, bribery in any considerable amount is not
possible until legislation is enacted or close at hand. And legislation
of this kind is not likely to be passed or threatened unless a strong
public sentiment demands action. Political manipulation which
attempts to frustrate regulation at such a juncture must sooner or
later prepare itself to reckon with the public sentiment which it has
flouted. Vice cannot be tolerated except in contravention of laws
against it, and to do so means to offend the moral sentiment in the
community which placed such laws on the statute books. Franchise
grabbing is not profitable on a large scale until the experience of
earlier public service corporations has impressed upon the public
mind the great value of such grants. If, nevertheless, grabs are
permitted by the machine, the boodle must be sufficient to pay both
for the personal services involved and to repair any resulting
damage to party prestige at the next election. Of course many
citizens are apathetic with regard to such abuses or even ignorant of
their existence, and there are others who are so involved in corrupt
practices, particularly in connection with tax dodging, meter fixing,
and the protection of vice, that they feel themselves allied in interest
with the party organisation and accordingly vote its ticket. Always,
however, there is a contingent, and frequently it is large enough to
hold the balance of power, which is neither ignorant nor apathetic,
and which, although perhaps too quiescent ordinarily, will rise in
revolt against any organisation which grafts too boldly and too
widely.
The situation of the venal machine is, therefore, substantially this:
more money can be obtained at any time if certain practices
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade

Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.

Let us accompany you on the journey of exploring knowledge and


personal growth!

ebookmass.com

You might also like