Building Blockchain Apps

Author:

Language: English
Cover of the book Building Blockchain Apps

Subject for Building Blockchain Apps

39.40 €

In Print (Delivery period: 14 days).

Add to cartAdd to cart
Publication date:
336 p. · 17.8x23 cm · Paperback

A Developer's Guide to Blockchain Programming Fundamentals
Blockchain development is entering a period of explosive growth, as real applications gain traction throughout multiple industries and cryptocurrencies earn greater acceptance throughout the financial sector. Blockchain represents one of the most promising opportunities for developers to advance and succeed. Building Blockchain Apps is an accessible guide to today?s most advanced and robust blockchain programming models and architectures.
Building on his pioneering experience, Michael Juntao Yuan covers a wide range of blockchain application development paradigms. The book starts with a concise introduction to blockchain and smart contract technologies. It then guides you through application development on Ethereum-compatible smart contract platforms. Ethereum is the largest and most robust blockchain ecosystem in the world.
Coverage includes

  • Ethereum topics such as tools, application frameworks, internal data structures, external data interfaces, and future roadmap
  • An introduction to new blockchain data protocol based on ElasticSearch, which provides insights into the current state of smart contracts and enables new application designs
  • How to build an application-specific smart contract protocol by modifying and customizing the open source Ethereum Virtual Machine and its programming language tools
  • How to extend and support language features that are most suitable for particular kinds of smart contracts (e.g., smart contracts for e-commerce marketplaces) with the open source Lity project
  • How to customize and change the blockchain consensus layer beneath the application layer via the popular Tendermint and Cosmos SDK frameworks
  • A survey of cryptocurrency and financial topics from the developers? point of view, providing an analytical framework for valuating cryptocurrencies and explaining the roles of crypto exchanges

Register your book for convenient access to downloads, updates, and/or corrections as they become available. See inside book for details.

Foreword xvii
Acknowledgments xix
About the Author xxi

Part I: Introduction 1
Chapter 1: An Introduction to Blockchain 3

The Blockchain 3
The Collaborative Ledger 4
Cryptocurrency 5
Smart Contracts 5
A Trustless Network 6
New Ways of Collaborating 7
The Fat Protocol 7
In Code We Trust 8
Conclusion 9
Chapter 2: Reaching Consensus 11
What Is Blockchain Consensus? 11
Proof of Work (PoW) 12
Proof of Stake (PoS) 12
Delegated Proof of Stake (DPoS) 14
Conclusion 14
Chapter 3: Your First Blockchain App 15
Smart Contract 16
Front-End HTML 19
JavaScript and web3.js 19
In Action 21
Share Your Dapp 22
Conclusion 22
Part II: An Introduction to Ethereum 23
Chapter 4: Getting Started 25

The BUIDL Way 26
The Hard Way 29
Conclusion 41
Chapter 5: Concepts and Tools 43
Ethereum Wallet and Basic Concepts 43
Etherscan 45
The TestRPC 46
Interacting with Ethereum via GETH 48
Interacting with Ethereum via web3 49
Running an Ethereum Node 50
Running a Private Ethereum Network 51
Conclusion 53
Chapter 6: Smart Contracts 55
“Hello, World!” Again 55
Learning Smart Contract Programming 57
Building and Deploying the Smart Contract 59
Calling Smart Contract Functions 65
A New Language 68
Conclusion 72
Chapter 7: Decentralized Applications (Dapps) 73
Dapp Stack 74
Dapp Showcases 76
Conclusion 79
Chapter 8: Alternatives to Dapps 81
JavaScript 81
Python and Others 85
Conclusion 86
Part III: Ethereum in Depth 87
Chapter 9: Inside Ethereum 89

What Is Blockchain State? 89
Ethereum State 92
Trie (or Tree) 93
Trie Structure in Ethereum 98
Analyzing the Ethereum Database 100
Conclusion 104
Chapter 10: Blockchain Data Services 105
Blockchain Explorers 105
Harvesting Data 109
Query Interface 115
What’s Next? 119
Conclusion 120
Chapter 11: Smart Contract Search Engine 121
Introduction to the Smart Contract Search Engine 121
Getting Started with a Smart Contract Search Engine 123
The FairPlay Dapp Example 128
Use Cases 131
Conclusion 132
Chapter 12: Smart Contract Security and Best Practices 133
Major Ethereum Smart Contract Hacks and Vulnerabilities 134
Best Practices for Securing Smart Contracts 141
Conclusion 143
Chapter 13: The Future of Ethereum 145
Ethereum 1.0 146
Beyond Ethereum 1.0 150
Ethereum 2.0 152
Delivery Phases of Ethereum 2.0 154
Post—Ethereum 2.0 Innovation 155
Conclusion 155
Part IV: Building Application Protocols 157
Chapter 14: Extending the Ethereum Protocol 159

Fully Compatible, Yet Faster 160
Smart Enhancements to the EVM 160
Safety First 165
Conclusion 165
Chapter 15: Extending Ethereum Tools 167
Smart Contract Tools 168
Dapp Tools 175
Conclusion 178
Chapter 16: Example Dapps 179
Case Study 1: Valentines 179
Case Study 2: WeBet 184
Conclusion 201
Chapter 17: Business Rules and Contracts 203
An Example 204
Rules Language 206
More Business Examples 210
Conclusion 214
Chapter 18: Building an Application-Specific EVM 215
Using libENI Functions 216
Writing a libENI Function 222
Deploying the libENI Function 224
Conclusion 226
Part V: Building Your Own Blockchain 227
Chapter 19: Getting Started with Tendermint 229

How It Works 229
It Works as Follows 231
Set Up a Node 231
Set Up a Network 235
Conclusion 236
Chapter 20: The Business Logic 237
The Protocol 238
A Sample Application 240
Java Implementation 242
GO Implementation 247
The Cosmos SDK 250
Conclusion 252
Chapter 21: Creating a Blockchain Client 253
Overview of the Approach 254
The Sample Application 255
PHP 256
Java 258
Conclusion 260
Part VI: Cryptoeconomics 261
Chapter 22: The Cryptoeconomics of Token Design 263

Network Utility Tokens 263
Application Utility Tokens 266
Security Tokens 266
Token Valuation 267
Advanced Topics 271
Conclusion 274
Chapter 23: Initial Coin Offerings 275
A Brief History 275
Utility of an ICO 276
ICO vs. Traditional Equity Financing 278
Evaluating an ICO Project 280
ICO Participation Risk 282
Conclusion 283
Chapter 24: Cryptocurrency Exchanges 285
Exchange Types 285
Decentralization 287
Products and Services 288
Conclusion 289
Appendix: Getting Started with CyberMiles 291
Index 295

Dr. Michael Juntao Yuan is the CEO of Second State Inc., a VC-funded startup that builds and commercializes blockchain infrastructure software. He is also a cofounder of the CyberMiles Foundation, which focuses on building a decentralized e-commerce ecosystem on the CyberMiles public blockchain. Dr. Yuan has extensive experience with the development and commercialization of open source software. He was an early employee at JBoss and was a product manager at Red Hat. He is also the principal investigator of multiple research awards from the National Institutes of Health. He received a PhD in astrophysics from the University of Texas at Austin.

Students will:


  • Master cutting-edge blockchain development technologies including Tendermint and Cosmos
  • Build decentralized blockchain applications for e-commerce, marketplaces, finance, supply chains, healthcare, content distribution, and more
  • Help financial institutions enable virtual currencies and achieve revolutionary process improvements
  • Preview next-generation techniques that transcend the limitations of today’s cryptocurrencies