SKIP THE SHIPPING
Use code NOSHIP during checkout to save 40% on eligible eBooks, now through January 5. Shop now.
This eBook includes the following formats, accessible from your Account page after purchase:
EPUB The open industry format known for its reflowable content and usability on supported mobile devices.
PDF The popular standard, used most often with the free Acrobat® Reader® software.
This eBook requires no passwords or activation to read. We customize your eBook by discreetly watermarking it with your name, making it uniquely yours.
Also available in other formats.
Register your product to gain access to bonus material or receive a coupon.
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
Visit the author's site for source code examples from the book: buildingblockchainapps.com.
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