DeFi For Dummies - Seoyoung Kim - E-Book

DeFi For Dummies E-Book

Seoyoung Kim

0,0
19,99 €

-100%
Sammeln Sie Punkte in unserem Gutscheinprogramm und kaufen Sie E-Books und Hörbücher mit bis zu 100% Rabatt.

Mehr erfahren.
Beschreibung

Get to know the building blocks of a new economy

The promise of decentralized finance (DeFi for those up on their financial lingo) as a disruptor to financial institutions makes it must-know for anyone involved in finance. DeFi For Dummies provides an easy-to-understand option for unraveling the past, present, and future of DeFi. Understand current DeFi applications, including how to build basic applications on the leading platforms, and get a look into the future’s most promising new DeFi solutions. Staying ahead of the game is critical for finance professionals these days, and this Dummies guide makes it possible, with full coverage of how DeFi affects asset management, lending and borrowing, and investment markets. Wrap your mind around DeFi and start getting hands on, the Dummies way.

  • Learn how the DeFi revolution started and where it’s going
  • Get insight into opportunities for getting started and building value with DeFi
  • Discover the leading assets, exchanges, and marketplaces built on DeFi principles
  • Create secure DeFi applications on established platforms

This book is great for current pros or active investors in the world of finance who need to get up to speed on the world of DeFi as quickly and clearly as possible.

Sie lesen das E-Book in den Legimi-Apps auf:

Android
iOS
von Legimi
zertifizierten E-Readern

Seitenzahl: 339

Veröffentlichungsjahr: 2022

Bewertungen
0,0
0
0
0
0
0
Mehr Informationen
Mehr Informationen
Legimi prüft nicht, ob Rezensionen von Nutzern stammen, die den betreffenden Titel tatsächlich gekauft oder gelesen/gehört haben. Wir entfernen aber gefälschte Rezensionen.



DeFi For Dummies®

Published by: John Wiley & Sons, Inc., 111 River Street, Hoboken, NJ 07030-5774, www.wiley.com

Copyright © 2023 by John Wiley & Sons, Inc., Hoboken, New Jersey

Published simultaneously in Canada

No part of this publication may be reproduced, stored in a retrieval system or transmitted in any form or by any means, electronic, mechanical, photocopying, recording, scanning or otherwise, except as permitted under Sections 107 or 108 of the 1976 United States Copyright Act, without the prior written permission of the Publisher. Requests to the Publisher for permission should be addressed to the Permissions Department, John Wiley & Sons, Inc., 111 River Street, Hoboken, NJ 07030, (201) 748-6011, fax (201) 748-6008, or online at http://www.wiley.com/go/permissions.

Trademarks: Wiley, For Dummies, the Dummies Man logo, Dummies.com, Making Everything Easier, and related trade dress are trademarks or registered trademarks of John Wiley & Sons, Inc. and may not be used without written permission. All other trademarks are the property of their respective owners. John Wiley & Sons, Inc. is not associated with any product or vendor mentioned in this book.

LIMIT OF LIABILITY/DISCLAIMER OF WARRANTY: WHILE THE PUBLISHER AND AUTHORS HAVE USED THEIR BEST EFFORTS IN PREPARING THIS WORK, THEY MAKE NO REPRESENTATIONS OR WARRANTIES WITH RESPECT TO THE ACCURACY OR COMPLETENESS OF THE CONTENTS OF THIS WORK AND SPECIFICALLY DISCLAIM ALL WARRANTIES, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. NO WARRANTY MAY BE CREATED OR EXTENDED BY SALES REPRESENTATIVES, WRITTEN SALES MATERIALS OR PROMOTIONAL STATEMENTS FOR THIS WORK. THE FACT THAT AN ORGANIZATION, WEBSITE, OR PRODUCT IS REFERRED TO IN THIS WORK AS A CITATION AND/OR POTENTIAL SOURCE OF FURTHER INFORMATION DOES NOT MEAN THAT THE PUBLISHER AND AUTHORS ENDORSE THE INFORMATION OR SERVICES THE ORGANIZATION, WEBSITE, OR PRODUCT MAY PROVIDE OR RECOMMENDATIONS IT MAY MAKE. THIS WORK IS SOLD WITH THE UNDERSTANDING THAT THE PUBLISHER IS NOT ENGAGED IN RENDERING PROFESSIONAL SERVICES. THE ADVICE AND STRATEGIES CONTAINED HEREIN MAY NOT BE SUITABLE FOR YOUR SITUATION. YOU SHOULD CONSULT WITH A SPECIALIST WHERE APPROPRIATE. FURTHER, READERS SHOULD BE AWARE THAT WEBSITES LISTED IN THIS WORK MAY HAVE CHANGED OR DISAPPEARED BETWEEN WHEN THIS WORK WAS WRITTEN AND WHEN IT IS READ. NEITHER THE PUBLISHER NOR AUTHORS SHALL BE LIABLE FOR ANY LOSS OF PROFIT OR ANY OTHER COMMERCIAL DAMAGES, INCLUDING BUT NOT LIMITED TO SPECIAL, INCIDENTAL, CONSEQUENTIAL, OR OTHER DAMAGES.

For general information on our other products and services, please contact our Customer Care Department within the U.S. at 877-762-2974, outside the U.S. at 317-572-3993, or fax 317-572-4002. For technical support, please visit https://hub.wiley.com/community/support/dummies.

Wiley publishes in a variety of print and electronic formats and by print-on-demand. Some material included with standard print versions of this book may not be included in e-books or in print-on-demand. If this book refers to media such as a CD or DVD that is not included in the version you purchased, you may download this material at http://booksupport.wiley.com. For more information about Wiley products, visit www.wiley.com.

Library of Congress Control Number: 2022948456

ISBN: 978-1-119-90680-3; ISBN 978-1-119-90681-0 (ebk);

ISBN 978-1-119-90682-7 (ebk)

DeFi For Dummies®

To view this book's Cheat Sheet, simply go to www.dummies.com and search for “DeFi For Dummies Cheat Sheet” in the Search box.

Table of Contents

Cover

Title Page

Copyright

Introduction

About This Book

Foolish Assumptions

Icons Used in This Book

Beyond the Book

Where to Go from Here

Part 1: Getting Started with DeFi

Chapter 1: Introducing Decentralized Finance

Demystifying DeFi

Going Full Circle: The DeFi-CeFi Infinity Loop

Deciding to DeFi or Not to DeFi

Contemplating the Future of DeFi

Proceeding on Your DeFi Journey

Chapter 2: Discovering the DeFi Lingo

Introducing Key DeFi Terms

Knowing Important Distinctions

Chapter 3: Dabbling in DeFi: Getting Your Hands Dirty

Setting Up Your Wallet

Funding Your Account

Chapter 4: Making Your First DeFi Transactions

Decentralized Lending

Decentralized Borrowing

Executing a Trade on a Decentralized Exchange

Unwinding and Closing Out

Part 2: Diving into the Burgeoning DeFi Space

Chapter 5: Decentralized Assets

Understanding Native Tokens

Exploring Non-Native Tokens

Differentiating Non-Fungible Tokens (NFTs)

Chapter 6: Decentralized Exchanges and Marketplaces

Understanding Liquidity Providers and Order Books

Distinguishing between Custodial and Noncustodial Exchanges

Exploring DEXs

Navigating Marketplaces for Non-Fungible Goods

Chapter 7: Decentralized Lending and Borrowing

Making a Collateralized Loan

Implementing a Flash Loan

Chapter 8: Decentralized Metaverses

Introducing Decentralized Virtual Economies

Exploring the Metaverse

Part 3: Developing Your Own DApp: A Step-by-Step Guide

Chapter 9: DeFi Building Blocks

Introducing Public Blockchains

Explaining Consensus Mechanisms

Following a Day (or a Second) in the Life of a Transaction

Streamlining the Development Process

Oracles: A Blockchain’s Divine Access to the Outside World

Chapter 10: Smart-Contract Platforms

Diving into Layer 1: Comparing Base Protocols

Floating Up to Layer 2: Off-Chain Scaling Solutions

Crossing Cross-Chain Bridges

Chapter 11: Launching a Smart Contract on Ethereum

Understanding Smart Contracts

Launching Your Smart Contract

Accessing Your Smart Contract

Chapter 12: Launching a Smart Contract on the Binance Smart Chain

Testing the Waters: How to Navigate the BSC Testnet

Feeling Ready for Mainnet?

Deploying onto Other EVM-Compatible Platforms

Chapter 13: Launching Your First DeFi Product

Proving Your Proof of Concept

Preparing Your Development Stack

Implementing the Back End of Your DApp

Creating the Front-End User Interface

Part 4: The Part of Tens

Chapter 14: Top Ten DeFi Applications

Instadapp (INST)

Compound (COMP)

PancakeSwap (CAKE)

JustLend (JST)

Convex Finance (CVX)

Curve (CRV)

Uniswap (UNI)

Aave (AAVE)

Lido (LDO)

Maker (MKR)

Chapter 15: Top Ten Smart-Contract Platforms

Optimism (OP)

Arbitrum (N/A)

Fantom (FTM)

Cronos (CRO)

Polygon (MATIC)

Solana (SOL)

Avalanche (AVAX)

TRON (TRON)

Binance Smart Chain (BNB)

Ethereum (ETH)

Index

About the Author

Connect with Dummies

End User License Agreement

Guide

Cover

Title Page

Copyright

Table of Contents

Begin Reading

Index

About the Author

Pages

i

ii

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

55

56

57

58

59

60

61

62

63

64

65

66

67

68

69

70

71

72

73

74

75

76

77

78

79

80

81

82

83

84

85

87

88

89

90

91

92

93

94

95

96

97

98

99

100

101

102

103

104

105

106

107

108

109

110

111

112

113

114

115

116

117

119

120

121

122

123

124

125

126

127

129

130

131

132

133

134

135

136

137

138

139

140

141

142

143

144

145

146

147

148

149

150

151

152

153

154

155

156

157

158

159

160

161

162

163

164

165

166

167

168

169

170

171

172

173

174

175

176

177

178

179

180

181

182

183

184

185

186

187

188

189

190

191

192

193

194

195

196

197

198

199

200

201

202

203

204

205

206

207

208

209

210

211

212

213

214

215

216

217

218

219

220

221

222

223

224

225

226

227

228

229

230

231

232

233

234

235

236

237

238

239

240

241

242

243

244

245

246

247

248

249

250

251

252

253

254

255

256

257

258

259

260

261

262

263

264

265

266

267

268

269

270

271

272

273

274

275

276

277

278

279

280

281

282

283

284

285

286

287

288

289

290

291

292

293

294

295

297

298

299

300

301

302

303

304

305

306

307

308

309

310

311

313

314

315

316

317

318

319

320

321

322

323

324

325

326

327

Introduction

Welcome to DeFi For Dummies! Whether you are simply curious to learn the decentralized finance (DeFi) lingo, are interested in trying out a DeFi application, or have a burning desire to code and deploy your own DeFi protocol, this book is for you!

In this book, you’ll find helpful information and advice for exploring the world of DeFi. You’ll also find useful step-by-step guides along the way that will teach you how to set up a Web3 wallet, how to navigate DeFi platforms, and even how to develop your very own DeFi application.

DeFi is a rich and multidisciplinary field, drawing from math, cryptography, computer science, contract theory, and economics. Although I incorporate these elements throughout the book, you don’t need a background in these areas to understand the concepts presented or to follow the hands-on instructional guides provided.

About This Book

This book provides a holistic treatment of the rapidly evolving DeFi space — its evolution, applications, and underlying technology.

Keep in mind, though, that this book intends to provide a customizable journey for all audiences — whether you work in tech or finance or simply want to be a more interesting conversationalist at happy hour. (In other words, rest assured that you don’t have to read the book in its entirety to understand the separate topics!)

Foolish Assumptions

The most important assumption that I make about you is that you are interested in learning about DeFi! That said, I do make additional assumptions in writing the step-by-step instructional guides that are peppered throughout this book. Although I don’t assume any prior knowledge or experience in programming or Web3 applications, I do assume the following:

You have a computer and access to the internet.

You know the basics of navigating your computer and the internet, and you know how to download, install, and run programs.

You understand that, because of formatting and space constraints, some web addresses or long hashes may be split across two lines of text. Keep in mind that these web addresses and large numbers should be copied verbatim as though the line break doesn’t exist.

You understand that DeFi is a rapidly evolving space. In fact, many protocols and systems were in active updating or were anticipating migration at the time of writing. Keep in mind that some of my illustrated guides may no longer represent ongoing conditions on the ground by the time you read this book.

For instance, as of September 15, 2022, Ethereum completed its long-awaited Merge, shifting from a consensus protocol that was based on proof of work (PoW) to one based on proof of stake (PoS). Although this shift doesn’t impact the step-by-step guides provided throughout this book, it does impact some of the descriptions regarding block times and the process by which blocks are added to the Ethereum blockchain.

Moreover, the Ropsten test network, which historically operated as a PoW-based blockchain that most closely followed the protocol of the Ethereum Mainnet, may be deprecated by the time you get to the step-by-step guides. Thus, you may prefer to use a different test network, such as Goerli, when following the instructional portions of this book. The instructions remain the same, but you’ll need to keep in mind that my instructional figures and steps refer to the Ropsten test network rather than, say, the Goerli test network. Moreover, you’ll need to get the appropriate test ETH for the test network that you select. For instance, you can simply Google “Goerli test faucet” to find free test ETH for the Goerli test network. These reminders are also peppered throughout the book.

Finally, I assume you know that I do not provide legal or investment advice. The protocols I describe and the step-by-step guides I provide to borrow, lend, or trade on DeFi platforms are designed to be demonstrative and didactic.

Icons Used in This Book

I use the following icons throughout this book to guide your expectations or to highlight certain pieces of information.

The Tip icon draws your attention to potential shortcuts or easy adaptations that can be made without breaking an entire system.

The Remember icon highlights information that is particularly important to know or to later recall to clear up possible confusion.

The Technical Stuff icon is used to direct your attention away from (if you are a non-techie) or to draw your attention to (if you are an aspiring techie) technical details that aren’t required to understand the main points.

The Warning icon tells you to watch out! It marks important information that may save your time, sanity, tokens, or even friendships.

Beyond the Book

In addition to the material in the hard copy or e-book you’re reading right now, you can also find this book’s Cheat Sheet by going to www.dummies.com and entering DeFi For Dummies in the search field. The Cheat Sheet offers useful terminology and quick tips on how to start dabbling in the world of DeFi. You can also access up-to-date code and supplementary files at https://www.seoyoungkim.com/defifdcode.html.

Where to Go from Here

I’ve written this book in a way that allows you to craft your own journey based on whether you are more interested in applications, high-level ideas, or technical development. You don’t have to read the entire book to successfully execute the step-by-step guides, and I carefully guide you through certain sections or chapters that require actions or knowledge from a prior section or chapter in the book.

That said, I highly recommend that you begin with Chapter 1 to place your DeFi journey in context.

Part 1

Getting Started with DeFi

IN THIS PART …

Discover the world of decentralized finance.

Learn the DeFi lingo.

Execute your first DeFi transactions.

Chapter 1

Introducing Decentralized Finance

IN THIS CHAPTER

Defining decentralized finance

Comparing CeFi and DeFi processes

Considering the cons of a DeFi world

Exploring promising DeFi implementations

The modern decentralized finance (DeFi) era truly began with Bitcoin, the first widespread implementation of a decentralized method of recordkeeping that is permissionless yet reliable and secure. Bitcoin effectively provides a currency that doesn’t rely on the stability of a central authority.

The implications of such a technology are huge for developing economies where faith in central government is low and bank runs are a serious risk, if not a reality. Moreover, much of the world’s population is, at most, one generation removed from being forcibly chased from their homes. Just 70 years ago, Seoul, the capital of Korea, was captured and recaptured four times, and families were permanently separated in a war that ultimately resulted in two separate nations. The fall of Saigon 50 years ago resulted in a mass exodus of Vietnamese refugees seeking asylum; and more recently, the fall of Kabul (2021) and the Russian invasion of Ukraine earlier this year (2022) led to more waves of emigrants who found themselves in sudden exile.

But aside from more dire circumstances — like the collapse of a banking system or the fall of your government — it’s natural to question what true value Bitcoin’s underlying technology adds in a stable and wealthy nation. After all, I trust that Bank of America won’t maliciously siphon funds from my account, and despite the infamous Wells Fargo fake account scandal (for which it was ultimately fined $3 billion), I would even entrust my money to a Wells Fargo checking account. Nonetheless, reliable economies still have submarkets that are inherently rife with distrust of the central operator, with dark pools (securities exchanges in which participants can trade anonymously and with less transparency) being a case in point. (Try Googling “dark pool lawsuit”!) This trust issue naturally goes away if there is no central operator to distrust, and with the advent of Bitcoin, a proven technology now exists to implement modern DeFi processes across many use cases in finance.

This book isn’t about touting the next big cryptocurrency or NFT. It’s about the promise of the underlying technology, and where and how that technology can be elegantly applied in ways that truly add value to the situation at hand.

Demystifying DeFi

The idea of decentralized processes is certainly not new. After all, before centralized finance (CeFi) arose to establish trusted intermediaries, primitive DeFi was the status quo. Transactions were all peer-to-peer, and you were constrained by your local neighborhood to gain access to capital and to obtain goods by bartering one item for another. Recordkeeping was minimal, and ownership was determined by physical possession.

In modern markets, transactions require confidence in the validity of the agreement, which is provided by reliable and secure recordkeeping systems. After all, when you sell your car, you are really transferring the legal right to access the car. Without a reliable recordkeeping system in place, chaos would ensue. (Imagine the return of Finders Keepers as a rule of law!)

What’s truly exciting now is the distributed-ledger technology that provides a reliable and secure method of recordkeeping that is not maintained by a trusted intermediary, such as Bank of America or the DMV. Behold the dawn of the modern DeFi era!

From autonomous collectives to trillion-dollar DAOs

Well-functioning, leaderless communities are all around us, and in each circumstance, an inherent governance mechanism incentivizes and gels the group to act in concert — all without an elected official to assign roles and lead the process. From homework teams to neighborhoods to informal potlucks, small groups can effectively and efficiently self-govern when there are grades to maintain, property prices to protect, or reputational concerns at stake.

These small-scale examples probably feel reasonable and natural. But what if I told you that a trillion-dollar organization could autonomously validate, execute, secure, and provide ongoing updates to an entire system without an elected leader to assign tasks? The concept sounds naïve at best, and possibly crazy.

And yet, Bitcoin has provided a battle-tested case in point for the underlying technology that enables it to function in a decentralized and autonomous fashion. Yes, Bitcoin is indeed a trillion-dollar decentralized autonomous organization (DAO)! Of course, at this scale and with the value at stake, a DAO can’t rely solely on simple mechanisms like reputational concerns to incentivize participants to behave honestly and in a way that upholds the values of the system. Instead, the underlying protocol must be foolproofed against malicious players who may work hard to cheat the system. I explain these protocols in greater depth in Chapter 9, “DeFi Building Blocks.”

Transacting in DeFi versus CeFi

By this point in the chapter, DeFi may still seem rather abstract. Comparing examples of DeFi versus CeFi processes for certain types of transactions can help to demystify the distinction.

Borrowing assets

Suppose you want to borrow money. How would this transaction be implemented in primitive DeFi versus modern CeFi versus modern DeFi?

Under a primitive DeFi process:

You hit up everyone you know within reasonable geographic proximity — a neighbor, a friend, a family member — and hope that someone will lend you something that you can barter with at your local marketplace.

Under a modern CeFi process:

People have checking accounts, savings accounts, CDs, and so on with the bank, which means that all these people have lent money to the bank. In turn, the bank lends some of this money to you.

Under a modern DeFi process:

People lock up funds in a

smart-contract account

, which is a software program on a public blockchain that automatically enforces and executes the rules in the smart-contract code. This smart-contract account is programmed to function as a lending pool from which you can borrow funds. (See

Chapter 7

for details on how decentralized loans work.)

Selling assets

Suppose that instead of borrowing assets, you have assets that you want to sell. Comparing the three types of processes again, here’s how this transaction would be implemented:

Under a primitive DeFi process:

You again hit up everyone you know within reasonable geographic proximity — a neighbor, friend, family member — and attempt to barter by trial and error.

Under a modern CeFi process:

Liquidity providers stand by, waiting to buy the asset from those who want to sell and to sell the asset to those who want to buy. These liquidity providers commit to buy and sell a certain quantity of assets at varying prices on designated exchanges that serve as official marketplaces for the assets in question. In turn, you place an order to sell the asset through your brokerage firm (who has custody of the asset).

Under a modern DeFi process:

Liquidity providers lock up assets and funds in a smart-contract account. This smart-contract account serves as a liquidity pool and is programmed to function as an

automated market maker.

(See

Chapter 6

for details on how automated market makers work.) In turn, you can swap your assets for funds from this smart-contract account.

Check out Chapter 4, “Making Your First DeFi Transactions,” for a quick, hands-on tutorial if you want to get your hands dirty without learning the technical underpinnings.

Dispelling harmful DeFi myths

Of course, both the CeFi and DeFi worlds have some bad actors, but DeFi activity is not synonymous with illicit activity. The misconception that DeFi applications primarily facilitate or promote criminal activity is untrue and harmful to the DeFi community.

In contrast to cash transactions, which typically aren’t recorded, crypto transactions (such as in bitcoins or ether) are memorialized for all time on a public recordkeeping system known as a blockchain. In fact, any legitimate entity that touches crypto must employ the services of at least one blockchain analytics firm (such as Chainalysis) to credibly convey that it is serious about adhering to anti-money laundering (AML) provisions.

As the lowest-hanging fruit, blacklisted accounts (such as those associated with ransomware attacks or on the OFAC list) are barred from transacting with legitimate institutions. From there, blockchain analytics firms assign risk scores to graylisted accounts based on suspicious activity that suggests a possible connection to other graylisted or blacklisted accounts. Chapter 9, “DeFi Building Blocks,” introduces you to tracing activity on a block explorer, and Chapter 11, “Launching a Smart Contract on Ethereum,” delves more deeply into this process.

Just as it’s (nearly) impossible to spend $10 million in ill-gotten cash (you can’t show up with suitcases of cash to buy a home), it’s (nearly) impossible to spend $10 million in ill-gotten crypto.

Going Full Circle: The DeFi-CeFi Infinity Loop

A large part of DeFi activity really entails learning (or relearning) why CeFi arose in the first place and is so critically important. The following sections explain how primitive DeFi processes were made more efficient by CeFi processes, which were then challenged by modern DeFi processes (but which, in turn, demonstrated weaknesses of their own, highlighting again the value of CeFi and perpetuating the DeFi-CeFi infinity loop).

Safeguarding wealth

Suppose you want to save assets and keep them safe. How would this process be improved from primitive DeFi to modern CeFi to modern DeFi (and then back to modern CeFi)?

Starting with a primitive DeFi process:

Perhaps you keep your money (or gold or diamonds) under your mattress (or in a hole) and hope that no one finds it (but also that you don’t forget where you stored it). Given the danger and other obvious flaws in trying to safeguard your money, trusted institutions arise to take over this function.

Transitioning to a modern CeFi process:

You entrust your money to a bank. But then Bitcoin emerges, and perhaps traditional banking seems boring (or maybe you’re in a country with a precarious banking system or volatile political climate).

Trying out a modern DeFi process:

You keep your private crypto key (a sequence of numbers) in a safe place, or you split your private key and store it across multiple safe places (maybe under your mattress or in a hole, and again, hope that no one finds it but also that you don’t forget where you stored it). But then you remember that you’re