About this book

This book is about Ethereum decentralized applications (Dapps). If you’re new to blockchain, learning how to develop a Dapp isn’t as straightforward as learning a new programming language or a new development framework. It requires you to learn a completely new technology, different from what you might have seen before. In short, it requires you to shift to a new paradigm, a new way of developing applications.

This objective of this book is to help you transition to this new paradigm as easily as possible. This doesn’t mean I’ll show you a magic shortcut to the new technology. On the contrary, I’ll accompany you along a step-by-step path, based on hands-on explanations, through which you’ll acquire all the concepts, tools, programming languages, and frameworks you need to develop an Ethereum application. I hope the sample applications you’ll build while progressing through the chapters will make your journey as smooth as possible.

The goal is that after reading this book, you’ll have gained a solid understanding of the main components of the Ethereum platform and its wider ecosystem, and you’ll be able to design, implement, and deploy a complete Ethereum Dapp.

Who should read this book

Blockchain technology has just become mainstream, mostly on the back of the spectacular rise that cryptocurrencies experienced in December 2017. People from all walks of life are trying to figure out the potential and opportunities blockchain platforms such as Ethereum can offer to improve and revolutionize many industries. Different people are trying to learn at different levels, depending on their background and aspirations.

This book is aimed at software developers, architects, and anyone with intermediate programming skills who’d like to understand how Ethereum works by using it. Generally, I expect you to have interest in learning the technology, but I assume you have no prior deep knowledge of it. I believe any junior developer with knowledge of basic JavaScript, Java, or a C-like language should be able to follow along with no difficulty. If you also have some background in object-oriented programming and Node.js, your journey will be even easier. If you’ve read some general, high-level articles on blockchain or Ethereum, you’re good to go!

Roadmap

The book is divided into four parts. Unless you have prior knowledge of blockchain platforms, I recommend you read it from front to back because I introduce concepts and tools progressively. Most chapters assume you’ve read the previous ones.

If you’re familiar with blockchain and have basic knowledge of Ethereum, you might be able to skip part 1. On the other hand, if you’re interested in learning the technology, but you’re not planning to build a production application, you can skip part 4 on advanced topics, except perhaps chapter 15 on the current blockchain landscape:

  • Part 1 is a general introduction to decentralized applications (chapter 1); blockchain technology and smart contracts (chapter 2); and the Ethereum platform, including the Ethereum Virtual Machine (EVM), the Go Ethereum client, and the Ethereum wallet (chapter 3). You’ll get the foundation necessary to progress through the book, and you’ll also implement your first Dapp—a simple cryptocurrency—which, in chapter 4, you’ll also deploy on a public test network.
  • Part 2 is focused on smart contracts, the technology that Ethereum introduced, which allow a blockchain to go beyond the traditional use of supporting cryptocurrencies to being a building block for any decentralized application. Chapter 5 gives an overview of Solidity, the most popular language for writing smart contracts on the Ethereum Virtual Machine. Chapter 6 presents the structure of a typical smart contract through a sample crowdsale application and explains its main elements: constructor, state variables, functions, and events. You’ll also learn how to generalize the contract functionality through inheritance. Chapter 7 is focused on more advanced object-oriented features, such as abstract contracts and interfaces, which I introduce progressively for you to improve and extend the initial crowdsale application. This chapter also presents libraries, which provide yet another way of making code more maintainable. Chapter 8 explains how to deploy a smart contract to a public test network and interact with it through Web3, an Ethereum communication library; the Go Ethereum console; Node.js; and a web user interface. It also explains how to set up a private network and how to use a mock network client, such as Ganache.
  • In part 3, which is the core of the book, you’ll learn about real-world Ethereum. At this point, I assume you’ve developed a good foundation in Ethereum, so in chapter 9 you’ll start to familiarize yourself with the wider ecosystem. This includes, among other elements, the Ethereum Name Service (ENS), decentralized storage networks such as IPFS and Swarm, and oracle and other development frameworks. Then you’ll start to use professional development tools. In chapter 10 you’ll learn how to test smart contracts with the JavaScript Mocha framework, and in chapter 11 you’ll improve the development cycle with the Truffle framework, which will allow you to easily compile, test, and deploy your contracts. Finally, in chapter 12, you’ll put everything together by building an end-to-end voting Dapp from scratch. At this point, you can consider yourself graduated!
  • Part 4 is aimed at readers who are not only interested in learning about the technology but are also planning to deploy a Dapp in production. Chapter 13 gives advice on operational aspects, such as event logging and contract upgradeability. Chapter 14 is entirely focused on security and gives you a heads-up on common vulnerabilities and typical forms of smart contract attack. I recommend all readers proceed through chapter 15 as well to get an overview of the current blockchain and distributed ledger landscape. If you want to continue the journey, it provides you with a short list of next destinations to consider.

Source code and downloads

The code snippets and listings throughout the book are mainly in Solidity and Java-Script. The source code is always represented in fixed-width font to make it stand out from the surrounding text. The code is annotated and has been formatted with careful indentation and page breaks so it fits the size of the book page well and shows clearly.

You can download all the listings and code snippets from Manning’s book website at www.manning.com/books/building-ethereum-dapps.

Software and hardware requirements

The Ethereum tool set is available for Windows, Linux, and macOS; screenshots shown throughout the book are from Windows. Code is, in most cases, operating system-agnostic, but in a few cases I’ve escaped it for Windows (for example: curl-based RPC calls). You should be able to follow all the examples, regardless of what operating system you’re using.

If you want to download the entire Ethereum MAINNET blockchain, you’ll need around 1 TB of disk space. But you can get away with around 100 GB if you retrieve it in fast mode, as I explain in more detail in the early chapters. The TESTNET blockchain, which I use for most of the book, requires around 75 GB at the time of writing.

liveBook discussion forum

Purchase of Building Ethereum Dapps includes free access to a private web forum run by Manning Publications where you can make comments about the book, ask technical questions, and receive help from the author and from other users. To access the forum, go to https://livebook.manning.com/#!/book/building-ethereum-dapps/discussion. You can also learn more about Manning’s forums and the rules of conduct at https://livebook.manning.com/#!/discussion.

Manning’s commitment to our readers is to provide a venue where a meaningful dialogue between individual readers and between readers and the author can take place. It isn’t a commitment to any specific amount of participation on the part of the author, whose contribution to the forum remains voluntary (and unpaid). We suggest you try asking the author some challenging questions lest his interest stray! The forum and the archives of previous discussions will be accessible from the publisher’s website as long as the book is in print.

Tool set used in the book

These are the versions of all the tools I’ve used in this book. I recommend you install these exact versions, if you can, so you’ll be able to follow my explanations more smoothly:

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset