Introduction 1 About This Book 1 Foolish Assumptions 2 Icons Used in This Book 2 Beyond the Book 2 Where to Go from Here 3 Part 1: Getting to Know Blockchain and Ethereum 5 Chapter 1: Introducing Ethereum 7 Describing Blockchain Technology 8 Introducing Ethereum 10 Exploring Ethereum''s Consensus, Mining, and Smart Contracts 11 Buying, Spending, and Trading Ether 13 Getting Started with DAO and ICO 16 Exploring the Ethereum Ecosystem 17 Delving into Development Tools 18 Building Blockchain Apps 18 Chapter 2: Learning about Blockchain 21 Exploring Distributed Applications 22 Digging into distributed processing 22 Exploring problems with distributed processing 24 Presenting some solutions to distributed processing problems 27 Examining the Bitcoin Solution to the Distributed Dilemma 28 Describing Blockchains 30 Examining blockchain details 30 Protecting blockchain visibility 31 Building Blockchains 33 Agreeing to add blocks 33 Making blocks immutable 34 Reviewing the building process 35 Keeping all blockchains consistent 35 Understanding How Blockchains and Databases Store Data Differently 36 Storing data in a traditional database 36 Storing data in a blockchain 38 Effectively Using Blockchains 39 Transferring value without trust 39 Reducing transaction costs by eliminating middlemen 39 Increasing efficiency through direct interaction 40 Maintaining complete transaction history 40 Increasing resilience through replication 41 Providing transparency 41 Chapter 3: Exploring Use Cases for Ethereum 43 Diving Into Ethereum Applications 44 Exploring Financial Services 45 Banking 46 Creating Ethereum escrow applications 48 Examining ICOs 48 Establishing Digital Identity Management 49 Managing individual and device identities 50 Reducing fraud and identity theft 50 Examining the ERC-725 standard and beyond 51 Examining Industry Applications 51 Healthcare 52 Energy 52 Supply chain 53 Enabling Effective Governance 54 Tax payment 54 Government spending 55 Voting 55 Policy development 55 Notary 56 Part 2: Setting Up Your Ethereum Development Environment 57 Chapter 4: Examining the Ethereum Ecosystem and Development Lifecycle 59 Exploring the Ethereum Blockchain Block Structure 60 Describing Smart Contracts 64 Introducing Solidity, the Language of Smart Contracts 66 Working with the Ethereum Virtual Machine 67 Fueling Your Code with Gas 68 Surveying Tools for Developing, Testing, and Deploying Ethereum Apps 69 Ethereum blockchain client 70 Development and testing blockchain 71 Compiler and testing framework 72 Source code editor/IDE 72 Describing the Ethereum Development Lifecycle 73 Introducing Smart Contract Development Tools 74 Chapter 5: Getting and Configuring Ethereum Development Tools 77 Examining Why Multiple Ethereum Development Tools are Available 78 Downloading, Installing, and Configuring All the Pieces 79 Installing the blockchain client 79 Installing the test blockchain 83 Installing the testing environment 86 Installing the IDE 91 Chapter 6: Establishing an Ethereum Wallet 95 Unlocking the Secrets of an Ethereum Wallet 96 Examining the Types of Ethereum Wallets 96 Sorting out software wallets 97 Handling hardware wallets 99 Perusing paper wallets 99 Choosing an Ethereum Wallet 100 Software wallets 100 Hardware wallets 102 Paper wallets 103 Installing MetaMask, an Ethereum Wallet 104 Part 3: Building Ethereum Distributed Blockchain Apps 107 Chapter 7: Building Your First Ethereum Apps 109 Validating Your Ethereum Development Environment 110 Creating a Truffle project 110 Editing the Truffle config file 111 Exploring the Ganache Test Environment 113 Designing Simple Smart Contracts 115 Coding Your First Smart Contract 116 Running Your First Smart Contract 118 Writing your code 118 Compiling your code 119 Deploying your code 120 Invoking your code''s functions 122 Paying as You Go 124 Chapter 8: Learning about Smart Contracts 125 Introducing Supply Chain and Common Challenges 126 Describing supply chain 126 Explaining difficulties when implementing a supply chain 127 Examining How Blockchain Can Help Resolve Supply Chain Problems 128 Describing a Blockchain Supply Chain Solution 129 Paying for supply chain services 129 Managing assets on the supply chain 130 Digging into Solidity 132 Describing Basic Smart Contract Syntax 133 Declaring valid compiler version 134 Commenting your code 134 Importing external code 135 Defining your smart contracts 135 Handling Data in Solidity 136 Learning about Computation and Gas 140 Exploring Access Modes and Visibility of Smart Contract Functions and Data 142 Controlling Execution Flow 144 Handling Errors and Exceptions 145 Chapter 9: Writing Your Own Smart Contracts with Solidity 147 Reviewing Supply Chain Design Specification 148 Payment token smart contract 149 Supply chain smart contract 150 Creating New Smart Contracts 151 ERC-20 token interface 153 ERC-20 token smart contract 154 Supply chain smart contract 155 Coding Primary Functions 157 ERC-20 token functions 157 Supply chain functions 160 Using Events 163 Defining events 165 Triggering events 166 Introducing Ownership 168 Designing for Security 170 Implementing Minimal Functionality 171 Part 4: Testing and Deploying Ethereum Apps 173 Chapter 10: Testing Ethereum Apps 175 Understanding Ethereum dApp Testing 176 Writing tests from the beginning 176 Choosing the right test blockchain 176 Learning the steps in the testing lifecycle 177 Testing for software quality 177 Deploying a dApp to a Test Ethereum Blockchain 178 Telling Truffle to use the Ganache blockchain 178 Deploying your code to the Ganache blockchain 180 Writing Tests for Ethereum dApps 181 Testing using the command line 181 Writing test cases in JavaScript 185 Logging and Handling Errors 187 Handling errors in Solidity 188 Logging activity in smart contracts 189 Fixing Bugs in a dApp 190 Chapter 11: Deploying and Maintaining Ethereum Apps 191 Test Blockchain Options versus Live Blockchains 192 Testing with the Ganache blockchain 192 Deploying your code to other test blockchains 193 Anticipating Differences in Live Environments 195 Preparing Your Configuration for Deploying to Different Networks 196 Deploying a dApp 198 Getting enough ether 199 Compiling your code 203 Deploying your code 203 Chapter 12: Integrating Non-Blockchain Apps with Ethereum 205 Comparing Blockchain and Database Storage 206 Locating control 207 Imposing data format 207 Updating data 207 Optimizing performance 208 Protecting confidentiality 208 Paying for storage 208 Providing integrity and transparency 209 Protecting resilience 209 Contrasting Execution and Flow in Blockchain dApps and Traditional Applications 210 Designing Goals for Incorporating Blockchain into an Existing Application 211 Using existing smart contracts 213 Developing your own smart contracts 213 Identifying Interface Data and Transaction Requirements 214 Creating or Modifying Contracts to Provide Data Interface 215 Testing Integrated dApps 215 Deploying Integrated dApps 216 Part 5: The Part of Tens 219 Chapter 13: Ten Free Ethereum Resources 221 Exploring Alternative Ethereum Development Frameworks 222 Managing you development with Populus 222 Exploring Ethereum blockchain containers with Cliquebait 222 Selecting a Free Integrated Development Environment 223 Developing Solidity code with Atom 223 Going online with Remix 224 Keeping it simple with EthFiddle 224 Exploring Ethereum Clients and APIs 226 Swapping your Ethereum client to Parity 226 Interacting with Ethereum by using Web3.js 226 Focusing on Wallets and Security 227 Protecting your crypto-assets in Mist 227 Securing your dApps with OpenZeppelin 228 Learning More About Developing Ethereum dApps 228 Chapter 14: Ten Design Principles for Distributed Blockchain Apps 229 Designing for Trust 230 Enforcing Consistency 230 Removing Doubt through Transparency 232 Providing Feedback, Guidance, and Setting Expectations 233 Handling Mistakes with Class 233 Designing Functions that Focus on User Actions, Not Data 234 Storing Data Based on User Actions, Not Data Structures 235 Keeping It Simple 236 Expecting Blockchain Access to Be Expensive 236 Staying Out of the User''s Way 237 Chapter 15: Top Ten Ethereum Projects.
Ethereum for Dummies