Buch, Englisch, 654 Seiten, Format (B × H): 178 mm x 254 mm, Gewicht: 1140 g
The Comprehensive Guide to Blockchain Development, Ethereum, Solidity, and Smart Contracts
Buch, Englisch, 654 Seiten, Format (B × H): 178 mm x 254 mm, Gewicht: 1140 g
ISBN: 978-1-4932-2513-2
Verlag: Rheinwerk Verlag GmbH
Autoren/Hrsg.
Weitere Infos & Material
... Foreword ... 21... Preface ... 251 ... Introduction ... 29 1.1 ... What Is Blockchain? ... 29 1.2 ... History of Blockchain ... 36 1.3 ... Application of Blockchain Technology ... 47 1.4 ... Summary ... 662 ... The Basics: How Blockchain Works ... 69 2.1 ... Cryptography Basics ... 69 2.2 ... The Blockchain ... 81 2.3 ... Alternative Consensus Models ... 111 2.4 ... Blockchain Security ... 119 2.5 ... Summary ... 1283 ... Ethereum: Blockchain 2.0 ... 131 3.1 ... Basics of Ethereum ... 132 3.2 ... From Blocks to Blockchain 2.0 ... 144 3.3 ... The Blockchain System 2.0 ... 152 3.4 ... Further Development of the Ethereum Platform ... 170 3.5 ... Summary ... 1774 ... Fundamentals of Creating Your Own Blockchain ... 179 4.1 ... Transactions: The Smallest Units of a Blockchain ... 181 4.2 ... Block Header: Calculating the Block ID ... 183 4.3 ... Chaining Blocks ... 184 4.4 ... Storing the Blockchain State Persistently ... 186 4.5 ... The Genesis Block: Initializing a Blockchain ... 188 4.6 ... Pending Transactions ... 189 4.7 ... The Difficulty of a Blockchain ... 191 4.8 ... Let’s Mine: The Miner Thread ... 192 4.9 ... Summary and Outlook ... 1965 ... Implementing a Web API for the Blockchain ... 199 5.1 ... The Endpoints of the Web API ... 200 5.2 ... Deploying the Web API ... 205 5.3 ... Sending Transactions via a Web Interface ... 209 5.4 ... Implementing Your Own Block Explorer ... 212 5.5 ... Summary and Outlook ... 2196 ... Implementing a Peer-to-Peer Network ... 221 6.1 ... Configuration of the Peer-to-Peer Framework ... 222 6.2 ... Broadcasting Transactions to the Network ... 225 6.3 ... Broadcasting Blocks to the Network ... 228 6.4 ... The Longest Chain Rule ... 229 6.5 ... Adding New Nodes to the Network ... 233 6.6 ... Summary and Outlook ... 2357 ... Introducing Accounts and Balances ... 237 7.1 ... Rewarding Miners ... 238 7.2 ... Managing Accounts ... 241 7.3 ... Integrating Accounts ... 245 7.4 ... Integrating Accounts into the Block Explorer ... 246 7.5 ... Summary and Outlook ... 2518 ... Implementing Verification and Optimizations ... 253 8.1 ... Signing Transactions ... 253 8.2 ... Enforcing Constraints ... 256 8.3 ... Locking and Unlocking Balances ... 258 8.4 ... Optimizing Performance via Merkle Trees ... 261 8.5 ... Optimizing Storage by Shortening the Public Keys ... 264 8.6 ... Supporting Initial Balances in the Genesis Block ... 265 8.7 ... Additional Optimizations ... 266 8.8 ... Summary and Outlook ... 2679 ... Smart Contract Development ... 269 9.1 ... Smart Contract Basics ... 270 9.2 ... Simple Smart Contracts with Bitcoin Script ... 272 9.3 ... Advanced Smart Contracts ... 279 9.4 ... Contract-Oriented Programming ... 282 9.5 ... The Challenge of Random Number Generators ... 287 9.6 ... Trusting Off-Chain Data ... 291 9.7 ... Time Dependencies ... 292 9.8 ... Summary and Outlook ... 29310 ... Integrated Development Environments and Frameworks ... 295 10.1 ... Integrated Development Environments ... 295 10.2 ... Contract-Oriented Frameworks ... 300 10.3 ... Summary and Outlook ... 31311 ... An Introduction to Solidity ... 315 11.1 ... The Basics of Solidity ... 315 11.2 ... Elements and Data Locations of a Contract ... 319 11.3 ... Available Data Types ... 331 11.4 ... Additional Features of Solidity ... 340 11.5 ... Creating Inheritance Hierarchies of Smart Contracts ... 347 11.6 ... Creating and Using Libraries ... 352 11.7 ... Summary and Outlook ... 35612 ... Digging Deeper into Solidity ... 359 12.1 ... Low-Level Functions in Solidity ... 359 12.2 ... Using Assembly in Solidity Smart Contracts ... 363 12.3 ... Internal Layouts of Data Locations ... 371 12.4 ... Understanding the Contract ABI ... 375 12.5 ... Understanding the Bytecode Representation of Smart Contracts ... 376 12.6 ... Summary and Outlook ... 37813 ... Testing and Debugging Smart Contracts ... 381 13.1 ... Testing Contracts with Remix ... 382 13.2 ... Implementing Tests with Foundry ... 386 13.3 ... Implementing Tests with Hardhat ... 391 13.4 ... Debugging Smart Contracts ... 394 13.5 ... Fork Testing Ethereum-Based Chains ... 396 13.6 ... Summary and Outlook ... 39814 ... Understanding and Optimizing Gas Costs ... 401 14.1 ... Understanding Gas Costs in Ethereum ... 401 14.2 ... Understanding the Compiler Optimizer ... 405 14.3 ... Basic Guidelines for Gas Optimization ... 407 14.4 ... Optimizations Derived from Traditional Efficiency Rules ... 411 14.5 ... Advanced Gas Optimization ... 414 14.6 ... Expert Gas Optimizations ... 418 14.7 ... Additional Optimizations for Different Use Cases ... 423 14.8 ... Helpful Tools for Gas Optimizations ... 424 14.9 ... Summary and Outlook ... 42515 ... Protecting and Securing Smart Contracts ... 427 15.1 ... General Security Recommendations ... 427 15.2 ... Example Attacks on Smart Contracts ... 431 15.3 ... Auditing Smart Contracts via Slither ... 454 15.4 ... Summary and Outlook ... 45516 ... Deploying and Managing Smart Contracts ... 457 16.1 ... Setting Up MetaMask and Using Accounts ... 458 16.2 ... Deploying Contracts with Remix and MetaMask ... 459 16.3 ... Deploying Contracts with Foundry ... 462 16.4 ... Deploying Contracts with Hardhat ... 465 16.5 ... Publishing and Verifying Code on Etherscan ... 469 16.6 ... Setting Up and Running Your Own Ethereum Node ... 472 16.7 ... Managing Contracts after Deployment ... 474 16.8 ... Summary and Outlook ... 47617 ... Standards, Libraries, and Design Patterns ... 479 17.1 ... ERC-173 Contract Ownership Standard ... 479 17.2 ... ERC-165 Standardized Interface Detection ... 481 17.3 ... ERC-20 Token Standard ... 485 17.4 ... ERC-777 Token Standard ... 488 17.5 ... ERC-721 Non-Fungible Token Standard ... 489 17.6 ... ERC-1155 Multi-Token Standard ... 494 17.7 ... Using OpenZeppelin Libraries ... 496 17.8 ... The Publish-Subscribe Design Pattern ... 496 17.9 ... The Checks-Effects-Interactions Pattern ... 500 17.10 ... Summary and Outlook ... 50018 ... Upgrading Smart Contracts ... 503 18.1 ... Basics of Upgrade Mechanisms ... 503 18.2 ... Performing Contract Migrations ... 504 18.3 ... Separation of Data and Business Logic ... 508 18.4 ... The Proxy Pattern ... 513 18.5 ... The Diamonds Pattern ... 517 18.6 ... Additional Mechanisms and Considerations ... 520 18.7 ... The Metamorphic Smart Contract Exploit ... 521 18.8 ... Summary and Outlook ... 52619 ... Developing Decentralized Applications ... 529 19.1 ... What Is a Decentralized Application? ... 529 19.2 ... The Development Process for a DApp ... 530 19.3 ... Developing the Smart Contracts of Your First DApp ... 533 19.4 ... Developing the Off-Chain Elements of Your First DApp ... 537 19.5 ... Hosting the Frontend of Your First DApp in a Decentralized Manner ... 543 19.6 ... Setting Up ENS Domains ... 545 19.7 ... Summary and Outlook ... 55020 ... Upgrading Your First DApp to a DAO ... 553 20.1 ... What Is a Decentralized Autonomous Organization? ... 553 20.2 ... Implementing a Governance Contract for Your DAO ... 554 20.3 ... Implementing the Frontend with Vue.js and Ethers.js ... 558 20.4 ... Ideas for Additional Backend and Oracle Services ... 568 20.5 ... Deploying Your DApp and Assigning an ENS Domain ... 569 20.6 ... Additional Frameworks, Tools, and Libraries ... 569 20.7 ... Summary and Outlook ... 57121 ... Reverse Engineering Smart Contracts ... 573 21.1 ... Why Reverse Engineer? ... 573 21.2 ... Manual Reverse Engineering ... 575 21.3 ... Manual Recovery of a Contract ABI ... 586 21.4 ... Tools for Reverse Engineering Smart Contracts ... 590 21.5 ... Summary and Outlook ... 59422 ... Additional Contract-Oriented Programming Languages ... 595 22.1 ... Yul: The Intermediate Language for Different Backends ... 596 22.2 ... Huff: Highly Optimized Smart Contracts ... 605 22.3 ... Vyper: Smart Contracts for Everyone? ... 610 22.4 ... Comparison of Gas Costs ... 614 22.5 ... Summary and Outlook ... 61523 ... Applying Blockchain Technologies ... 617 23.1 ... Decentralized Finance ... 617 23.2 ... Developing and Minting NFTs ... 622 23.3 ... Ethereum Layer 2 Solutions ... 629 23.4 ... Other Blockchain 2.0 Projects ... 631 23.5 ... A Different Blockchain Approach: Ripple ... 633 23.6 ... Summary ... 635... Appendices ... 637 A ... Bibliography ... 637 B ... The Authors ... 639... Index ... 641