Siêu thị PDFTải ngay đi em, trời tối mất

Thư viện tri thức trực tuyến

Kho tài liệu với 50,000+ tài liệu học thuật

© 2023 Siêu thị PDF - Kho tài liệu học thuật hàng đầu Việt Nam

Decentralized Applications
PREMIUM
Số trang
118
Kích thước
11.7 MB
Định dạng
PDF
Lượt xem
1818

Decentralized Applications

Nội dung xem thử

Mô tả chi tiết

Siraj Raval

Decentralized

Applications

HARNESSING BITCOIN'S BLOCKCHAIN TECHNOLOGY

Siraj Raval

Decentralized Applications

Harnessing Bitcoin’s Blockchain Technology

Beijing Boston Farnham Sebastopol Tokyo

978-1-491-92454-9

[LSI]

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

Production Editor: Colleen Lobner

Copyeditor: Octal Publishing, Inc.

Proofreader: James Fraleigh

Indexer: Judy McConville

Interior Designer: David Futato

Cover Designer: Randy Comer

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.

€ank 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

Preface

Conventions Used in This Book

The following typographical conventions are used in this book:

Italic

Indicates new terms, URLs, email addresses, filenames, and file extensions.

Constant width

Used for program listings, as well as within paragraphs to refer to program ele‐

ments such as variable or function names, databases, data types, environment

variables, statements, and keywords.

Constant width bold

Shows commands or other text that should be typed literally by the user.

Constant width italic

Shows text that should be replaced with user-supplied values or by values deter‐

mined by context.

Using Code Examples

Supplemental material (code examples, exercises, etc.) is available for download at

https://github.com/oreillymedia/decentralized_applications.

This book is here to help you get your job done. In general, if example code is offered

with this book, you may use it in your programs and documentation. You do not

need to contact us for permission unless you’re reproducing a significant portion of

the code. For example, writing a program that uses several chunks of code from this

book does not require permission. Selling or distributing a CD-ROM of examples

from O’Reilly books does require permission. Answering a question by citing this

book and quoting example code does not require permission. Incorporating a signifi‐

ix

Tải ngay đi em, còn do dự, trời tối mất!