Decentralized Applications PDF

ebook img

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview Decentralized Applications

Decentralized Applications HARNESSING BITCOIN'S BLOCKCHAIN TECHNOLOGY Siraj Raval Decentralized Applications Harnessing Bitcoin’s Blockchain Technology Siraj Raval BBeeiijjiinngg BBoossttoonn FFaarrnnhhaamm SSeebbaassttooppooll TTookkyyoo Decentralized Applications by Siraj Raval Copyright © 2016 Siraj Raval. All rights reserved. Printed in the United States of America. Published by O’Reilly Media, Inc., 1005 Gravenstein Highway North, Sebastopol, CA 95472. O’Reilly books may be purchased for educational, business, or sales promotional use. Online editions are also available for most titles (http://safaribooksonline.com). For more information, contact our corporate/ institutional sales department: 800-998-9938 or [email protected]. Editor: Tim McGovern Indexer: Judy McConville Production Editor: Colleen Lobner Interior Designer: David Futato Copyeditor: Octal Publishing, Inc. Cover Designer: Randy Comer Proofreader: James Fraleigh Illustrator: Rebecca Demarest August 2016: First Edition Revision History for the First Edition 2016-07-13: First Release See http://oreilly.com/catalog/errata.csp?isbn=9781491924549 for release details. The O’Reilly logo is a registered trademark of O’Reilly Media, Inc. Decentralized Applications, the cover image of a silver roughy, and related trade dress are trademarks of O’Reilly Media, Inc. While the publisher and the author have used good faith efforts to ensure that the information and instructions contained in this work are accurate, the publisher and the author disclaim all responsibility for errors or omissions, including without limitation responsibility for damages resulting from the use of or reliance on this work. Use of the information and instructions contained in this work is at your own risk. If any code samples or other technology this work contains or describes is subject to open source licenses or the intellectual property rights of others, it is your responsibility to ensure that your use thereof complies with such licenses and/or rights. 978-1-491-92454-9 [LSI] Thank you, Jade. Your truth set me free. Table of Contents Preface. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ix 1. What Is a Decentralized Application?. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 Preliminaries: What Is Bitcoin? 1 What Is a Decentralized Application? 3 Feature 1: Open Source 4 Feature 2: Internal Currency 6 Feature 3: Decentralized Consensus 6 Feature 4: No Central Point of Failure 7 The History of Decentralized Applications 8 PopcornTime 9 OpenBazaar 9 FireChat 9 Lighthouse 10 Gems 10 Enabling Technologies 11 Defining the Terms 11 Getting Started 14 2. A Flourishing Dapp Ecosystem. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 Decentralized Data 15 Option 1: Storing Data Directly in the Bitcoin Blockchain 16 Option 2: Storing Data in a Distributed Hash Table 17 Decentralized Wealth 21 Decentralized Identity 26 Decentralized Computing 29 Decentralized Bandwidth 31 Decentralized Markets for Decentralized Assets 33 v Practical Decentralization 36 3. Building Your First Dapp. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39 Go 39 Centralized Architecture 40 Decentralized Architecture: Introduction to IPFS 41 What Are We Building? 43 Setup 43 Routing 48 Data Storage and Retrieval 49 Passing and Displaying Data to the Frontend 52 Dapp Economics 54 Remaining Problems 58 Private Networks 58 Human-Readable Names 59 Showing Only Peers on Mikro, Not IPFS in General 59 Tamper-Free Payments 59 4. OpenBazaar. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61 Why Make OpenBazaar? 61 What Is OpenBazaar? 62 How Does OpenBazaar Work? 63 Merchant 63 Buyer 64 Notary 65 How to Install OpenBazaar 66 Possible Errors 66 Identity 70 Reputation 71 What Could OpenBazaar Have Done Better? 74 5. Lighthouse. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77 Functionality 78 SPV Wallets 84 Identity 84 6. La’Zooz. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87 What Is La’Zooz? 87 Distribution Protocol 88 DAO Structure 89 UX 91 Architecture 92 vi | Table of Contents Contracts 95 Improvements 96 Conclusion 97 Index. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99 Table of Contents | vii

Description:

Option 1: Storing Data Directly in the Bitcoin Blockchain. 16 . mann, IBM Redbooks, Packt, Adobe Press, FT Press, Apress, Manning, New ing them with a single point of failure (in this case, due to legal action). ods like the Hong Kong protests and the Arab Spring during which users feared gov‐.