Beginning Blockchain (eBook)
XV, 386 Seiten
Apress (Verlag)
978-1-4842-3444-0 (ISBN)
Understand the nuts and bolts of Blockchain, its different flavors with simple use cases, and cryptographic fundamentals. You will also learn some design considerations that can help you build custom solutions.
Beginning Blockchain is a beginner's guide to understanding the core concepts of Blockchain from a technical perspective. By learning the design constructs of different types of Blockchain, you will get a better understanding of building the best solution for specific use cases. The book covers the technical aspects of Blockchain technologies, cryptography, cryptocurrencies, and distributed consensus mechanisms. You will learn how these systems work and how to engineer them to design next-gen business solutions.
- Get a detailed look at how cryptocurrencies work
- Understand the core technical components of Blockchain
- Build a secured Blockchain solution from cryptographic primitives
- Discover how to use different Blockchain platforms and their suitable use cases
- Know the current development status, scope, limitations, and future of Blockchain
Bikramaditya Singhal is a Blockchain expert and AI practitioner with experience working in multiple industries. He is proficient in Blockchain, Bitcoin, Ethereum, Hyperledger, cryptography, cyber security, and data science. He has extensive experience in training and consulting on Blockchain and has designed many Blockchain solutions. He worked with companies such as WISeKey, Tech Mahindra, Microsoft India, Broadridge, Chelsio Communications, and he also co-founded a company named Mund Consulting that focuses on big data analytics and artificial intelligence. He is an active speaker at various conferences, summits, and meetups. He has also authored a book entitled Spark for Data Science.
Gautam Dhameja is a blockchain application consultant based out of Berlin, Germany. For most of this decade, he has been developing and delivering enterprise software including Web & Mobile apps, Cloud-based hyper-scale IoT solutions, and more recently, Blockchain-based decentralized applications (DApps). He possesses a deep understanding of the decentralized stack, cloud solutions architecture and object-oriented design. His areas of expertise include Blockchain, Cloud-based enterprise solutions, Internet of Things, Distributed Systems and Native & Hybrid Mobile apps. He is also an active blogger and speaker and regularly speaks at tech conferences and events.
Priyansu Panda is a research engineer at Underwriters Laboratories, Bangalore, India. He has worked with other IT companies such as Broadridge, Infosys Limited, and Tech Mahindra. His areas of expertise include Blockchain, Bitcoin, Ethereum, Hyperledger, game theory, IoT, and artificial intelligence. Priyansu's current research is on building next-gen applications leveraging Blockchain, IoT, and AI. His major research interests include building Decentralized Autonomous Organizations (DAO), and the security, scalability, and consensus of Blockchains.
Understand the nuts and bolts of Blockchain, its different flavors with simple use cases, and cryptographic fundamentals. You will also learn some design considerations that can help you build custom solutions.Beginning Blockchain is a beginner's guide to understanding the core concepts of Blockchain from a technical perspective. By learning the design constructs of different types of Blockchain, you will get a better understanding of building the best solution for specific use cases. The book covers the technical aspects of Blockchain technologies, cryptography, cryptocurrencies, and distributed consensus mechanisms. You will learn how these systems work and how to engineer them to design next-gen business solutions.What You'll LearnGet a detailed look at how cryptocurrencies workUnderstand the core technical components of BlockchainBuild a secured Blockchain solution from cryptographic primitivesDiscover how to use different Blockchain platforms and their suitable use casesKnow the current development status, scope, limitations, and future of BlockchainWho This Book Is ForSoftware developers and architects, computer science graduates, entrepreneurs, and anyone wishing to dive deeper into blockchain fundamentals. A basic understanding of computer science, data structure, and algorithms is helpful.
Bikramaditya Singhal is a Blockchain expert and AI practitioner with experience working in multiple industries. He is proficient in Blockchain, Bitcoin, Ethereum, Hyperledger, cryptography, cyber security, and data science. He has extensive experience in training and consulting on Blockchain and has designed many Blockchain solutions. He worked with companies such as WISeKey, Tech Mahindra, Microsoft India, Broadridge, Chelsio Communications, and he also co-founded a company named Mund Consulting that focuses on big data analytics and artificial intelligence. He is an active speaker at various conferences, summits, and meetups. He has also authored a book entitled Spark for Data Science. Gautam Dhameja is a blockchain application consultant based out of Berlin, Germany. For most of this decade, he has been developing and delivering enterprise software including Web & Mobile apps, Cloud-based hyper-scale IoT solutions, and more recently, Blockchain-based decentralized applications (DApps). He possesses a deep understanding of the decentralized stack, cloud solutions architecture and object-oriented design. His areas of expertise include Blockchain, Cloud-based enterprise solutions, Internet of Things, Distributed Systems and Native & Hybrid Mobile apps. He is also an active blogger and speaker and regularly speaks at tech conferences and events. Priyansu Panda is a research engineer at Underwriters Laboratories, Bangalore, India. He has worked with other IT companies such as Broadridge, Infosys Limited, and Tech Mahindra. His areas of expertise include Blockchain, Bitcoin, Ethereum, Hyperledger, game theory, IoT, and artificial intelligence. Priyansu's current research is on building next-gen applications leveraging Blockchain, IoT, and AI. His major research interests include building Decentralized Autonomous Organizations (DAO), and the security, scalability, and consensus of Blockchains.
Table of Contents 4
About the Authors 10
About the Technical Reviewer 12
Acknowledgments 13
Introduction 14
Chapter 1: Introduction to Blockchain 15
Backstory of Blockchain 16
What is Blockchain? 18
Centralized vs. Decentralized Systems 25
Centralized Systems 28
Decentralized Systems 29
Layers of Blockchain 31
Application Layer 33
Execution Layer 34
Semantic Layer 34
Propagation Layer 35
Consensus Layer 36
Why is Blockchain Important? 37
Limitations of Centralized Systems 37
Blockchain Adoption So Far 38
Blockchain Uses and Use Cases 40
Summary 42
References 43
Chapter 2: How Blockchain Works 44
Laying the Blockchain Foundation 45
Cryptography 47
Symmetric Key Cryptography 50
Kerckhoff’s Principle and XOR Function 51
Stream Ciphers vs. Block Cipher 52
One-Time Pad 55
Data Encryption Standard 56
Advanced Encryption Standard 61
Challenges in Symmetric Key Cryptography 68
Cryptographic Hash Functions 68
A Heads-up on Different Hash Functions 75
SHA-2 76
SHA-256 and SHA-512 78
RIPEMD 80
SHA-3 80
Applications of Hash Functions 86
Code Examples of Hash Functions 87
MAC and HMAC 89
Asymmetric Key Cryptography 91
RSA 94
Modular Arithmetic 95
Generation of Key Pairs 95
Encryption/Decryption Using Key Pair 97
Digital Signature Algorithm 99
Elliptic Curve Cryptography 101
Elliptic Curve Digital Signature Algorithm 106
Key Generation 106
Signature Generation 107
Signature Verification 107
Code Examples of Assymetric Key Cryptography 108
Diffie-Hellman Key Exchange 111
Symmetric vs. Asymmetric Key Cryptography 115
Game Theory 117
Nash Equilibrium 120
Prisoner’s Dilemma 121
Byzantine Generals’ Problem 123
Zero-Sum Games 125
Why to Study Game Theory 126
Computer Science Engineering 127
The Blockchain 127
Merkle Trees 130
Example Code Snippet for Merkletree 134
Putting It All Together 135
Properties of Blockchain Solutions 137
Immutability 138
Forgery Resistant 138
Democratic 138
Double-Spend Resistant 139
Consistent State of the Ledger 140
Resilient 140
Auditable 140
Blockchain Transactions 140
Distributed Consensus Mechanisms 143
Proof of Work 144
Proof of Stake 146
PBFT 147
Blockchain Applications 148
Scaling Blockchain 152
Off-Chain Computation 153
Sharding Blockchain State 156
Summary 158
References 159
Chapter 3: How Bitcoin Works 162
The History of Money 163
Dawn of Bitcoin 166
What Is Bitcoin? 167
Working with Bitcoins 170
The Bitcoin Blockchain 172
Block Structure 174
Merkle Tree 176
Difficulty Target 178
The Genesis Block 182
The Bitcoin Network 185
Network Discovery for a New Node 187
Bitcoin Transactions 192
Consensus and Block Mining 197
Block Propagation 206
Putting It all Together 208
Bitcoin Scripts 208
Bitcoin Transactions Revisited 209
Scripts 217
Full Nodes vs. SPVs 222
Full Nodes 222
SPVs 223
Bitcoin Wallets 225
Summary 229
References 229
Chapter 4: How Ethereum Works 231
From Bitcoin to Ethereum 232
Ethereum as a Next-Gen Blockchain 233
Design Philosophy of Ethereum 235
Enter the Ethereum Blockchain 236
Ethereum Blockchain 237
Ethereum Accounts 240
Advantages of UTXOs 243
Advantages of Accounts 244
Account State 245
Trie Usage 248
Merkle Patricia Tree 249
RLP Encoding 251
Ethereum Transaction and Message Structure 252
Ethereum State Transaction Function 257
Gas and Transaction Cost 260
Ethereum Smart Contracts 265
Contract Creation 268
Ethereum Virtual Machine and Code Execution 269
Ethereum Ecosystem 275
Swarm 276
Whisper 276
DApp 276
Development Components 277
Web3.js 277
Truffle 277
Mist Wallet 277
Summary 277
References 278
Chapter 5: Blockchain Application Development 279
Decentralized Applications 279
Blockchain Application Development 281
Libraries and Tools 282
Interacting with the Bitcoin Blockchain 284
Setup and Initialize the bitcoinjs Library in a node.js Application 285
Create Keypairs for the Sender and Receiver 286
Get Test Bitcoins in the Sender’s Wallet 287
Get the Sender’s Unspent Outputs 288
Prepare Bitcoin Transaction 290
Sign Transaction Inputs 292
Create Transaction Hex 292
Broadcast Transaction to the Network 293
Interacting Programmatically with Ethereum—Sending Transactions 295
Set Up Library and Connection 296
Set Up Ethereum Accounts 297
Get Test Ether in Sender’s Account 298
Prepare Ethereum Transaction 299
Sign Transaction 300
Send Transaction to the Ethereum Network 302
Interacting Programmatically with Ethereum—Creating a Smart Contract 304
Prerequisites 304
Program the Smart Contract 305
Compile Contract and Get Details 309
Deploy Contract to Ethereum Network 314
Interacting Programmatically with Ethereum—Executing Smart Contract Functions 319
Get Reference to the Smart Contract 320
Execute Smart Contract Function 321
Blockchain Concepts Revisited 324
Public vs. Private Blockchains 325
Decentralized Application Architecture 326
Public Nodes vs. Self-Hosted Nodes 327
Decentralized Applications and Servers 328
Summary 329
References 329
Chapter 6: Building an Ethereum DApp 330
The DApp 330
Setting Up a Private Ethereum Network 332
Install go-ethereum (geth) 332
Create geth Data Directory 333
Create a geth Account 334
Create genesis.json Configuration File 335
Run the First Node of the Private Network 336
Run the Second Node of the Network 340
Creating the Smart Contract 345
Deploying the Smart Contract 355
Setting up web3 Library and Connection 356
Deploy the Contract to the Private Network 356
Client Application 370
Summary 386
References 386
Index 387
| Erscheint lt. Verlag | 6.7.2018 |
|---|---|
| Zusatzinfo | XV, 386 p. 117 illus. |
| Verlagsort | Berkeley |
| Sprache | englisch |
| Themenwelt | Mathematik / Informatik ► Informatik ► Datenbanken |
| Schlagworte | Automation • Bitcoin • Blockchain • Cryptocurrency • cryptography • Development • Ethereum |
| ISBN-10 | 1-4842-3444-8 / 1484234448 |
| ISBN-13 | 978-1-4842-3444-0 / 9781484234440 |
| Informationen gemäß Produktsicherheitsverordnung (GPSR) | |
| Haben Sie eine Frage zum Produkt? |
DRM: Digitales Wasserzeichen
Dieses eBook enthält ein digitales Wasserzeichen und ist damit für Sie personalisiert. Bei einer missbräuchlichen Weitergabe des eBooks an Dritte ist eine Rückverfolgung an die Quelle möglich.
Dateiformat: PDF (Portable Document Format)
Mit einem festen Seitenlayout eignet sich die PDF besonders für Fachbücher mit Spalten, Tabellen und Abbildungen. Eine PDF kann auf fast allen Geräten angezeigt werden, ist aber für kleine Displays (Smartphone, eReader) nur eingeschränkt geeignet.
Systemvoraussetzungen:
PC/Mac: Mit einem PC oder Mac können Sie dieses eBook lesen. Sie benötigen dafür einen PDF-Viewer - z.B. den Adobe Reader oder Adobe Digital Editions.
eReader: Dieses eBook kann mit (fast) allen eBook-Readern gelesen werden. Mit dem amazon-Kindle ist es aber nicht kompatibel.
Smartphone/Tablet: Egal ob Apple oder Android, dieses eBook können Sie lesen. Sie benötigen dafür einen PDF-Viewer - z.B. die kostenlose Adobe Digital Editions-App.
Buying eBooks from abroad
For tax law reasons we can sell eBooks just within Germany and Switzerland. Regrettably we cannot fulfill eBook-orders from other countries.
aus dem Bereich