Hands-On Smart Contract Development with Solidity and Ethereum: From Fundamentals to Deployment

This document was uploaded by one of our users. The uploader already confirmed that they had the permission to publish it. If you are author/publisher or own the copyright of this documents, please report to us by using this DMCA report form.

Simply click on the Download Book button.

Yes, Book downloads on Ebookily are 100% Free.

Sometimes the book is free on Amazon As well, so go ahead and hit "Search on Amazon"

Ready to dive into smart contract development for the blockchain? With this practical guide, experienced engineers and beginners alike will quickly learn the entire process for building smart contracts for Ethereum--the open source blockchain-based distributed computing platform. You'llget up to speed with the fundamentals and quickly move into builder mode. Kevin Solorio, Randall Kanna, and Dave Hoover show you how to create and test your own smart contract, create a frontend for users to interact with, and more. It's the perfect resource for people who want to break into the smart contract field but don't know where to start. In four parts, this book helps you: • Explore smart contract fundamentals, including the Ethereum protocol, Solidity programming language, and the Ethereum Virtual Machine • Dive into smart contract development using Solidity and gain experience with Truffle framework tools for deploying and testing your contracts • Use Web3 to connect your smart contracts to an applicationso users can easily interact with the blockchain • Examine smart contract security along with free online resources for smart contract security auditing

Author(s): Kevin Solorio, Randall Kanna, David H. Hoover
Edition: 1
Publisher: O'Reilly Media
Year: 2019

Language: English
Commentary: Vector PDF
Pages: 270
City: Sebastopol, CA
Tags: Security; Blockchain; Node.js; Ethereum; Solidity; Smart Contracts; Distributed Applications; web3.js; React.js

Copyright
Table of Contents
Preface
Mastering Ethereum
ConsenSys Academy
B9 Academy
Conventions Used in This Book
Using Code Examples
O’Reilly Online Learning
How to Contact Us
Acknowledgments
Part I. Intro to the Ethereum Blockchain
Chapter 1. Blockchain Concepts
A Brief History
The Character of a Blockchain
Decentralized Networks
Consensus Protocols
Transaction Processing
Transaction Finality
Hard Forks
Ethereum Fundamentals
Ether and Gas
Accounts
Contracts
Blocks and Transactions
What Time Is It?
Signing Transactions
Summary
Chapter 2. Decentralized Applications
Tokens
ERC-20
Non-Fungible Token (ERC-721)
Supply Chain
Permanent Records
Evaluating Blockchain for Your Application
Verifiable
Transparent
Resilient
Summary
Chapter 3. Before We Get Started
Ethereum Clients
Installing Parity
Installing MetaMask
Installing Node.js
Ubuntu Installation (Including Windows WSL Ubuntu)
Mac Installation
Installing the Truffle Suite
Truffle
Ganache
Summary
Part II. Developing Smart Contracts
Chapter 4. Our First Smart Contract
Setup
Our First Test
Saying Hello
Making Our Contract Dynamic
Making the Greeter Ownable
Summary
Chapter 5. Deploying and Interacting with Contracts
Contract Compilation and Deployment
Deployment Process
Setting Up the UI
Deploying to Ganache
Deploying to Goerli with Parity
Deploying to Rinkeby with Infura
Summary
Chapter 6. The Fundraiser Application
Application Overview
Creating the Project
Initializing Fundraisers
Setting the Beneficiary and Custodian
Editing the Beneficiary
Making Donations
Structs
Mappings
Donation Tests
myDonations
Fundraiser Totals
Events
Withdrawing Funds
Fallback Functions
Summary
Chapter 7. FundraiserFactory
Migrating Our FundraiserFactory
Creating Fundraisers
Viewing Available Fundraisers
Testing Pagination When Empty
Testing the Limit
Testing the Offset
Setting Up the UI
Summary
Part III. Interacting with Our Smart Contracts Through Web3
Chapter 8. What Is Web3?
The Frontend, Web3, and the Blockchain
Web3 Methods
getAccounts()
getBlockNumber()
getBalance()
sendTransaction()
Providers
Promises with Web3
MetaMask for Web3 Injection
Send (State Updates/Write)
Call (Reads)
Summary
Chapter 9. Connecting the UI to Our Contracts
Why React?
Dev Setup
Truffle
React Truffle Box Setup
Importing our Greeter Contracts
Adding Our Greeter Contract Functionality
Setting Our Greeting Through React
Summary
Chapter 10. Our Larger DApp
Starting with React Truffle Box
Fundraiser Setup
React Routing
React and Material UI
Creating Our New Fundraiser Page View
Displaying the Current Fundraisers List
Summary
Chapter 11. Finishing Our Fundraiser UI
Adding Detailed Information About Each Fundraiser
Implementing a Material UI Dialog
Accepting a Donation with React
Testing a Donation
Displaying the Current ETH Exchange Rate
Generating a Donation Receipt for Our User
Handling a Withdrawal from Our Contract
Adding Edit Beneficiary to the Contract
Summary
Part IV. Securing Your Smart Contracts
Chapter 12. Smart Contract Security
Why Do We Need to Worry About Security?
Types of Smart Contract Vulnerabilities
Unprotected Function
Transaction Ordering Dependence
Integer Overflow and Underflow
Reentrancy
Block Gas Limit
Timestamp Dependence
And Many More
Preparing Your Contract for an External Audit
External Auditing
Auditing Companies
Solidified
Free Auditing Resources
Growing Your Auditing Skills
Summary
Index
About the Authors
Colophon